go-fitz icon indicating copy to clipboard operation
go-fitz copied to clipboard

Getting error when building

Open abhijitpratinidhi opened this issue 1 year ago • 6 comments
trafficstars

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> ^~~~~~~~~~~~~~

abhijitpratinidhi avatar Aug 07 '24 08:08 abhijitpratinidhi

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.

gen2brain avatar Aug 07 '24 11:08 gen2brain

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.

abhijitpratinidhi avatar Aug 07 '24 11:08 abhijitpratinidhi

What should be the fix for vendor/github.com/gen2brain/go-fitz/fitz.go:6:10: fatal error: 'mupdf/fitz.h' file not found ?

abhijitpratinidhi avatar Aug 07 '24 11:08 abhijitpratinidhi

As I wrote, see https://github.com/gen2brain/go-fitz/issues/111, or do not use vendor.

gen2brain avatar Aug 07 '24 11:08 gen2brain

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 .

abhijitpratinidhi avatar Aug 08 '24 08:08 abhijitpratinidhi

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.

gen2brain avatar Aug 08 '24 10:08 gen2brain

Support for vendoring include files and libs is added.

gen2brain avatar Sep 27 '24 15:09 gen2brain