hybridgroup / gocv

Go package for computer vision using OpenCV 4 and beyond. Includes support for DNN, CUDA, OpenCV Contrib, and OpenVINO.
https://gocv.io
Other
6.75k stars 869 forks source link

Unable to complete install with CUDA (make install_cuda) #1173

Closed Guuri11 closed 6 months ago

Guuri11 commented 6 months ago

Description

I installed CUDA & cDNN following the guides, and then tried the make install_cuda from the root of gocv. But it fails, I can complete the make install and it shows this message:

gocv version: 0.36.1
opencv lib version: 4.9.0

but with make install_cuda happens this:

~/go/pkg/mod/gocv.io/x/gocv@v0.36.1 6m 15s cv ❯ make install_cuda                                                                                                                    19:29:51
sudo apt-get -y update
sudo apt-get -y install unzip wget build-essential cmake curl git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libdc1394-dev
Get:1 file:/var/cudnn-local-repo-ubuntu2204-8.9.7.29  InRelease [1.572 B]
Get:1 file:/var/cudnn-local-repo-ubuntu2204-8.9.7.29  InRelease [1.572 B]
Hit:2 https://download.docker.com/linux/ubuntu jammy InRelease                                                                                
Hit:3 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  InRelease                                                                                                  
Hit:4 http://es.archive.ubuntu.com/ubuntu jammy InRelease                                                                                                                   
Hit:5 http://security.ubuntu.com/ubuntu jammy-security InRelease                          
Hit:6 https://ppa.launchpadcontent.net/atareao/atareao/ubuntu jammy InRelease                           
Hit:7 https://dl.google.com/linux/chrome/deb stable InRelease                                           
Hit:8 https://ppa.launchpadcontent.net/graphics-drivers/ppa/ubuntu jammy InRelease
Hit:9 http://es.archive.ubuntu.com/ubuntu jammy-updates InRelease                 
Hit:10 https://ppa.launchpadcontent.net/neovim-ppa/stable/ubuntu jammy InRelease
Hit:11 https://apt.repos.intel.com/openvino/2023 ubuntu22 InRelease        
Hit:12 http://es.archive.ubuntu.com/ubuntu jammy-backports InRelease
Reading package lists... Done
W: https://apt.repos.intel.com/openvino/2023/dists/ubuntu22/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
build-essential is already the newest version (12.9ubuntu3).
libjpeg-dev is already the newest version (8c-2ubuntu10).
libpng-dev is already the newest version (1.6.37-3build5).
pkg-config is already the newest version (0.29.2-1ubuntu3).
wget is already the newest version (1.21.2-2ubuntu1).
libdc1394-dev is already the newest version (2.2.6-4).
libgtk2.0-dev is already the newest version (2.24.33-2ubuntu2).
libtbb-dev is already the newest version (2021.5.0-7ubuntu2).
libtbb2 is already the newest version (2020.3-1ubuntu3).
cmake is already the newest version (3.22.1-1ubuntu1.22.04.2).
curl is already the newest version (7.81.0-1ubuntu1.16).
git is already the newest version (1:2.34.1-1ubuntu1.10).
libtiff-dev is already the newest version (4.3.0-6ubuntu0.8).
unzip is already the newest version (6.0-26ubuntu3.2).
libavcodec-dev is already the newest version (7:4.4.2-0ubuntu0.22.04.1).
libavformat-dev is already the newest version (7:4.4.2-0ubuntu0.22.04.1).
libswscale-dev is already the newest version (7:4.4.2-0ubuntu0.22.04.1).
The following packages were automatically installed and are no longer required:
  dctrl-tools dkms gds-tools-12-4 libtinfo5 libxcb-xinerama0 libxcb-xinput0 nsight-compute-2024.1.1 nsight-systems-2023.4.4
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
rm -rf /tmp/opencv
mkdir /tmp/opencv
cd /tmp/opencv
curl -Lo opencv.zip https://github.com/opencv/opencv/archive/refs/tags/4.9.0.zip
unzip -q opencv.zip
curl -Lo opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/refs/tags/4.9.0.zip
unzip -q opencv_contrib.zip
rm opencv.zip opencv_contrib.zip
cd -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 92.9M  100 92.9M    0     0  19.2M      0  0:00:04  0:00:04 --:--:-- 23.3M
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 59.2M  100 59.2M    0     0  17.9M      0  0:00:03  0:00:03 --:--:-- 22.8M
/home/guuri11/go/pkg/mod/gocv.io/x/gocv@v0.36.1
sudo rm -rf /usr/local/lib/cmake/opencv4/
sudo rm -rf /usr/local/lib/libopencv*
sudo rm -rf /usr/local/lib/pkgconfig/opencv*
sudo rm -rf /usr/local/include/opencv*
cd /tmp/opencv/opencv-4.9.0
mkdir build
cd build
rm -rf *
cmake -j 15 -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_SHARED_LIBS=ON -D OPENCV_EXTRA_MODULES_PATH=/tmp/opencv/opencv_contrib-4.9.0/modules -D BUILD_DOCS=OFF -D BUILD_EXAMPLES=OFF -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=ON -D BUILD_opencv_java=NO -D BUILD_opencv_python=NO -D BUILD_opencv_python2=NO -D BUILD_opencv_python3=NO -D WITH_JASPER=OFF -D WITH_TBB=ON -DOPENCV_GENERATE_PKGCONFIG=ON -DWITH_CUDA=ON -DENABLE_FAST_MATH=1 -DCUDA_FAST_MATH=1 -DWITH_CUBLAS=1 -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda/ -DBUILD_opencv_cudacodec=OFF -D WITH_CUDNN=ON -D OPENCV_DNN_CUDA=ON -D CUDA_GENERATION=Auto ..
make -j 15
make preinstall
cd -
CMake Error: Unknown argument -j
CMake Error: Run 'cmake --help' for all supported options.
make[1]: Entering directory '/tmp/opencv/opencv-4.9.0/build'
make[1]: *** No targets specified and no makefile found.  Stop.
make[1]: Leaving directory '/tmp/opencv/opencv-4.9.0/build'
make[1]: Entering directory '/tmp/opencv/opencv-4.9.0/build'
make[1]: *** No rule to make target 'preinstall'.  Stop.
make[1]: Leaving directory '/tmp/opencv/opencv-4.9.0/build'
/tmp/opencv/opencv-4.9.0
cd /tmp/opencv/opencv-4.9.0/build
sudo make install
sudo ldconfig
cd -
make: *** No rule to make target 'install'.  Stop.
/home/guuri11/go/pkg/mod/gocv.io/x/gocv@v0.36.1
go clean --cache
rm -rf /tmp/opencv
go run ./cmd/version/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;
      |             ^~~~~
