rogchap / v8go

Execute JavaScript from Go
https://rogchap.com/v8go
BSD 3-Clause "New" or "Revised" License
3.21k stars 221 forks source link

How to properly build go binary that uses v8go inside docker? #390

Open begmaroman opened 1 year ago

begmaroman commented 1 year ago
RUN CGO_ENABLED=1 GOOS=linux go build -ldflags="-X 'main.BranchName=' -X 'main.SHA='" -a -tags musl -o nerif-app ./main.go:
#20 60.58 # command-line-arguments
#20 60.58 /usr/local/go/pkg/tool/linux_amd64/link: running g++ failed: exit status 1
#20 60.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /go/pkg/mod/rogchap.com/v8go@v0.9.0/deps/linux_x86_64/libv8.a(platform-posix.o): in function `v8::base::OS::VPrint(char const*, __va_list_tag*)':
#20 60.58 platform-posix.cc:(.text._ZN2v84base2OS6VPrintEPKcP13__va_list_tag+0x1a): undefined reference to `__vfprintf_chk'
#20 60.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /go/pkg/mod/rogchap.com/v8go@v0.9.0/deps/linux_x86_64/libv8.a(platform-posix.o): in function `v8::base::OS::VFPrint(_IO_FILE*, char const*, __va_list_tag*)':

How to properly setup an environment inside docker container in order to successfully build the image?