gen2brain / go-fitz

Golang wrapper for the MuPDF Fitz library
GNU Affero General Public License v3.0
369 stars 87 forks source link

libmupdf_linux_amd64.a error #85

Closed cjieyan closed 1 year ago

cjieyan commented 1 year ago

github.com/gen2brain/go-fitz

/usr/bin/ld: ../../../pkg/mod/github.com/gen2brain/go-fitz@v1.22.2/libs/libmupdf_linux_amd64.a(colorspace.o): unrecognized relocation (0x2a) in section `.text.fz_find_icc_link' /usr/bin/ld: final link failed: Bad value

cjieyan commented 1 year ago

go env:

GO111MODULE="on" GOARCH="amd64" GOBIN="" GOCACHE="/root/.cache/go-build" GOENV="/root/.config/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/xxx/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/xxx" GOPRIVATE="" GOPROXY="https://goproxy.cn,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.18.3" GCCGO="gccgo" GOAMD64="v1" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOWORK="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1070248973=/tmp/go-build -gno-record-gcc-switches"

gen2brain commented 1 year ago

It looks like you are using an old GGC compiler and old binutils. You can check that with gcc --version and ld --version. If that is the case either upgrade or use an external library.

chenghonour commented 1 year ago

same problem. gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4 GNU ld (GNU Binutils for Ubuntu) 2.24

go 1.19 go env -w GO111MODULE=on go env -w CGO_ENABLED=1 go env -w GOOS=linux go env -w GOARCH=amd64 go build -ldflags '-s -w' -tags musl @gen2brain

gen2brain commented 1 year ago

Ok, it is the same, but can you confirm you are using old gcc and binutils? If that is the case then there is no issue here.

gen2brain commented 1 year ago

@chenghonour Thanks. Yes, the relocations are used for some optimizations that are implemented in binutils 2.26 or later. Sorry, I do not have plans to support bundled libraries for old installations, it already takes time.

srctar commented 3 months ago

@chenghonour Thanks. Yes, the relocations are used for some optimizations that are implemented in binutils 2.26 or later. Sorry, I do not have plans to support bundled libraries for old installations, it already takes time.

hello. I have the same question: mod/github.com/gen2brain/go-fitz@v1.23.7/libs/libmupdf_linux_amd64.a(colorspace.o): unrecognized relocation (0x2a) in section.text.fz_find_icc_link'` ;
but my ld version is 2.27:

$ ld -v
GNU ld version 2.27-44.base.el7_9.1

gcc os later than his version 4.8.5:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure 
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 

Could you please help me ~
thanks

gen2brain commented 3 months ago

@srctar As mentioned above, I have no plans to support these old installations. The GCC you are using was released about 10 years ago. Install/compile libmupdf and try to use it with extlib build tag.

srctar commented 3 months ago

@srctar As mentioned above, I have no plans to support these old installations. The GCC you are using was released about 10 years ago. Install/compile libmupdf and try to use it with extlib build tag.

Thank you very much, I·ll try to compile libmupdf on my server