aruco.h:13:13: error: ‘aruco’ in namespace ‘cv’ does not name a type
   13 | typedef cv::aruco::DetectorParameters* ArucoDetectorParameters;
      |             ^~~~~
aruco.h:14:13: error: ‘aruco’ in namespace ‘cv’ does not name a type
   14 | typedef cv::aruco::ArucoDetector* ArucoDetector;
      |             ^~~~~
aruco.h:21:1: error: ‘ArucoDetectorParameters’ does not name a type
   21 | ArucoDetectorParameters ArucoDetectorParameters_Create();
      | ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:22:6: error: variable or field ‘ArucoDetectorParameters_SetAdaptiveThreshWinSizeMin’ declared void
   22 | void ArucoDetectorParameters_SetAdaptiveThreshWinSizeMin(ArucoDetectorParameters ap, int adaptiveThreshWinSizeMin);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.h:22:58: error: ‘ArucoDetectorParameters’ was not declared in this scope
   22 | void ArucoDetectorParameters_SetAdaptiveThreshWinSizeMin(ArucoDetectorParameters ap, int adaptiveThreshWinSizeMin);
      |                                                          ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:22:86: error: expected primary-expression before ‘int’
   22 | void ArucoDetectorParameters_SetAdaptiveThreshWinSizeMin(ArucoDetectorParameters ap, int adaptiveThreshWinSizeMin);
      |                                                                                      ^~~
aruco.h:23:57: error: ‘ArucoDetectorParameters’ was not declared in this scope
   23 | int ArucoDetectorParameters_GetAdaptiveThreshWinSizeMin(ArucoDetectorParameters ap);
      |                                                         ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:24:6: error: variable or field ‘ArucoDetectorParameters_SetAdaptiveThreshWinSizeMax’ declared void
   24 | void ArucoDetectorParameters_SetAdaptiveThreshWinSizeMax(ArucoDetectorParameters ap, int adaptiveThreshWinSizeMax);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.h:24:58: error: ‘ArucoDetectorParameters’ was not declared in this scope
   24 | void ArucoDetectorParameters_SetAdaptiveThreshWinSizeMax(ArucoDetectorParameters ap, int adaptiveThreshWinSizeMax);
      |                                                          ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:24:86: error: expected primary-expression before ‘int’
   24 | void ArucoDetectorParameters_SetAdaptiveThreshWinSizeMax(ArucoDetectorParameters ap, int adaptiveThreshWinSizeMax);
      |                                                                                      ^~~
aruco.h:25:57: error: ‘ArucoDetectorParameters’ was not declared in this scope
   25 | int ArucoDetectorParameters_GetAdaptiveThreshWinSizeMax(ArucoDetectorParameters ap);
      |                                                         ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:26:6: error: variable or field ‘ArucoDetectorParameters_SetAdaptiveThreshWinSizeStep’ declared void
   26 | void ArucoDetectorParameters_SetAdaptiveThreshWinSizeStep(ArucoDetectorParameters ap, int adaptiveThreshWinSizeStep);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.h:26:59: error: ‘ArucoDetectorParameters’ was not declared in this scope
   26 | void ArucoDetectorParameters_SetAdaptiveThreshWinSizeStep(ArucoDetectorParameters ap, int adaptiveThreshWinSizeStep);
      |                                                           ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:26:87: error: expected primary-expression before ‘int’
   26 | void ArucoDetectorParameters_SetAdaptiveThreshWinSizeStep(ArucoDetectorParameters ap, int adaptiveThreshWinSizeStep);
      |                                                                                       ^~~
aruco.h:27:58: error: ‘ArucoDetectorParameters’ was not declared in this scope
   27 | int ArucoDetectorParameters_GetAdaptiveThreshWinSizeStep(ArucoDetectorParameters ap);
      |                                                          ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:28:6: error: variable or field ‘ArucoDetectorParameters_SetAdaptiveThreshConstant’ declared void
   28 | void ArucoDetectorParameters_SetAdaptiveThreshConstant(ArucoDetectorParameters ap, double adaptiveThreshConstant);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.h:28:56: error: ‘ArucoDetectorParameters’ was not declared in this scope
   28 | void ArucoDetectorParameters_SetAdaptiveThreshConstant(ArucoDetectorParameters ap, double adaptiveThreshConstant);
      |                                                        ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:28:84: error: expected primary-expression before ‘double’
   28 | void ArucoDetectorParameters_SetAdaptiveThreshConstant(ArucoDetectorParameters ap, double adaptiveThreshConstant);
      |                                                                                    ^~~~~~
