Platform
Jetson AGX Xavier, with Jetpack 4.3 DP, python 3.6
Host: GPU: Quadro P4000, python 3.5
Both of them have the following same environments:
cuda 10.0
cudnn 7.6.3
tensorrt 6.0
tensorflow-gpu 1.14.0
Problems
I want to build tensorrt oss https://github.com/NVIDIA/TensorRT on my Xavier but I meet some problems on situations when I try to build natively on it, and when I perform cross compiler on the host.
Errors of build natively on Xavier
I have checked that gcc and g++ are all installed on my Xavier and run the following command to build:
cmake .. -DTRT_LIB_DIR=/usr/lib/aarch64-linux-gnu -DTRT_BIN_DIR=`pwd`/out -DCUDA_VERSION=10.0 -DCUDNN_VERSION=7.6 -DPROTOBUF_VERSION=3.10.0 -DBUILD_PLUGINS=ON -DBUILD_SAMPLES=ON
Then it reports:
Building for TensorRT version: 6.0.1.0, library version: 6.0.1
-- The CXX compiler identification is GNU 7.4.0
-- The CUDA compiler identification is NVIDIA 10.0.326
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working CUDA compiler: /usr/local/cuda-10.0/bin/nvcc
-- Check for working CUDA compiler: /usr/local/cuda-10.0/bin/nvcc -- works
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Targeting TRT Platform: x86_64
-- CUDA version set to 10.0
-- cuDNN version set to 7.6
-- Protobuf version set to 3.10.0
I have no idea why it still build for x86_64 when I build on Xavier. The targeting TRT platform should be aarch64 rather than x86_64 and the procedure of make fails.
Errors of cross compiler on the host
After that, I try to build it with the cross compiler parameter
CMAKE_TOOLCHAIN_FILE=$TRT_SOURCE/cmake/toolchains/cmake_aarch64.toolchain
and the cmake command is
cmake .. -DTRT_LIB_DIR=$TRT_RELEASE/lib -DTRT_BIN_DIR=`pwd`/out -DCUDA_VERSION=10.0 -DCUDNN_VERSION=7.6 -DPROTOBUF_VERSION=3.10.0 -DBUILD_PLUGINS=ON -DBUILD_SAMPLES=ON -DCMAKE_TOOLCHAIN_FILE=$TRT_SOURCE/cmake/toolchains/cmake_aarch64.toolchain -DGPU_ARCHS="72"
but it still fails, with reports:
/usr/lib/gcc-cross/aarch64-linux-gnu/5/../../../../aarch64-linux-gnu/bin/ld: warning: libcublas.so.10.0, needed by /home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so, not found (try using -rpath or -rpath-link)
/usr/lib/gcc-cross/aarch64-linux-gnu/5/../../../../aarch64-linux-gnu/bin/ld: warning: libnvdla_compiler.so, needed by /home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so, not found (try using -rpath or -rpath-link)
/usr/lib/gcc-cross/aarch64-linux-gnu/5/../../../../aarch64-linux-gnu/bin/ld: warning: libnvmedia.so, needed by /home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so, not found (try using -rpath or -rpath-link)
/usr/lib/gcc-cross/aarch64-linux-gnu/5/../../../../aarch64-linux-gnu/bin/ld: warning: libEGL.so.1, needed by /home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so, not found (try using -rpath or -rpath-link)
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaDlaLoadableCreate'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `eglGetProcAddress'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `nvdla::destroyWisdom(nvdla::IWisdom*)'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaDlaGetMaxOutstandingTasks'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaTensorEglStreamConsumerDestroy'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaDlaGetInputTensorDescriptor'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `__cxa_init_primary_exception@CXXABI_1.3.11'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaTensorEglStreamConsumerAcquireMetaData'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `cublasSetMathMode@libcublas.so.10.0'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaEglStreamProducerGetTensor'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `typeinfo for std::thread::_State@GLIBCXX_3.4.22'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaTensorEglStreamProducerCreate'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)())@GLIBCXX_3.4.22'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `std::thread::_State::~_State()@GLIBCXX_3.4.22'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaDlaDataUnregister'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaDeviceDestroy'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `cublasSetStream_v2@libcublas.so.10.0'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `cublasGetMathMode@libcublas.so.10.0'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaTensorCreate'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `cublasSgemm_v2@libcublas.so.10.0'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaTensorEglStreamProducerDestroy'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `cublasSgemmStridedBatched@libcublas.so.10.0'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaTensorEglStreamConsumerCreate'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `cublasHgemmStridedBatched@libcublas.so.10.0'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaDlaGetOutputTensorDescriptor'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `nvdla::destroyNetwork(nvdla::INetwork*)'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `nvdla::createWisdom()'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `std::__exception_ptr::exception_ptr::exception_ptr(void*)@CXXABI_1.3.11'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `cublasDestroy_v2@libcublas.so.10.0'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaTensorLock'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaDlaInit'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `cublasGemmEx@libcublas.so.10.0'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaTensorGetMetaData'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `nvdla::createNetwork()'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaEglStreamConsumerAcquireTensor'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `eglTerminate'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaDlaSubmit'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaDlaLoadLoadable'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaDlaCreate'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaEglStreamConsumerReleaseTensor'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaEglStreamProducerPostTensor'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaDlaAppendLoadable'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaTensorEglStreamProducerPostMetaData'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaDlaGetNumEngines'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `cublasGetVersion_v2@libcublas.so.10.0'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaDlaDestroy'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaDlaLoadFromMemory'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `cublasCreate_v2@libcublas.so.10.0'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaDeviceCreate'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `cublasHgemm@libcublas.so.10.0'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaDlaSetCurrentLoadable'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaTensorUnlock'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaTensorGetStatus'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `eglInitialize'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `cublasSgemmEx@libcublas.so.10.0'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaDlaDataRegister'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `NvMediaTensorDestroy'
/home/jhm/TensorRT-6.0.1.5/lib/libnvinfer.so: undefined reference to `logf@GLIBC_2.27'
collect2: error: ld returned 1 exit status
parsers/onnx/CMakeFiles/getSupportedAPITest.dir/build.make:137: recipe for target 'parsers/onnx/getSupportedAPITest' failed
make[2]: *** [parsers/onnx/getSupportedAPITest] Error 1
CMakeFiles/Makefile2:1127: recipe for target 'parsers/onnx/CMakeFiles/getSupportedAPITest.dir/all' failed
make[1]: *** [parsers/onnx/CMakeFiles/getSupportedAPITest.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2
Hence, how to solve the above problems and how to build tensorrt oss on AGX Xavier?