undefined: vips.Startup
Rusinas opened this issue · comments
Can't make it work :(
My main.go:
package main
import (
"github.com/davidbyttow/govips/v2/vips"
)
func main() {
vips.Startup(nil)
defer vips.Shutdown()
}
go.mod:
module image-processing
go 1.21.4
require github.com/davidbyttow/govips/v2 v2.13.0
require (
golang.org/x/image v0.14.0 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
)
Everything looks fine, but unable to run. Probably important note that I am on Windows, which is kinda unsupported, but I am trying to dockerize this anyway. Dockerfile:
FROM golang:latest AS builder
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ENV CGO_ENABLED=0 GOOS=linux GOARCH=amd64
RUN go build -ldflags="-s -w" -o image-processing .
FROM ubuntu:latest
RUN apt update && apt upgrade -y
RUN apt -y install libvips-dev
COPY --from=builder ["/build/image-processing", "/"]
ENTRYPOINT ["/image-processing"]
But the error is the same as VSCode is highlighting:
Kindly requesting @tonimelisma help because there aren't many alternatives available for solving image processing in Go :(
Did you install the go module? Looks like an issue with your environment, not a bug with govips.
@tonimelisma sorry for bothering, but what do you mean by "install the go module"?
If you mean go get -u github.com/davidbyttow/govips/v2/vips
, then sure, I did it. Maybe I am missing something? I have no clue what could be an issue in my environment. Would appreciate any help
I just performed a clean installation on a new environment, same results. Steps:
-Install golang 1.24.4
-Create new project (go mod init test
)
-Install govips go get -u github.com/davidbyttow/govips/v2/vips
-go mod tidy
(optional, but omitting this step doesn't affect the result)
-Try to use it (vips.Startup(nil)
)
-Same error undefined: vips.Startup
I have the same problem and can't get the package set up. I follow the documentation and the examples in /examples.
Tried several variations, like github.com/davidbyttow/govips/v2
, vips github.com/davidbyttow/govips/v2/vips
, vips github.com/davidbyttow/govips/v2
...
What are we doing wrong?
I have now discovered that the error only occurs under Windows, at least for me - the same code compiles under Linux and Mac OS without any problems. Can anyone confirm this?
Any ideas, maybe @tonimelisma ? 🙂