But when I try to add OpenCV into the mix it seems to fail.
What I’m currently doing is:
Step 1: Do everything mentioned in blogpost above
Step 2: Go to Project > Properties > Build > Settings > NVCC Compiler > Includes
Then I add “$/usr/include/opencv” to the Include paths (-l)
Step 3: Go to Project > Properties > Build > Settings > NVCC Linker > Libraries
Then I add “$/usr/lib” to the Library search path (-L)
Step 4: Then I add opencv_imgproc , opencv_core , opencv_highgui to the Libraries (-l)
Step 5: I then copy over the library files from the TX2 as follows
$ sudo scp nvidia@IP_ADDRESS:/usr/lib/libopencv_core.so /usr/aarch64-linux-gnu/lib
$ sudo scp nvidia@IP_ADDRESS:/usr/lib/libopencv_highgui.so /usr/aarch64-linux-gnu/lib
$ sudo scp nvidia@IP_ADDRESS:/usr/lib/libopencv_imgproc.so /usr/aarch64-linux-gnu/lib
To test that it’s working in the boxFilter.cpp code mentioned in the example
I include the following headers #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/highgui/highgui.hpp>
and try to create a Matrix variable in the main function
cv::Mat img;
This is the error that I get, I can’t seem to figure out what I’m doing wrong. Has anyone tried this before?
16:14:00 **** Incremental Build of configuration Debug for project test-tx2 ****
make all
Building target: test-tx2
Invoking: NVCC Linker
/usr/local/cuda-8.0/bin/nvcc --cudart static -L"/usr/local/cuda-8.0/samples/common/lib/linux/aarch64" -L"usr/lib" -lGL -lGLU -lglut -Xlinker --unresolved-symbols=ignore-in-shared-libs --relocatable-device-code=false -gencode arch=compute_60,code=compute_60 -gencode arch=compute_60,code=sm_60 -m64 -ccbin aarch64-linux-gnu-g++ -link -o "test-tx2" ./src/boxFilter.o ./src/boxFilter_cpu.o ./src/boxFilter_kernel.o /usr/local/cuda-8.0/samples/common/lib/linux/x86_64/libGLEW.a -lopencv_imgproc -lopencv_core -lopencv_highgui
/usr/lib/gcc-cross/aarch64-linux-gnu/4.8/../../../../aarch64-linux-gnu/bin/ld: test-tx2: hidden symbol `cudaGetDeviceCount' in /usr/local/cuda-8.0/bin/../targets/aarch64-linux/lib/libcudart_static.a(libcudart_static.a.o) is referenced by DSO
/usr/lib/gcc-cross/aarch64-linux-gnu/4.8/../../../../aarch64-linux-gnu/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make: *** [test-tx2] Error 1
This is probably not the cause of your build error, but you are building for a CUDA 6.0 architecture.
Unless you deliberately want this, for TX2 you should use 6.2 (compute_62 and sm_62).
I’m using the latest JetPack 3.0 with opencv4tegra.
I followed the thread mentioned above and I still get an error while trying to use cv::imread, cv::imwrite, cv::putText etc…
I installed gcc version 5.4.1 using sudo apt-get install on my host machine and moved all the libopencv_*.so files to the host machine as instructed, but still no luck.
$ tar xf gcc-linaro-5.4.1-2017.01-x86_64_aarch64-linux-gnu.tar.xz
Move this folder to /usr/ such that it is at /usr/gcc-linaro-5.4.1-2017.01-x86_64_aarch64-linux-gnu
Add the binary file to the $PATH variable in ~/.bashrc
export PATH=/usr/gcc-linaro-5.4.1-2017.01-x86_64_aarch64-linux-gnu/bin:$PATH
I verified that it is the correct compiler by the following
$ aarch64-linux-gnu-g++ --version
aarch64-linux-gnu-g++ (Linaro GCC 5.4-2017.01) 5.4.1 20161213
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Launch nsight, create new CUDA/C++ Project from boxfilter-arm etc. etc.
Add the “Library search path(-L)” to point to linux/aarch64
Add a new -Xlinker option --unresolved-symbols=ignore-in-shared-libs
it says to select 6.2 and I agree with this, but Nsight Eclipse shipped with the JetPack 3.0 does not offer 6.2, the last option I can select from the project build settings is 6.0. How can I manually select sm 6.2? Thank you.