aruco.h:29:58: error: ‘ArucoDetectorParameters’ was not declared in this scope
   29 | double ArucoDetectorParameters_GetAdaptiveThreshConstant(ArucoDetectorParameters ap);
      |                                                          ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:30:6: error: variable or field ‘ArucoDetectorParameters_SetMinMarkerPerimeterRate’ declared void
   30 | void ArucoDetectorParameters_SetMinMarkerPerimeterRate(ArucoDetectorParameters ap, double minMarkerPerimeterRate);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.h:30:56: error: ‘ArucoDetectorParameters’ was not declared in this scope
   30 | void ArucoDetectorParameters_SetMinMarkerPerimeterRate(ArucoDetectorParameters ap, double minMarkerPerimeterRate);
      |                                                        ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:30:84: error: expected primary-expression before ‘double’
   30 | void ArucoDetectorParameters_SetMinMarkerPerimeterRate(ArucoDetectorParameters ap, double minMarkerPerimeterRate);
      |                                                                                    ^~~~~~
aruco.h:31:58: error: ‘ArucoDetectorParameters’ was not declared in this scope
   31 | double ArucoDetectorParameters_GetMinMarkerPerimeterRate(ArucoDetectorParameters ap);
      |                                                          ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:32:6: error: variable or field ‘ArucoDetectorParameters_SetMaxMarkerPerimeterRate’ declared void
   32 | void ArucoDetectorParameters_SetMaxMarkerPerimeterRate(ArucoDetectorParameters ap, double maxMarkerPerimeterRate);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.h:32:56: error: ‘ArucoDetectorParameters’ was not declared in this scope
   32 | void ArucoDetectorParameters_SetMaxMarkerPerimeterRate(ArucoDetectorParameters ap, double maxMarkerPerimeterRate);
      |                                                        ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:32:84: error: expected primary-expression before ‘double’
   32 | void ArucoDetectorParameters_SetMaxMarkerPerimeterRate(ArucoDetectorParameters ap, double maxMarkerPerimeterRate);
      |                                                                                    ^~~~~~
aruco.h:33:58: error: ‘ArucoDetectorParameters’ was not declared in this scope
   33 | double ArucoDetectorParameters_GetMaxMarkerPerimeterRate(ArucoDetectorParameters ap);
      |                                                          ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:34:6: error: variable or field ‘ArucoDetectorParameters_SetPolygonalApproxAccuracyRate’ declared void
   34 | void ArucoDetectorParameters_SetPolygonalApproxAccuracyRate(ArucoDetectorParameters ap, double polygonalApproxAccuracyRate);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.h:34:61: error: ‘ArucoDetectorParameters’ was not declared in this scope
   34 | void ArucoDetectorParameters_SetPolygonalApproxAccuracyRate(ArucoDetectorParameters ap, double polygonalApproxAccuracyRate);
      |                                                             ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:34:89: error: expected primary-expression before ‘double’
   34 | void ArucoDetectorParameters_SetPolygonalApproxAccuracyRate(ArucoDetectorParameters ap, double polygonalApproxAccuracyRate);
      |                                                                                         ^~~~~~
aruco.h:35:63: error: ‘ArucoDetectorParameters’ was not declared in this scope
   35 | double ArucoDetectorParameters_GetPolygonalApproxAccuracyRate(ArucoDetectorParameters ap);
      |                                                               ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:36:6: error: variable or field ‘ArucoDetectorParameters_SetMinCornerDistanceRate’ declared void
   36 | void ArucoDetectorParameters_SetMinCornerDistanceRate(ArucoDetectorParameters ap, double minCornerDistanceRate);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.h:36:55: error: ‘ArucoDetectorParameters’ was not declared in this scope
   36 | void ArucoDetectorParameters_SetMinCornerDistanceRate(ArucoDetectorParameters ap, double minCornerDistanceRate);
      |                                                       ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:36:83: error: expected primary-expression before ‘double’
   36 | void ArucoDetectorParameters_SetMinCornerDistanceRate(ArucoDetectorParameters ap, double minCornerDistanceRate);
      |                                                                                   ^~~~~~
aruco.h:37:57: error: ‘ArucoDetectorParameters’ was not declared in this scope
   37 | double ArucoDetectorParameters_GetMinCornerDistanceRate(ArucoDetectorParameters ap);
      |                                                         ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:51:49: error: ‘ArucoDetectorParameters’ was not declared in this scope
   51 | int ArucoDetectorParameters_GetMarkerBorderBits(ArucoDetectorParameters ap);
      |                                                 ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:52:6: error: variable or field ‘ArucoDetectorParameters_SetPerspectiveRemovePixelPerCell’ declared void
   52 | void ArucoDetectorParameters_SetPerspectiveRemovePixelPerCell(ArucoDetectorParameters ap, int perspectiveRemovePixelPerCell);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.h:52:63: error: ‘ArucoDetectorParameters’ was not declared in this scope
   52 | void ArucoDetectorParameters_SetPerspectiveRemovePixelPerCell(ArucoDetectorParameters ap, int perspectiveRemovePixelPerCell);
      |                                                               ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:52:91: error: expected primary-expression before ‘int’
   52 | void ArucoDetectorParameters_SetPerspectiveRemovePixelPerCell(ArucoDetectorParameters ap, int perspectiveRemovePixelPerCell);
      |                                                                                           ^~~
