Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to use bimg on Windows? #435

Open
Rusinas opened this issue Nov 26, 2022 · 10 comments
Open

Is it possible to use bimg on Windows? #435

Rusinas opened this issue Nov 26, 2022 · 10 comments

Comments

@Rusinas
Copy link

Rusinas commented Nov 26, 2022

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?

@margen2
Copy link

margen2 commented Dec 4, 2022

@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.

@Rusinas
Copy link
Author

Rusinas commented Dec 5, 2022

@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

@margen2
Copy link

margen2 commented Dec 5, 2022

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 😅

@etareduction
Copy link

@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.

@margen2
Copy link

margen2 commented Feb 9, 2023

@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.

@etareduction
Copy link

etareduction commented Feb 9, 2023

@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.

@margen2
Copy link

margen2 commented Feb 9, 2023

@etareduction I would at least try again with the all version just to confirm.

@etareduction
Copy link

@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.

@tinkerbaj
Copy link

For me it is the same with all, this is what I get
image

@tinkerbaj
Copy link

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants