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

Missing Aruco with 4.10.0 and gocv 0.37 #1187

Open
arkjxu opened this issue Jul 27, 2024 · 2 comments
Open

Missing Aruco with 4.10.0 and gocv 0.37 #1187

arkjxu opened this issue Jul 27, 2024 · 2 comments

Comments

@arkjxu
Copy link

arkjxu commented Jul 27, 2024

Would appreciate some help if anyone knows whats going on, thank ya'll very much!

Simple script:

package main

import (
	"fmt"

	"gocv.io/x/gocv"
)

func main() {
	frame := gocv.IMRead("frame.png", gocv.IMReadGrayScale)
	fmt.Println(frame.Cols())
}

Running the following command:

go build -ldflags="-extldflags=-static" -o test main.go

# gocv.io/x/gocv
In file included from aruco.cpp:1:
aruco.h:12:13: error: 'aruco' in namespace 'cv' does not name a type
   12 | typedef cv::aruco::Dictionary* ArucoDictionary;

Now If I provide -tags customEnv, it would generate the following error:

go build -tags customenv -ldflags="-extldflags=-static" -o test main.go

aruco.h:5:10: fatal error: opencv2/opencv.hpp: No such file or directory
    5 | #include <opencv2/opencv.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~

Setting CGO_CPPFLAGS="-I/usr/local/include/opencv4" would trigger the first error again regarding aruco errors.

FYI

I also ran the same code using the prebuilt docker image for gocv/opencv:4.9.0 and the latest gocv/opencv:4.10.0, both static and non-static versions of the image. None of them run.

Also tried to downgrade gocv to 0.36 and opencv 4.9.0, no luck, same issue.

Your Environment

Statically build opencv 4.10.0

RUN cmake -D CMAKE_BUILD_TYPE=Release \
        -D CMAKE_INSTALL_PREFIX=/usr/local \
        -D BUILD_SHARED_LIBS=OFF \
        -D OPENCV_GENERATE_PKGCONFIG=YES \
        -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
        -D BUILD_LIST=core,imgproc,imgcodecs \
        -D BUILD_EXAMPLES=OFF \
        -D BUILD_TESTS=OFF \
        -D BUILD_DOCS=OFF \
        -D BUILD_PERF_TESTS=OFF \
        -D BUILD_opencv_ts=OFF \
        -D WITH_CUDA=OFF \
        -D WITH_CUBLAS=OFF \
        -D WITH_NVCUVID=OFF \
        -D WITH_OPENCL=OFF \
        -D WITH_OPENCL_SVM=OFF \
        -D WITH_OPENCLAMDFFT=OFF \
        -D WITH_OPENCLAMDBLAS=OFF \
        -D WITH_VA=OFF \
        -D WITH_VA_INTEL=OFF \
        -D WITH_OPENGL=OFF \
        -D WITH_PNG=ON \
        -D WITH_ZLIB=ON \
        .. && \
    make -j $(nproc --all --ignore 1) && \
    make install && \
    ldconfig

ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
ENV CGO_CFLAGS="-I/usr/local/include/opencv4"
ENV CGO_LDFLAGS="-L/usr/local/lib -lopencv_core -lopencv_imgproc -lopencv_imgcodecs"
ENV CGO_ENABLED="1"
  • System Arch: arm64
  • Operating System and version: M2 Sonoma 14.5 with Docker - debian:bookworm-slim
  • OpenCV version used: 4.10.0 (latest)
  • How did you install OpenCV?
    • wget -qO- https://github.com/opencv/opencv/archive/refs/tags/4.10.0.tar.gz | tar xz
    • wget -qO- https://github.com/opencv/opencv_contrib/archive/refs/tags/4.10.0.tar.gz | tar xz
  • GoCV version used: 0.37 (latest)
  • Go version: 1.22.4 (latest)
@arkjxu
Copy link
Author

arkjxu commented Jul 28, 2024

4.8.0 and 4.8.1 works for docker. looks like anything above 4.9.0 breaks. especially the static images.

@kevinjwx
Copy link

Please note that I am disabling everything except for the most basic imgproc and core and imgcodec. but looks like it's still trying to include aruco, i even tried to add the build flag for aruco.go and aruco_dictionary.go, no luck, maybe I miss something. Unless I have to include the aruco/dnn features?

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

2 participants