You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Building a Go app with gocv/opencv:4.9.0-static docker image fails.
Description
I'm trying to build a static go binary using gocv/opencv:4.9.0-static as base. Unfortunately the go build command fails. Is this a known bug? Does it require an additional configuration to make it compile? Given gocv is already shipped in the docker image I expected it to just work.
Steps to Reproduce
I'm a Dockerfile to build the app and later run it as part of a web service. The docker file is pretty simple. Here is a bit more reduced:
FROM gocv/opencv:4.9.0-static as golang ... RUN go build -ldflags="-extldflags=-static" -o main
It throws a bunch of errors such below. log.txt
/usr/local/go/pkg/tool/linux_amd64/link: running g++ failed: exit status 1
/usr/bin/ld: /tmp/go-link-1938547386/000056.o: in function mygetgrouplist': /usr/bin/ld: /usr/local/lib/libopencv_dnn.a(types.pb.cc.o): in function _GLOBAL__sub_I.00102_types.pb.cc':
types.pb.cc:(.text.startup._GLOBAL__sub_I.00102_types.pb.cc+0xf): undefined reference to google::protobuf::internal::AddDescriptorsRunner::AddDescriptorsRunner(google::protobuf::internal::DescriptorTable const*)' /usr/bin/ld: $WORK/b001/exe/a.out: hidden symbol opj_read_header' isn't defined
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
`
How did you install OpenCV?
I've got it preinstalled using the docker repo : gocv/opencv:4.9.0-static
GoCV version used:
I use go modules withgocv.io/x/gocv v0.36.1, vendored as well.
Go version:
docker based gocv/opencv:4.9.0-static which I believe has Go go1.22.0
Did you run the env.sh or env.cmd script before trying to go run or go build?
Yes, it said This script is no longer necessary and has been deprecated. See the Custom Environment section of the README if you need to customize your environment.
The text was updated successfully, but these errors were encountered:
Building a Go app with gocv/opencv:4.9.0-static docker image fails.
Description
I'm trying to build a static go binary using
gocv/opencv:4.9.0-static
as base. Unfortunately the go build command fails. Is this a known bug? Does it require an additional configuration to make it compile? Given gocv is already shipped in the docker image I expected it tojust work
.Steps to Reproduce
I'm a Dockerfile to build the app and later run it as part of a web service. The docker file is pretty simple. Here is a bit more reduced:
FROM gocv/opencv:4.9.0-static as golang ... RUN go build -ldflags="-extldflags=-static" -o main
It throws a bunch of errors such below. log.txt
/usr/local/go/pkg/tool/linux_amd64/link: running g++ failed: exit status 1
/usr/bin/ld: /tmp/go-link-1938547386/000056.o: in function
mygetgrouplist': /usr/bin/ld: /usr/local/lib/libopencv_dnn.a(types.pb.cc.o): in function
_GLOBAL__sub_I.00102_types.pb.cc':types.pb.cc:(.text.startup._GLOBAL__sub_I.00102_types.pb.cc+0xf): undefined reference to
google::protobuf::internal::AddDescriptorsRunner::AddDescriptorsRunner(google::protobuf::internal::DescriptorTable const*)' /usr/bin/ld: $WORK/b001/exe/a.out: hidden symbol
opj_read_header' isn't defined/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
`
Your Environment
`
Google cloud run E2 standard 4 (4 vcpu, 16 gb ram)
* OpenCV version used:
Docker repo gocv/opencv:4.9.0-static
I've got it preinstalled using the docker repo : gocv/opencv:4.9.0-static
I use go modules with
gocv.io/x/gocv v0.36.1
, vendored as well.docker based gocv/opencv:4.9.0-static which I believe has Go go1.22.0
env.sh
orenv.cmd
script before trying togo run
orgo build
?Yes, it said
This script is no longer necessary and has been deprecated. See the Custom Environment section of the README if you need to customize your environment.
The text was updated successfully, but these errors were encountered: