Hello,
I have a problem with cross compilation on Linux with this Jetpack 2.3.1. The problem appears during linkage with Opencv Libraries with simple functions like putText.
Generally, for building with cross compiler, I copy all required shared objects libopencv_.so from board to the Linux host and provide the path to the directory, contents those files.
I prepared on host two directories:
-
Opencv8 With libopencv_*.so*, copied from board with latest version of Jetpack
-
Opencv7 With libopencv_*.so*, copied from board with previous version of Jetpack (L4T 24.1 Jetpack 2.2.1)
When I set the libraries path for linker to /usr/aarch64-linux-gnu/lib/Opencv8, I receive linker error “undefined reference to cv::putText”
When I set the libraries path for linker to /usr/aarch64-linux-gnu/lib/Opencv7, the linker works Ok.
The linker command is:
[b]Building target: Test
Invoking: NVCC Linker
/usr/local/cuda-8.0/bin/nvcc --cudart shared -L/usr/aarch64-linux-gnu/lib/Opencv8 -
Xlinker --unresolved-symbols=ignore-in-object-files -Xlinker --unresolved-
symbols=ignore-in-shared-libs --relocatable-device-code=false -gencode arch=
compute_52,code=compute_52 -gencode arch=compute_52,code=sm_52 -m64 -ccbin
aarch64-linux-gnu-g++ -link -o “Test” ./src/Test.o -lopencv_core
./src/Test.o: In function main': /media/sf_GPUShared/Test/Debug/../src/Test.cpp:24: undefined reference to
cv
::putText(cv::Mat&, std::string const&, cv::Point_, int, double, cv::
Scalar_, int, int, bool)’
collect2: error: ld returned 1 exit status
make: *** [Test] Error 1
[/b]
This is a code:
#include "stdio.h"
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
using namespace std;
using namespace cv;
int main(void)
{
puts("Start");
cv::Size size = cv::Size(1000,800);
cv::Mat img = cv::Mat::zeros(size, CV_8UC3);
// Add text
putText(img, "HELLO", Point(10, 80), CV_FONT_HERSHEY_COMPLEX_SMALL, 4, Scalar(80, 255, 80), 8, 4);
puts("Stop");
return 1;
}