Open Rusinas opened 1 year ago
@Rusinas
install https://www.msys2.org/ use this link for reference: https://stackoverflow.com/questions/30069830/how-to-install-mingw-w64-and-msys2
On the MSYS2 terminal, you want to install pkg-config:
pacman -S pkg-config
Install libvips, but you need exactly this version:
https://github.com/libvips/libvips/releases/tag/v8.12.0
add it to your path and run:
vips --version
Then, run on cmd:
set PKG_CONFIG_PATH=C:\Users\You\Path\To\vips-dev-8.12\lib\pkgconfig
Confirm that it worked by running:
pkg-config --list-all
Now you should be able to use bimg.
@margen2 OH MY GOD THANK YOU I GOT THIS WORKING
Also... This is unrelated, but I don't think it worth creating another topic: while I was trying to solve this problem, I've tried to run everything inside of a docker container and the problem there was that I had to disable cgo for some reason (ENV CGO_ENABLED=0). If I disable it, errors was in bimg:
#11 2.353 # github.com/h2non/bimg
#11 2.353 /go/pkg/mod/github.com/h2non/bimg@v1.1.9/image.go:93:49: undefined: Gravity
#11 2.353 /go/pkg/mod/github.com/h2non/bimg@v1.1.9/image.go:133:29: undefined: Watermark
#11 2.353 /go/pkg/mod/github.com/h2non/bimg@v1.1.9/image.go:139:34: undefined: WatermarkImage
#11 2.353 /go/pkg/mod/github.com/h2non/bimg@v1.1.9/image.go:152:26: undefined: Angle
#11 2.353 /go/pkg/mod/github.com/h2non/bimg@v1.1.9/image.go:181:31: undefined: Interpretation
#11 2.353 /go/pkg/mod/github.com/h2non/bimg@v1.1.9/image.go:202:27: undefined: Options
#11 2.353 /go/pkg/mod/github.com/h2non/bimg@v1.1.9/image.go:212:29: undefined: ImageMetadata
#11 2.353 /go/pkg/mod/github.com/h2non/bimg@v1.1.9/image.go:218:35: undefined: Interpretation
#11 2.353 /go/pkg/mod/github.com/h2non/bimg@v1.1.9/image.go:234:25: undefined: ImageSize
#11 2.353 /go/pkg/mod/github.com/h2non/bimg@v1.1.9/resize.go:11:27: undefined: Options
#11 2.353 /go/pkg/mod/github.com/h2non/bimg@v1.1.9/resize.go:11:27: too many errors
But if I didn't I will get this error, even though the container build successfully:
standard_init_linux.go:228: exec user process caused: no such file or directory
You need cgo enabled to use bimg, you won't be able to run it with CGO_ENABLED=0. As for the docker issue, it seems to be related to docker and not libvips or bimg. It may be an issue with CRLF/LF: https://stackoverflow.com/questions/68881023/docker-standard-init-linux-go228-exec-user-process-caused-no-such-file-or-dir I also spent too much time trying to make it work :sweat_smile:
@margen2 After all of that I'm still getting fatal error: vips/vips.h: No such file or directory
. When i run pkg-config --list-all
it shows vips
in the list.
@etareduction I have just tried following those steps on a fresh win10 computer and it worked as expected. I remember seeing this error while trying to use a different version of libvips, I used this version: https://github.com/libvips/build-win64-mxe/releases/download/v8.12.0/vips-dev-w64-all-8.12.0.zip and make sure to uninstall any other version you may have left. With go 1.20 cgo may be disabled on your machine, confirm that it is set to CGO_ENABLED=1.
@margen2 Yeah, I've installed only version 8.12.0 and i'm sure cgo is enabled.
Edit: Now when i looked at it, it seems I've installed web
version, not all
. Can that be a problem? I would like to use web
one cause that's what i would use in production anyways.
@etareduction I would at least try again with the all
version just to confirm.
@etareduction I would at least try again with the
all
version just to confirm.
I'm not sure if i could find time for that right now, pretty busy at my project. For the time being, I've workaround this issue by using WSL and installing libvips from apt.
For me it is the same with all, this is what I get
OK, this is how I fix it. I use WSL and try to run it I get the same thing. then I install pkg-config I get another error something like pkg-config vips vips vips and I install libvips-dev and it work now :)
Bimg looks like a great package and exactly what I was looking for, but installation looks a littble bit tricky, especially on Windows. I don't understand how to provide necessary dependencies, which are libvips and C compiler :( Is there any manual for it?