gen2brain / go-fitz

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

Update to latest libmupdf #117

Closed Michal-Szczepaniak closed 1 month ago

Michal-Szczepaniak commented 1 month ago

mupdf does not provide shared libmupdf-third library since mupdf 1.18, and we're at like 1.24 now, it's 4 years old currently so please update it because this package cannot be built on anything newer than 4 years.

gen2brain commented 1 month ago

I don't remember ever seeing mupdf-third shared library, usually, when it is built shared it uses the system libraries. Here, it is used when compiled statically or when bundled library is used. The current code can successfully be compiled on distros with recent MuPDF, shared, static, or via pkg-config for distros that provide it.

beniaminblaszkiewicz commented 1 month ago

Hey, I'm using openSUSE Tumleweed 20240711 and I have problem with using that library locally(its working fine with docker). I got error:

/usr/bin/gcc -m64 -o $WORK/b001/exe/a.out -Wl,--export-dynamic-symbol=_cgo_panic -Wl,--export-dynamic-symbol=_cgo_topofstack -Wl,--export-dynamic-symbol=crosscall2 -Wl,--compress-debug-sections=zlib /tmp/go-link-690259483/go.o /tmp/go-link-690259483/000000.o /tmp/go-link-690259483/000001.o /tmp/go-link-690259483/000002.o /tmp/go-link-690259483/000003.o /tmp/go-link-690259483/000004.o /tmp/go-link-690259483/000005.o /tmp/go-link-690259483/000006.o /tmp/go-link-690259483/000007.o /tmp/go-link-690259483/000008.o /tmp/go-link-690259483/000009.o /tmp/go-link-690259483/000010.o /tmp/go-link-690259483/000011.o /tmp/go-link-690259483/000012.o /tmp/go-link-690259483/000013.o /tmp/go-link-690259483/000014.o /tmp/go-link-690259483/000015.o /tmp/go-link-690259483/000016.o /tmp/go-link-690259483/000017.o /tmp/go-link-690259483/000018.o /tmp/go-link-690259483/000019.o /tmp/go-link-690259483/000020.o /tmp/go-link-690259483/000021.o /tmp/go-link-690259483/000022.o /tmp/go-link-690259483/000023.o /tmp/go-link-690259483/000024.o /tmp/go-link-690259483/000025.o -O2 -g -lresolv -O2 -g -lpthread -O2 -g -L/home/bblaszkiewicz/GolandProjects/ToppointAIAssistant/vendor/github.com/gen2brain/go-fitz/libs -lmupdf_linux_amd64 -lmupdfthird_linux_amd64 -lm -O2 -g -no-pie /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: cannot find -lmupdf_linux_amd64: No such file or directory /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: cannot find -lmupdfthird_linux_amd64: No such file or directory collect2: error: ld returned 1 exit status

it seems that openSUSE have linuxmupdf-third.a instead of libmupdfthird_linux_amd64.a and symlinking does not help. Have you got any suggestion how to fix it?

gen2brain commented 1 month ago

This cannot find -lmupdf_linux_amd64 is used only for bundled libraries, included in this repo, of course, there will not be such a library in any distro, so the question is how are you using it, do you use vendor in which case it will not work, see https://github.com/gen2brain/go-fitz/issues/111 and many other vendor related issues.

beniaminblaszkiewicz commented 1 month ago

Thanks for that, disabling vendor mode(build with flag GOFLAGS="-mod=mod") fix issue