Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

centos alpine build faild #105

Closed
BlackDogLi opened this issue Apr 12, 2024 · 5 comments
Closed

centos alpine build faild #105

BlackDogLi opened this issue Apr 12, 2024 · 5 comments

Comments

@BlackDogLi
Copy link

  • go env
    [2024-04-12 15:52:42] GO111MODULE='on'
    [2024-04-12 15:52:42] GOARCH='amd64'
    [2024-04-12 15:52:42] GOBIN=''
    [2024-04-12 15:52:42] GOCACHE='/root/.cache/go-build'
    [2024-04-12 15:52:42] GOENV='/root/ONLINE_SERVICE/other/ferry/task_workspace/baidu/baike-service/annotation/go.env'
    [2024-04-12 15:52:42] GOEXE=''
    [2024-04-12 15:52:42] GOEXPERIMENT=''
    [2024-04-12 15:52:42] GOFLAGS=''
    [2024-04-12 15:52:42] GOHOSTARCH='amd64'
    [2024-04-12 15:52:42] GOHOSTOS='linux'
    [2024-04-12 15:52:42] GOINSECURE=''
    [2024-04-12 15:52:42] GOMODCACHE='/root/go/pkg/mod'
    [2024-04-12 15:52:42] GOOS='linux'
    [2024-04-12 15:52:42] GOPATH='/root/go'
    [2024-04-12 15:52:42] GOROOT='/home/opt/deck/2.0/go-1.21.7'
    [2024-04-12 15:52:42] GOSUMDB='sum.golang.org'
    [2024-04-12 15:52:42] GOTMPDIR=''
    [2024-04-12 15:52:42] GOTOOLCHAIN='auto'
    [2024-04-12 15:52:42] GOTOOLDIR='/home/opt/deck/2.0/go-1.21.7/pkg/tool/linux_amd64'
    [2024-04-12 15:52:42] GOVCS=''
    [2024-04-12 15:52:42] GOVERSION='go1.21.7'
    [2024-04-12 15:52:42] GCCGO='gccgo'
    [2024-04-12 15:52:42] GOAMD64='v1'
    [2024-04-12 15:52:42] AR='ar'
    [2024-04-12 15:52:42] CC='/opt/compiler/gcc-8.2/bin/gcc'
    [2024-04-12 15:52:42] CXX='/opt/compiler/gcc-8.2/bin/g++'
    [2024-04-12 15:52:42] CGO_ENABLED='1'
    [2024-04-12 15:52:42] GOMOD='/root/ONLINE_SERVICE/other/ferry/task_workspace/annotation/go.mod'
    [2024-04-12 15:52:42] GOWORK=''
    [2024-04-12 15:52:42] CGO_CFLAGS='-O2 -g'
    [2024-04-12 15:52:42] CGO_CPPFLAGS=''
    [2024-04-12 15:52:42] CGO_CXXFLAGS='-O2 -g'
    [2024-04-12 15:52:42] CGO_FFLAGS='-O2 -g'
    [2024-04-12 15:52:42] CGO_LDFLAGS='-O2 -g'
    [2024-04-12 15:52:42] PKG_CONFIG='pkg-config'
    [2024-04-12 15:52:42] GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1005273812=/tmp/go-build -gno-record-gcc-switches'
  • build
    go build -o -tags musl ./annotation
  • error
    /home/opt/deck/2.0/go-1.21.7/pkg/tool/linux_amd64/link: running /opt/compiler/gcc-8.2/bin/gcc failed: exit status 1
    [2024-04-12 15:54:42] /home/opt/compiler/gcc-8.2/gcc-8.2/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /root/go/pkg/mod/github.com/gen2brain/go-fitz@v1.20.1/libs/libmupdf_linux_amd64_musl.a(buffer.o): in function fz_new_buffer': [2024-04-12 15:54:42] buffer.c:(.text.fz_new_buffer+0x47): undefined reference to sigsetjmp'
    [2024-04-12 15:54:42] /home/opt/compiler/gcc-8.2/gcc-8.2/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /root/go/pkg/mod/github.com/gen2brain/go-fitz@v1.20.1/libs/libmupdf_linux_amd64_musl.a(buffer.o): in function fz_new_buffer_from_data': [2024-04-12 15:54:42] buffer.c:(.text.fz_new_buffer_from_data+0x27): undefined reference to sigsetjmp'
    [2024-04-12 15:54:42] /home/opt/compiler/gcc-8.2/gcc-8.2/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /root/go/pkg/mod/github.com/gen2brain/go-fitz@v1.20.1/libs/libmupdf_linux_amd64_musl.a(buffer.o): in function fz_new_buffer_from_base64': [2024-04-12 15:54:42] buffer.c:(.text.fz_new_buffer_from_base64+0xf6): undefined reference to sigsetjmp'
    [2024-04-12 15:54:42] /home/opt/compiler/gcc-8.2/gcc-8.2/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /root/go/pkg/mod/github.com/gen2brain/go-fitz@v1.20.1/libs/libmupdf_linux_amd64_musl.a(colorspace.o): in function fz_cached_color_convert': [2024-04-12 15:54:42] colorspace.c:(.text.fz_cached_color_convert+0xa0): undefined reference to sigsetjmp'
    [2024-04-12 15:54:42] /home/opt/compiler/gcc-8.2/gcc-8.2/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /root/go/pkg/mod/github.com/gen2brain/go-fitz@v1.20.1/libs/libmupdf_linux_amd64_musl.a(colorspace.o): in function fz_new_colorspace': [2024-04-12 15:54:42] colorspace.c:(.text.fz_new_colorspace+0x6f): undefined reference to sigsetjmp'
    [2024-04-12 15:54:42] /home/opt/compiler/gcc-8.2/gcc-8.2/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /root/go/pkg/mod/github.com/gen2brain/go-fitz@v1.20.1/libs/libmupdf_linux_amd64_musl.a(colorspace.o):colorspace.c:(.text.fz_new_icc_colorspace+0x76): more undefined references to `sigsetjmp' follow
  • dockerFile
    has RUN http_proxy=http://10.8.5.5:3128 https_proxy=http://10.8.5.5:3128 apk --update add --no-cache musl-dev gcc
@gen2brain
Copy link
Owner

So what is it, Centos or Alpine? What is the compiler in /home/opt/compiler, is it a musl gcc? It looks like you are trying to compile for musl using plain gcc. You have examples in issues of how to build for Alpine and Musl.

@gen2brain
Copy link
Owner

Right, so I just tested, you must use musl gcc if you want to build for musl, i.e:

go build -tags musl
# example
/usr/lib/go/pkg/tool/linux_amd64/link: running x86_64-pc-linux-gnu-gcc failed: exit status 1
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /home/milann/.cache/go/mod/github.com/gen2brain/go-fitz@v1.23.7/libs/libmupdf_linux_amd64_musl.a(buffer.o): in function `fz_new_buffer':
buffer.c:(.text.fz_new_buffer+0x47): undefined reference to `sigsetjmp'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /home/milann/.cache/go/mod/github.com/gen2brain/go-fitz@v1.23.7/libs/libmupdf_linux_amd64_musl.a(buffer.o): in function `fz_new_buffer_from_data':
buffer.c:(.text.fz_new_buffer_from_data+0x27): undefined reference to `sigsetjmp'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /home/milann/.cache/go/mod/github.com/gen2brain/go-fitz@v1.23.7/libs/libmupdf_linux_amd64_musl.a(buffer.o): in function `fz_new_buffer_from_base64':
buffer.c:(.text.fz_new_buffer_from_base64+0xeb): undefined reference to `sigsetjmp'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /home/milann/.cache/go/mod/github.com/gen2brain/go-fitz@v1.23.7/libs/libmupdf_linux_amd64_musl.a(colorspace.o): in function `fz_cached_color_convert':
colorspace.c:(.text.fz_cached_color_convert+0x9f): undefined reference to `sigsetjmp'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /home/milann/.cache/go/mod/github.com/gen2brain/go-fitz@v1.23.7/libs/libmupdf_linux_amd64_musl.a(colorspace.o): in function `fz_new_colorspace':
colorspace.c:(.text.fz_new_colorspace+0x6f): undefined reference to `sigsetjmp'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /home/milann/.cache/go/mod/github.com/gen2brain/go-fitz@v1.23.7/libs/libmupdf_linux_amd64_musl.a(colorspace.o):colorspace.c:(.text.fz_new_icc_colorspace+0x76): more undefined references to `sigsetjmp' follow
collect2: error: ld returned 1 exit status
CC=x86_64-pc-linux-musl-gcc go build -tags musl
file example
example: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-x86_64.so.1, Go BuildID=uBMxLYbblufj-uelQYGh/9CWUatp-5ceiXax-Q6BM/kfblecrTQjl1tydrm8--/6BbPjkjOoNv3cPP-LWK1, with debug_info, not stripped

@BlackDogLi
Copy link
Author

So what is it, Centos or Alpine? What is the compiler in /home/opt/compiler, is it a musl gcc? It looks like you are trying to compile for musl using plain gcc. You have examples in issues of how to build for Alpine and Musl.

centos

@BlackDogLi
Copy link
Author

could i use musl gcc for centos image. like RUN yum install -y gcc musl-dev ?

@gen2brain
Copy link
Owner

Sorry, no idea, try it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants