Comments (3)
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 -
from gocv.
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
from gocv.
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 🚀
from gocv.
Related Issues (20)
- make install BUILD_SHARED_LIBS=OFF fails on Ubuntu 22.04 HOT 1
- windows error: invalid cast from type 'pthread_t' {aka 'ptw32_handle_t'} to type 'void* HOT 1
- How does the gocv project run on someone else's computer HOT 3
- Unable to locate package libdc1394-22-dev on Ubuntu 24.04 LTS HOT 2
- building a static binary Lost Quirc HOT 11
- Cannot build docker image on mac M1 HOT 1
- Apple Silicon Backend/Target
- want the program to be less fragile HOT 1
- Support waitKeyEx HOT 3
- Missing Aruco with 4.10.0 and gocv 0.37 HOT 2
- rotatedrect enhance HOT 3
- memory leak
- gocv code memory leak HOT 15
- 请求一个yoloV8的使用案例,我已经折腾了很久,但是不知道解决方案,麻烦参考我代码,请求指引
- Error converting `*gocv.NativeByteBuffer` to `string` HOT 1
- can not run the demo HOT 1
- MatExpr (e.g. simply scaling Mat by scalar) HOT 2
- Cross-platform compilation failed
- Build failed with gocv v0.38.0 HOT 1
- I splash year videos
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gocv.