davidbyttow / govips

A lightning fast image processing and resizing library for Go
MIT License
1.23k stars 196 forks source link

undefined: vips.Startup #393

Closed Rusinas closed 9 months ago

Rusinas commented 9 months ago

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

image

Kindly requesting @tonimelisma help because there aren't many alternatives available for solving image processing in Go :(

tonimelisma commented 9 months ago

Did you install the go module? Looks like an issue with your environment, not a bug with govips.

Rusinas commented 9 months ago

@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

Rusinas commented 9 months ago

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

stonymahony commented 4 months ago

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?

stonymahony commented 4 months ago

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 ? 🙂