rogchap / v8go

Execute JavaScript from Go

Home Page:https://rogchap.com/v8go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

undefined symbol: __libc_single_threaded

Skroopa opened this issue · comments

Building a Go plugin using Docker, but program stops with:

backend.so: undefined symbol: __libc_single_threaded

Here is the Dockerfile:

FROM golang:1.20.6-bullseye AS go-builder

ENV GO111MODULE on
ENV CGO_CFLAGS -lc
ENV PATH=/usr/local/lib/nodejs/node-v18.17.1-linux-x64/bin:/depot_tools:$PATH

WORKDIR /backend

COPY main.go .
#COPY *.so .

RUN wget --no-clobber https://nodejs.org/dist/v18.17.1/node-v18.17.1-linux-x64.tar.xz
RUN mkdir -p /usr/local/lib/nodejs
RUN dpkg --add-architecture amd64 && apt-get update -y && apt-get upgrade -y && apt-get install -y --no-install-recommends sudo lsb-release git python lbzip2 curl xz-utils zip build-essential gcc gcc-x86-64-linux-gnu g++-x86-64-linux-gnu build-essential gcc glibc-source
RUN tar -xJvf node-v18.17.1-linux-x64.tar.xz -C /usr/local/lib/nodejs

# v8
#RUN cd / && git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
#RUN fetch v8 && cd v8 && git checkout 11.1.277.13 &&  ./build/install-build-deps.sh && cd ../ && gclient sync
#RUN cd v8 && gn gen out/x64.release --args='is_component_build=true is_debug=false target_cpu="x64" v8_enable_future=true v8_enable_webassembly=true' && ./tools/dev/v8gen.py -b 'V8 Linux64 - builder' -m client.v8 x64.release && ninja -C out/x64.release

RUN go mod init go-proj && go mod tidy && go mod vendor && go build --trimpath --mod=vendor --buildmode=plugin -o ./backend.so

COPY --from=go-builder /backend/backend.so /modules

No idea what else to try to shut this thing up. Any clues, what is required?

noob mistake. golang:1.20.6-bullseye has old libc.so.*, which doesn't export __libc_single_threaded func. I upgraded to ubuntu:22.04 and after that everything went smoothly. No need to run all these apt-gets, Ubuntu 22.04 has libs which are version-wise enough for running v8go.