aruco.h:53:62: error: ‘ArucoDetectorParameters’ was not declared in this scope
   53 | int ArucoDetectorParameters_GetPerspectiveRemovePixelPerCell(ArucoDetectorParameters ap);
      |                                                              ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:54:6: error: variable or field ‘ArucoDetectorParameters_SetPerspectiveRemoveIgnoredMarginPerCell’ declared void
   54 | void ArucoDetectorParameters_SetPerspectiveRemoveIgnoredMarginPerCell(ArucoDetectorParameters ap, double perspectiveRemoveIgnoredMarginPerCell);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.h:54:71: error: ‘ArucoDetectorParameters’ was not declared in this scope
   54 | void ArucoDetectorParameters_SetPerspectiveRemoveIgnoredMarginPerCell(ArucoDetectorParameters ap, double perspectiveRemoveIgnoredMarginPerCell);
      |                                                                       ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:54:99: error: expected primary-expression before ‘double’
   54 | void ArucoDetectorParameters_SetPerspectiveRemoveIgnoredMarginPerCell(ArucoDetectorParameters ap, double perspectiveRemoveIgnoredMarginPerCell);
      |                                                                                                   ^~~~~~
In file included from aruco.cpp:1:
aruco.h:55:73: error: ‘ArucoDetectorParameters’ was not declared in this scope
   55 | double ArucoDetectorParameters_GetPerspectiveRemoveIgnoredMarginPerCell(ArucoDetectorParameters ap);
      |                                                                         ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:56:6: error: variable or field ‘ArucoDetectorParameters_SetMaxErroneousBitsInBorderRate’ declared void
   56 | void ArucoDetectorParameters_SetMaxErroneousBitsInBorderRate(ArucoDetectorParameters ap, double maxErroneousBitsInBorderRate);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.h:56:62: error: ‘ArucoDetectorParameters’ was not declared in this scope
   56 | void ArucoDetectorParameters_SetMaxErroneousBitsInBorderRate(ArucoDetectorParameters ap, double maxErroneousBitsInBorderRate);
      |                                                              ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:56:90: error: expected primary-expression before ‘double’
   56 | void ArucoDetectorParameters_SetMaxErroneousBitsInBorderRate(ArucoDetectorParameters ap, double maxErroneousBitsInBorderRate);
      |                                                                                          ^~~~~~
aruco.h:57:64: error: ‘ArucoDetectorParameters’ was not declared in this scope
   57 | double ArucoDetectorParameters_GetMaxErroneousBitsInBorderRate(ArucoDetectorParameters ap);
      |                                                                ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:58:6: error: variable or field ‘ArucoDetectorParameters_SetMinOtsuStdDev’ declared void
   58 | void ArucoDetectorParameters_SetMinOtsuStdDev(ArucoDetectorParameters ap, double minOtsuStdDev);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.h:58:47: error: ‘ArucoDetectorParameters’ was not declared in this scope
   58 | void ArucoDetectorParameters_SetMinOtsuStdDev(ArucoDetectorParameters ap, double minOtsuStdDev);
      |                                               ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:58:75: error: expected primary-expression before ‘double’
   58 | void ArucoDetectorParameters_SetMinOtsuStdDev(ArucoDetectorParameters ap, double minOtsuStdDev);
      |                                                                           ^~~~~~
aruco.h:59:49: error: ‘ArucoDetectorParameters’ was not declared in this scope
   59 | double ArucoDetectorParameters_GetMinOtsuStdDev(ArucoDetectorParameters ap);
      |                                                 ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:60:6: error: variable or field ‘ArucoDetectorParameters_SetErrorCorrectionRate’ declared void
   60 | void ArucoDetectorParameters_SetErrorCorrectionRate(ArucoDetectorParameters ap, double errorCorrectionRate);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.h:60:53: error: ‘ArucoDetectorParameters’ was not declared in this scope
   60 | void ArucoDetectorParameters_SetErrorCorrectionRate(ArucoDetectorParameters ap, double errorCorrectionRate);
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:60:81: error: expected primary-expression before ‘double’~~~~~
aruco.h:74:59: error: ‘ArucoDetectorParameters’ was not declared in this scope
   74 | void ArucoDetectorParameters_SetAprilTagMinWhiteBlackDiff(ArucoDetectorParameters ap, int aprilTagMinWhiteBlackDiff);
      |                                                           ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:74:87: error: expected primary-expression before ‘int’
   74 | void ArucoDetectorParameters_SetAprilTagMinWhiteBlackDiff(ArucoDetectorParameters ap, int aprilTagMinWhiteBlackDiff);
      |                                                                                       ^~~
aruco.h:75:58: error: ‘ArucoDetectorParameters’ was not declared in this scope
   75 | int ArucoDetectorParameters_GetAprilTagMinWhiteBlackDiff(ArucoDetectorParameters ap);
      |                                                          ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:76:6: error: variable or field ‘ArucoDetectorParameters_SetAprilTagDeglitch’ declared void
   76 | void ArucoDetectorParameters_SetAprilTagDeglitch(ArucoDetectorParameters ap, int aprilTagDeglitch);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.h:76:50: error: ‘ArucoDetectorParameters’ was not declared in this scope
   76 | void ArucoDetectorParameters_SetAprilTagDeglitch(ArucoDetectorParameters ap, int aprilTagDeglitch);
      |                                                  ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:76:78: error: expected primary-expression before ‘int’
   76 | void ArucoDetectorParameters_SetAprilTagDeglitch(ArucoDetectorParameters ap, int aprilTagDeglitch);
      |                                                                              ^~~
