go-fitz
go-fitz copied to clipboard
Getting error when building
Hi,
I am using the fitz library to convert pdf into png.While building i am getting the below error - .CGO_LDFLAGS is set to '-lmupdf -lm -lmupdf-third -lfreetype -ljbig2dec -lharfbuzz -ljpeg -lopenjp2 -lz' and CGO_CFLAGS to '-O2 -g' .
go build -v -o ./cmd/pdfconv/pdfconv ./cmd/pdfconv/ github.com/gen2brain/go-fitz
github.com/gen2brain/go-fitz
vendor/github.com/gen2brain/go-fitz/fitz.go:6:10: fatal error: 'mupdf/fitz.h' file not found #include <mupdf/fitz.h> ^~~~~~~~~~~~~~
You are using vendor, see https://github.com/gen2brain/go-fitz/issues/111 and many other related issues. Also, not sure why you are using CFLAGS/LDFLAGS.
Without setting CFLAGS/LDFLAGS(used to explicitly provice depency of mupdf -lmupdf) too i am getting the same error.And vendor folder is only for my local,when i ddeploy it as a container the dependencies are taken from gcp.artifactory.It throws the same error there too.
What should be the fix for vendor/github.com/gen2brain/go-fitz/fitz.go:6:10: fatal error: 'mupdf/fitz.h' file not found ?
As I wrote, see https://github.com/gen2brain/go-fitz/issues/111, or do not use vendor.
Thanks @gen2brain it worked without vendor.Any idea how can i use this library in dockerfile ,its giving the same error with a static-debian12 image .
No idea, why should anything be different? What is that static-debian anyway, you will not get static binary, it will link to libc, unless you also build with --static.
Support for vendoring include files and libs is added.