govips
govips copied to clipboard
support fully static link build
It would be useful to build with fully static link, is there any way I can do to achive it? I tried the following cmd, but get some errors.
CGO_ENABLED=0 go build -a -ldflags '-extldflags "-static"' .
/Users/cxxxxxtool.go:31:13: undefined: vips.NewAvifExportParams
/Users/cxxxxxtool.go:61:13: undefined: vips.NewJpegExportParams
/Users/cxxxxxtool.go:83:74: undefined: vips.ImageRef
/Users/cxxxxxtool.go:93:26: undefined: vips.NewImageFromReader
/Users/cxxxxxtool.go:108:82: undefined: vips.ImageRef
/Users/cxxxxxtool.go:119:39: undefined: vips.KernelAuto
Duplicate: https://github.com/davidbyttow/govips/issues/339
But the problem remains - it seems this is not statically buildable. This is a pitty as a lot of golang users really want to compile it down to one single statically binary to place it into a docker scratch container for additional security and less overhead.
I may be mistaken, but one of the reasons for dynlinking is the licence. Libvips is LGPL, while this package is MIT. With static linking, all software that uses this package would automatically turn into LGPL software. There are probably technical reasons, too. But as I can see, libvips language bindings are usually MIT or similar licenced.