aruco.h:77:49: error: ‘ArucoDetectorParameters’ was not declared in this scope
   77 | int ArucoDetectorParameters_GetAprilTagDeglitch(ArucoDetectorParameters ap);
      |                                                 ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:78:6: error: variable or field ‘ArucoDetectorParameters_SetDetectInvertedMarker’ declared void
   78 | void ArucoDetectorParameters_SetDetectInvertedMarker(ArucoDetectorParameters ap, bool detectInvertedMarker);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.h:78:54: error: ‘ArucoDetectorParameters’ was not declared in this scope
   78 | void ArucoDetectorParameters_SetDetectInvertedMarker(ArucoDetectorParameters ap, bool detectInvertedMarker);
      |                                                      ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:78:82: error: expected primary-expression before ‘bool’
   78 | void ArucoDetectorParameters_SetDetectInvertedMarker(ArucoDetectorParameters ap, bool detectInvertedMarker);
      |                                                                                  ^~~~
aruco.h:79:54: error: ‘ArucoDetectorParameters’ was not declared in this scope
   79 | bool ArucoDetectorParameters_GetDetectInvertedMarker(ArucoDetectorParameters ap);
      |                                                      ^~~~~~~~~~~~~~~~~~~~~~~
aruco.h:82:1: error: ‘ArucoDictionary’ does not name a type
   82 | ArucoDictionary getPredefinedDictionary(int dictionaryId);
      | ^~~~~~~~~~~~~~~
aruco.h:84:1: error: ‘ArucoDetector’ does not name a type
   84 | ArucoDetector ArucoDetector_New();
      | ^~~~~~~~~~~~~
aruco.h:85:1: error: ‘ArucoDetector’ does not name a type
   85 | ArucoDetector ArucoDetector_NewWithParams(ArucoDictionary dictionary, ArucoDetectorParameters params);
      | ^~~~~~~~~~~~~
aruco.h:86:6: error: variable or field ‘ArucoDetector_Close’ declared void
   86 | void ArucoDetector_Close(ArucoDetector ad);
      |      ^~~~~~~~~~~~~~~~~~~
aruco.h:86:26: error: ‘ArucoDetector’ was not declared in this scope
   86 | void ArucoDetector_Close(ArucoDetector ad);
      |                          ^~~~~~~~~~~~~
aruco.h:87:6: error: variable or field ‘ArucoDetector_DetectMarkers’ declared void
   87 | void ArucoDetector_DetectMarkers(ArucoDetector ad, Mat inputArr, Points2fVector markerCorners, IntVector *markerIds, Points2fVector rejectedCandidates);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.h:87:34: error: ‘ArucoDetector’ was not declared in this scope
   87 | void ArucoDetector_DetectMarkers(ArucoDetector ad, Mat inputArr, Points2fVector markerCorners, IntVector *markerIds, Points2fVector rejectedCandidates);
      |                                  ^~~~~~~~~~~~~
aruco.h:87:56: error: expected primary-expression before ‘inputArr’
   87 | void ArucoDetector_DetectMarkers(ArucoDetector ad, Mat inputArr, Points2fVector markerCorners, IntVector *markerIds, Points2fVector rejectedCandidates);
      |                                                        ^~~~~~~~
aruco.h:87:81: error: expected primary-expression before ‘markerCorners’
   87 | void ArucoDetector_DetectMarkers(ArucoDetector ad, Mat inputArr, Points2fVector markerCorners, IntVector *markerIds, Points2fVector rejectedCandidates);
      |                                                                                 ^~~~~~~~~~~~~
aruco.h:87:106: error: expected primary-expression before ‘*’ token
   87 | void ArucoDetector_DetectMarkers(ArucoDetector ad, Mat inputArr, Points2fVector markerCorners, IntVector *markerIds, Points2fVector rejectedCandidates);
      |                                                                                                          ^
aruco.h:87:107: error: ‘markerIds’ was not declared in this scope
   87 | void ArucoDetector_DetectMarkers(ArucoDetector ad, Mat inputArr, Points2fVector markerCorners, IntVector *markerIds, Points2fVector rejectedCandidates);
      |                                                                                                           ^~~~~~~~~
aruco.h:87:133: error: expected primary-expression before ‘rejectedCandidates’
   87 | void ArucoDetector_DetectMarkers(ArucoDetector ad, Mat inputArr, Points2fVector markerCorners, IntVector *markerIds, Points2fVector rejectedCandidates);
      |                                                                                                                                     ^~~~~~~~~~~~~~~~~~
