Open DarkiT opened 1 year ago
Did you try the command:
make build_static
by any chance?
I have the same error as above. I try building it inside a docker container with the new static dockerfile and recieve the same error.
I also tried by checking out the repo and building with make build_static
but recieve the same result
See example files below:
Dockerfile
FROM ghcr.io/hybridgroup/opencv:4.8.0-static
WORKDIR app
COPY . .
RUN go build -tags static --ldflags '-extldflags "-static"' -o output main.go
CMD ["/app/output"]
main.go
package main
import (
"fmt"
"gocv.io/x/gocv"
)
func main() {
fmt.Println(fmt.Sprintf("opencv version: %s, gocv version: %s", gocv.OpenCVVersion(), gocv.Version()))
}
Description
I have a pretty much clean Ubuntu 20.04 environment where I want to run gocv. The normal installation runs fine, but if I try to run it with BUILD_SHARED_LIBS=OFF the installation fails with
root@53ee82285d3a:/go/gocv# go build -tags static --ldflags '-extldflags "-static"' -v -tags customenv . /usr/local/go/pkg/tool/linux_amd64/link: running g++ failed: exit status 1 /usr/bin/ld: cannot find -lIconv::Iconv /usr/bin/ld: /go/opencv/build/lib/libopencv_core.a(opencl_core.cpp.o): in function `opencl_check_fn(int)': opencl_core.cpp:(.text._ZL15opencl_check_fni+0xea): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/bin/ld: cannot find -lIconv::Iconv collect2: error: ld returned 1 exit status