Cross compile program, using OpenCV with Jetpack 2.3.1

YES. Since there is some issue in cross-compiler when linking to opencv_core. Build on device can skip the error.
We are clarifying this issue, will update to you once we can provide further suggestion.

Thanks and sorry for the inconvenience.

Hi,

Thanks for your patience.

First, this is not an NVCC compiler issue. Same issue can be reproduced with the host compiler without nvcc.

$ nm topic_1002061.o | grep putText
U ZN2cv7putTextERNS_3MatERKSsNS_6Point_IiEEidNS_7Scalar_IdEEiib
This name can be decoded to cv::putText(cv::Mat&, std::basic_string<char, std::char_traits, std::allocator > const&, cv::Point
, int, double, cv::Scalar_, int, int, bool)

$ nm -D libopencv_core.so | grep putText
0000000000087d60 T ZN2cv7putTextERNS_3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_6Point_IiEEidNS_7Scalar_IdEEiib
This name can be decoded to cv::putText(cv::Mat&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, cv::Point
, int, double, cv::Scalar_, int, int, bool)

There is a difference in the argument type between the two signatures for cv::putText.
Since that libopencv_core has been compiled with the new ABI, is used by default with GCC >= 5 but topic_1002061.o has been compiled with the old ABI.

This ABI incompatibility is the root cause of this issue.
Please read more information on the ABI change here:
https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html

We are trying to find an alternative solution to handle this. Will update to you later.
Thanks.

Hi,
I migrated back to the previous version till you will find the solution. May be it is possible to install on the host the latest version of gcc compiler and to configure nvcc to use it? Wait for your answers/
Thanks.

You may find gcc-5.4.0 from linaro: [url]https://releases.linaro.org/components/toolchain/binaries/latest-5/[/url].

Hello,
How can I say to nvcc to use the required version of gcc?

I think this is the purpose of -ccbin flag:

nvcc --help
...
--compiler-bindir <path>                   (-ccbin)                          
        Specify the directory in which the host compiler executable resides.  The
        host compiler executable name can be also specified to ensure that the correct
        host compiler is selected.  
...

Hi,

Sorry for the late reply.
Just confirmed that ABI incompatible issue can be fixed via 5.x aarch64-linux-gnu-g++.
Upgrade my compiler with Honey_Patouceul’s link. (Thanks Honey_Patouceul)

Share my steps:

  1. Upgrade host cross-compiler to 5.x
    https://releases.linaro.org/components/toolchain/binaries/latest-5/aarch64-linux-gnu/gcc-linaro-5.4.1-2017.01-x86_64_aarch64-linux-gnu.tar.xz

  2. Copy required libraries from device, including libopencv_core, libcudart, libtbb, libz

  3. Add configuration
    NVCC Compiler > Includes > Include paths

/usr/include

NVCC Linker > Libraries > Libraries

opencv_core
cudart
tbb
z

NVCC Linker > Library search path

[Your libraries directory]
/usr/local/cuda-8.0/targets/aarch64-linux/lib

Thanks for your patient and please let us know the results.

Good News,
I succeed to build the project after installation of newest version of gcc compiler on host. I changed eclipse definitions to use it ( in two places: Compiler and Linker definitions).
The cross compilation now works good.
I hope NVidia will solve the problem in the next release.