aruco.cpp:3:1: error: ‘ArucoDetector’ does not name a type
    3 | ArucoDetector ArucoDetector_New() {
      | ^~~~~~~~~~~~~
aruco.cpp:7:1: error: ‘ArucoDetector’ does not name a type
    7 | ArucoDetector ArucoDetector_NewWithParams(ArucoDictionary dictionary, ArucoDetectorParameters params) {
      | ^~~~~~~~~~~~~
aruco.cpp:11:6: error: variable or field ‘ArucoDetector_Close’ declared void
   11 | void ArucoDetector_Close(ArucoDetector ad) {
      |      ^~~~~~~~~~~~~~~~~~~
aruco.cpp:11:26: error: ‘ArucoDetector’ was not declared in this scope
   11 | void ArucoDetector_Close(ArucoDetector ad) {
      |                          ^~~~~~~~~~~~~
aruco.cpp:15:6: error: variable or field ‘ArucoDetector_DetectMarkers’ declared void
   15 | void ArucoDetector_DetectMarkers(ArucoDetector ad, Mat inputArr, Points2fVector markerCorners, IntVector *markerIds, Points2fVector rejectedCandidates) {
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:15:34: error: ‘ArucoDetector’ was not declared in this scope
   15 | void ArucoDetector_DetectMarkers(ArucoDetector ad, Mat inputArr, Points2fVector markerCorners, IntVector *markerIds, Points2fVector rejectedCandidates) {
      |                                  ^~~~~~~~~~~~~
aruco.cpp:15:56: error: expected primary-expression before ‘inputArr’
   15 | void ArucoDetector_DetectMarkers(ArucoDetector ad, Mat inputArr, Points2fVector markerCorners, IntVector *markerIds, Points2fVector rejectedCandidates) {
      |                                                        ^~~~~~~~
aruco.cpp:15:81: error: expected primary-expression before ‘markerCorners’
   15 | void ArucoDetector_DetectMarkers(ArucoDetector ad, Mat inputArr, Points2fVector markerCorners, IntVector *markerIds, Points2fVector rejectedCandidates) {
      |                                                                                 ^~~~~~~~~~~~~
aruco.cpp:15:106: error: expected primary-expression before ‘*’ token
   15 | void ArucoDetector_DetectMarkers(ArucoDetector ad, Mat inputArr, Points2fVector markerCorners, IntVector *markerIds, Points2fVector rejectedCandidates) {
      |                                                                                                          ^
aruco.cpp:15:107: error: ‘markerIds’ was not declared in this scope
   15 | void ArucoDetector_DetectMarkers(ArucoDetector ad, Mat inputArr, Points2fVector markerCorners, IntVector *markerIds, Points2fVector rejectedCandidates) {
      |                                                                                                           ^~~~~~~~~
aruco.cpp:15:133: error: expected primary-expression before ‘rejectedCandidates’
   15 | void ArucoDetector_DetectMarkers(ArucoDetector ad, Mat inputArr, Points2fVector markerCorners, IntVector *markerIds, Points2fVector rejectedCandidates) {
      |                                                                                                                                     ^~~~~~~~~~~~~~~~~~
aruco.cpp:30:1: error: ‘ArucoDetectorParameters’ does not name a type
   30 | ArucoDetectorParameters ArucoDetectorParameters_Create()
      | ^~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:35:6: error: variable or field ‘ArucoDetectorParameters_SetAdaptiveThreshWinSizeMin’ declared void
   35 | void ArucoDetectorParameters_SetAdaptiveThreshWinSizeMin(ArucoDetectorParameters ap, int adaptiveThreshWinSizeMin) {
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:35:58: error: ‘ArucoDetectorParameters’ was not declared in this scope
   35 | void ArucoDetectorParameters_SetAdaptiveThreshWinSizeMin(ArucoDetectorParameters ap, int adaptiveThreshWinSizeMin) {
      |                                                          ^~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:35:86: error: expected primary-expression before ‘int’
   35 | void ArucoDetectorParameters_SetAdaptiveThreshWinSizeMin(ArucoDetectorParameters ap, int adaptiveThreshWinSizeMin) {
      |                                                                                      ^~~
aruco.cpp:39:5: error: redefinition of ‘int ArucoDetectorParameters_GetAdaptiveThreshWinSizeMin’
   39 | int ArucoDetectorParameters_GetAdaptiveThreshWinSizeMin(ArucoDetectorParameters ap) {
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from aruco.cpp:1:
aruco.h:23:5: note: ‘int ArucoDetectorParameters_GetAdaptiveThreshWinSizeMin’ previously defined here
   23 | int ArucoDetectorParameters_GetAdaptiveThreshWinSizeMin(ArucoDetectorParameters ap);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:39:57: error: ‘ArucoDetectorParameters’ was not declared in this scope
   39 | int ArucoDetectorParameters_GetAdaptiveThreshWinSizeMin(ArucoDetectorParameters ap) {
      |                                                         ^~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:43:6: error: variable or field ‘ArucoDetectorParameters_SetAdaptiveThreshWinSizeMax’ declared void
   43 | void ArucoDetectorParameters_SetAdaptiveThreshWinSizeMax(ArucoDetectorParameters ap, int adaptiveThreshWinSizeMax) {
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:43:58: error: ‘ArucoDetectorParameters’ was not declared in this scope
   43 | void ArucoDetectorParameters_SetAdaptiveThreshWinSizeMax(ArucoDetectorParameters ap, int adaptiveThreshWinSizeMax) {
      |                                                          ^~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:43:86: error: expected primary-expression before ‘int’
   43 | void ArucoDetectorParameters_SetAdaptiveThreshWinSizeMax(ArucoDetectorParameters ap, int adaptiveThreshWinSizeMax) {
      |                                                                                      ^~~
aruco.cpp:47:5: error: redefinition of ‘int ArucoDetectorParameters_GetAdaptiveThreshWinSizeMax’
   47 | int ArucoDetectorParameters_GetAdaptiveThreshWinSizeMax(ArucoDetectorParameters ap) {
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from aruco.cpp:1:
aruco.h:25:5: note: ‘int ArucoDetectorParameters_GetAdaptiveThreshWinSizeMax’ previously defined here
   25 | int ArucoDetectorParameters_GetAdaptiveThreshWinSizeMax(ArucoDetectorParameters ap);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:47:57: error: ‘ArucoDetectorParameters’ was not declared in this scope
   47 | int ArucoDetectorParameters_GetAdaptiveThreshWinSizeMax(ArucoDetectorParameters ap) {
      |                                                         ^~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:51:6: error: variable or field ‘ArucoDetectorParameters_SetAdaptiveThreshWinSizeStep’ declared void
   51 | void ArucoDetectorParameters_SetAdaptiveThreshWinSizeStep(ArucoDetectorParameters ap, int adaptiveThreshWinSizeStep) {
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:51:59: error: ‘ArucoDetectorParameters’ was not declared in this scope
   51 | void ArucoDetectorParameters_SetAdaptiveThreshWinSizeStep(ArucoDetectorParameters ap, int adaptiveThreshWinSizeStep) {
      |                                                           ^~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:51:87: error: expected primary-expression before ‘int’
   51 | void ArucoDetectorParameters_SetAdaptiveThreshWinSizeStep(ArucoDetectorParameters ap, int adaptiveThreshWinSizeStep) {
      |                                                                                       ^~~
aruco.cpp:55:5: error: redefinition of ‘int ArucoDetectorParameters_GetAdaptiveThreshWinSizeStep’
   55 | int ArucoDetectorParameters_GetAdaptiveThreshWinSizeStep(ArucoDetectorParameters ap) {
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from aruco.cpp:1:
aruco.h:27:5: note: ‘int ArucoDetectorParameters_GetAdaptiveThreshWinSizeStep’ previously defined here
   27 | int ArucoDetectorParameters_GetAdaptiveThreshWinSizeStep(ArucoDetectorParameters ap);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:55:58: error: ‘ArucoDetectorParameters’ was not declared in this scope
   55 | int ArucoDetectorParameters_GetAdaptiveThreshWinSizeStep(ArucoDetectorParameters ap) {
      |                                                          ^~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:59:6: error: variable or field ‘ArucoDetectorParameters_SetAdaptiveThreshConstant’ declared void
   59 | void ArucoDetectorParameters_SetAdaptiveThreshConstant(ArucoDetectorParameters ap, double adaptiveThreshConstant) {
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:59:56: error: ‘ArucoDetectorParameters’ was not declared in this scope
   59 | void ArucoDetectorParameters_SetAdaptiveThreshConstant(ArucoDetectorParameters ap, double adaptiveThreshConstant) {
      |                                                        ^~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:59:84: error: expected primary-expression before ‘double’
   59 | void ArucoDetectorParameters_SetAdaptiveThreshConstant(ArucoDetectorParameters ap, double adaptiveThreshConstant) {
      |                                                                                    ^~~~~~
aruco.cpp:63:8: error: redefinition of ‘double ArucoDetectorParameters_GetAdaptiveThreshConstant’
   63 | double ArucoDetectorParameters_GetAdaptiveThreshConstant(ArucoDetectorParameters ap) {
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from aruco.cpp:1:
aruco.h:29:8: note: ‘double ArucoDetectorParameters_GetAdaptiveThreshConstant’ previously defined here
   29 | double ArucoDetectorParameters_GetAdaptiveThreshConstant(ArucoDetectorParameters ap);
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:63:58: error: ‘ArucoDetectorParameters’ was not declared in this scope
   63 | double ArucoDetectorParameters_GetAdaptiveThreshConstant(ArucoDetectorParameters ap) {
      |                                                          ^~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:67:6: error: variable or field ‘ArucoDetectorParameters_SetMinMarkerPerimeterRate’ declared void
   67 | void ArucoDetectorParameters_SetMinMarkerPerimeterRate(ArucoDetectorParameters ap, double minMarkerPerimeterRate) {
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:67:56: error: ‘ArucoDetectorParameters’ was not declared in this scope
   67 | void ArucoDetectorParameters_SetMinMarkerPerimeterRate(ArucoDetectorParameters ap, double minMarkerPerimeterRate) {
      |                                                        ^~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:67:84: error: expected primary-expression before ‘double’
   67 | void ArucoDetectorParameters_SetMinMarkerPerimeterRate(ArucoDetectorParameters ap, double minMarkerPerimeterRate) {
      |                                                                                    ^~~~~~
aruco.cpp:71:8: error: redefinition of ‘double ArucoDetectorParameters_GetMinMarkerPerimeterRate’
   71 | double ArucoDetectorParameters_GetMinMarkerPerimeterRate(ArucoDetectorParameters ap){
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from aruco.cpp:1:
aruco.h:31:8: note: ‘double ArucoDetectorParameters_GetMinMarkerPerimeterRate’ previously defined here
   31 | double ArucoDetectorParameters_GetMinMarkerPerimeterRate(ArucoDetectorParameters ap);
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:71:58: error: ‘ArucoDetectorParameters’ was not declared in this scope
   71 | double ArucoDetectorParameters_GetMinMarkerPerimeterRate(ArucoDetectorParameters ap){
      |                                                          ^~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:75:6: error: variable or field ‘ArucoDetectorParameters_SetMaxMarkerPerimeterRate’ declared void
   75 | void ArucoDetectorParameters_SetMaxMarkerPerimeterRate(ArucoDetectorParameters ap, double maxMarkerPerimeterRate) {
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:75:56: error: ‘ArucoDetectorParameters’ was not declared in this scope
   75 | void ArucoDetectorParameters_SetMaxMarkerPerimeterRate(ArucoDetectorParameters ap, double maxMarkerPerimeterRate) {
      |                                                        ^~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:75:84: error: expected primary-expression before ‘double’
   75 | void ArucoDetectorParameters_SetMaxMarkerPerimeterRate(ArucoDetectorParameters ap, double maxMarkerPerimeterRate) {
      |                                                                                    ^~~~~~
aruco.cpp:79:8: error: redefinition of ‘double ArucoDetectorParameters_GetMaxMarkerPerimeterRate’
   79 | double ArucoDetectorParameters_GetMaxMarkerPerimeterRate(ArucoDetectorParameters ap){
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from aruco.cpp:1:
aruco.h:33:8: note: ‘double ArucoDetectorParameters_GetMaxMarkerPerimeterRate’ previously defined here
   33 | double ArucoDetectorParameters_GetMaxMarkerPerimeterRate(ArucoDetectorParameters ap);
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:79:58: error: ‘ArucoDetectorParameters’ was not declared in this scope
   79 | double ArucoDetectorParameters_GetMaxMarkerPerimeterRate(ArucoDetectorParameters ap){
      |                                                          ^~~~~~~~~~~~~~~~~~~~~~~
aruco.cpp:83:6: error: variable or field ‘ArucoDetectorParameters_SetPolygonalApproxAccuracyRate’ declared void
   83 | void ArucoDetectorParameters_SetPolygonalApproxAccuracyRate(ArucoDetectorParameters ap, double polygonalApproxAccuracyRate) {
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~
.......
aruco.cpp: At global scope:
aruco.cpp:284:1: error: ‘ArucoDictionary’ does not name a type
  284 | ArucoDictionary getPredefinedDictionary(int dictionaryId)
      | ^~~~~~~~~~~~~~~
make: *** [Makefile:315: verify] Error 1

Steps to Reproduce

  1. Install CUDA 12
  2. go to gocv folder
  3. run make install_cuda

Your Environment

Guuri11 commented 6 months ago

Bug: Unknown argument -j error when building OpenCV with CUDA using make install_cuda

Description: I encountered an issue while trying to install GoCV with CUDA support by running sudo make install_cuda. During the build process, the command fails with the following error message:

CMake Error: Unknown argument -j
CMake Error: Run 'cmake --help' for all supported options.
make[1]: *** No targets specified and no makefile found.  Stop.
...
make: *** No rule to make target 'install'.  Stop.

After inspecting the Makefile, I observed that the cmake command within the build_cuda target incorrectly uses the -j argument, which is not a valid option for cmake.

Here is the relevant excerpt from the Makefile:

build_cuda:
    cd $(TMP_DIR)opencv/opencv-$(OPENCV_VERSION)
    mkdir build
    cd build
    rm -rf *
    cmake -j $(shell nproc --all --ignore 1) -D CMAKE_BUILD_TYPE=RELEASE ...
    $(MAKE) -j $(shell nproc --all --ignore 1)
    $(MAKE) preinstall
    cd -

Proposed Fix: The -j $(shell nproc --all --ignore 1) should be removed from the cmake command. The correct way to handle parallel builds is to use the -j option with make (which is already done correctly in the Makefile).

Here is the corrected version of the build_cuda target:

build_cuda:
    cd $(TMP_DIR)opencv/opencv-$(OPENCV_VERSION)
    mkdir build
    cd build
    rm -rf *
    cmake -D CMAKE_BUILD_TYPE=RELEASE \
        -D CMAKE_INSTALL_PREFIX=/usr/local \
        -D BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} \
        -D OPENCV_EXTRA_MODULES_PATH=$(TMP_DIR)opencv/opencv_contrib-$(OPENCV_VERSION)/modules \
        -D BUILD_DOCS=OFF \
        -D BUILD_EXAMPLES=OFF \
        -D BUILD_TESTS=OFF \
        -D BUILD_PERF_TESTS=ON \
        -D BUILD_opencv_java=NO \
        -D BUILD_opencv_python=NO \
        -D BUILD_opencv_python2=NO \
        -D BUILD_opencv_python3=NO \
        -D WITH_JASPER=OFF \
        -D WITH_TBB=ON \
        -DOPENCV_GENERATE_PKGCONFIG=ON \
        -DWITH_CUDA=ON \
        -DENABLE_FAST_MATH=1 \
        -DCUDA_FAST_MATH=1 \
        -DWITH_CUBLAS=1 \
        -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda/ \
        -DBUILD_opencv_cudacodec=OFF \
        -D WITH_CUDNN=ON \
        -D OPENCV_DNN_CUDA=ON \
        -D CUDA_ARCH_BIN=7.5 \
        -D CUDA_GENERATION=Auto ..
    $(MAKE) -j $(shell nproc --all --ignore 1)
    $(MAKE) preinstall
    cd -
Guuri11 commented 6 months ago

So, I has two issues here, the first one was that the -j $(shell nproc --all --ignore 1) should be removed from the cmake command in the build_cuda step.

the second one, was that I had my cuda directory at /usr/local/cuda-12/, and the Makefile is pointing to /usr/local/cuda/. So I just changed the route and it compiled successfully

Guuri11 commented 6 months ago

just checked the DNN Pose Detection example setting CUDA as default backend, it works way better now comparing to the CPU, so I'm going to close the issue myself as it is finally solved 🚀