build onnx-tensorrt in jetson + ubuntu 20.04

Raspberry Pi, Jeston Nano


henrywu
Posts: 180
Joined: Sun Apr 17, 2022 4:57 pm

build onnx-tensorrt in jetson + ubuntu 20.04

Post by henrywu »

Code: Select all

git submodule update --init --recursive
...
export CC=clang CXX=clang++
...
jetson@nano:~/external/onnx-tensorrt/build$ clang --version
clang version 10.0.0-4ubuntu1 
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
etson@nano:~/external/onnx-tensorrt/build$ sudo make install
[  2%] Built target gen_onnx_proto
[ 13%] Built target onnx_proto
[ 27%] Built target nvonnxparser
[ 41%] Built target nvonnxparser_static
[ 94%] Built target onnx
[ 96%] Built target onnx2trt
[100%] Built target getSupportedAPITest
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/lib/libnvonnxparser.so.8.2.1
-- Installing: /usr/local/lib/libnvonnxparser.so.8
-- Installing: /usr/local/lib/libnvonnxparser.so
-- Installing: /usr/local/lib/libnvonnxparser_static.a
-- Installing: /usr/local/bin/onnx2trt
henrywu
Posts: 180
Joined: Sun Apr 17, 2022 4:57 pm

Re: build onnx-tensorrt in jetson + ubuntu 20.04

Post by henrywu »

Error:

Code: Select all

/home/jetson/TensorRT/python/src/infer/pyInt8.cpp:135:9: error: cannot initialize return object of type 'const void *' with an rvalue of type 'enable_if_t<std::is_same<void, intrinsic_t<const void *> >::value, void>' (aka 'void')
        PYBIND11_OVERLOAD_PURE_NAME(
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jetson/external/pybind11/include/pybind11/pybind11.h:2853:5: note: expanded from macro 'PYBIND11_OVERLOAD_PURE_NAME'
    PYBIND11_OVERRIDE_PURE_NAME(                                                                  \
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jetson/external/pybind11/include/pybind11/pybind11.h:2794:9: note: expanded from macro 'PYBIND11_OVERRIDE_PURE_NAME'
        PYBIND11_OVERRIDE_IMPL(PYBIND11_TYPE(ret_type), PYBIND11_TYPE(cname), name, __VA_ARGS__); \
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jetson/external/pybind11/include/pybind11/pybind11.h:2760:20: note: expanded from macro 'PYBIND11_OVERRIDE_IMPL'
            return pybind11::detail::cast_safe<ret_type>(std::move(o));                           \
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Use the correct version of pybind11 to build tensorRT Python binding

Code: Select all

jetson@nano:~/external/python3.8/include$ ln -s aarch64-linux-gnu/python3.8/pyconfig.h pyconfig.h
jetson@nano:~/external$ ln -s /home/jetson/TensorRT/parsers/onnx/third_party/onnx/third_party/pybind11 pybind11
jetson@nano:~/external$ ll
total 24
drwxrwxr-x  5 jetson jetson 4096 jun  5 20:56 ./
drwxr-xr-x 25 jetson jetson 4096 jun  5 20:48 ../
drwxrwxr-x 13 jetson jetson 4096 jun  5 20:07 onnx_normal/
drwxrwxr-x  8 jetson jetson 4096 jun  5 20:25 onnx-tensorrt/
lrwxrwxrwx  1 jetson jetson   72 jun  5 20:56 pybind11 -> /home/jetson/TensorRT/parsers/onnx/third_party/onnx/third_party/pybind11/
drwxrwxr-x  3 jetson jetson 4096 jun  5 19:49 python3.8/

Code: Select all

jetson@nano:~/TensorRT/python$ PYTHON_MAJOR_VERSION=3 PYTHON_MINOR_VERSION=8 TARGET_ARCHITECTURE=aarch64 ./build.sh
~/TensorRT/python/build ~/TensorRT/python
-- The CXX compiler identification is Clang 10.0.0
-- The C compiler identification is Clang 10.0.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jetson/TensorRT/python/build
[ 16%] Building CXX object CMakeFiles/tensorrt.dir/src/infer/pyCore.cpp.o
[ 16%] Building CXX object CMakeFiles/tensorrt.dir/src/infer/pyAlgorithmSelector.cpp.o
[ 25%] Building CXX object CMakeFiles/tensorrt.dir/src/infer/pyGraph.cpp.o
[ 33%] Building CXX object CMakeFiles/tensorrt.dir/src/infer/pyFoundationalTypes.cpp.o
[ 41%] Building CXX object CMakeFiles/tensorrt.dir/src/infer/pyInt8.cpp.o
[ 50%] Building CXX object CMakeFiles/tensorrt.dir/src/infer/pyPlugin.cpp.o
[ 58%] Building CXX object CMakeFiles/tensorrt.dir/src/parsers/pyCaffe.cpp.o
[ 66%] Building CXX object CMakeFiles/tensorrt.dir/src/parsers/pyUff.cpp.o
[ 75%] Building CXX object CMakeFiles/tensorrt.dir/src/parsers/pyOnnx.cpp.o
[ 83%] Building CXX object CMakeFiles/tensorrt.dir/src/utils.cpp.o
[ 91%] Building CXX object CMakeFiles/tensorrt.dir/src/pyTensorRT.cpp.o
[100%] Linking CXX shared library tensorrt/tensorrt.so
[100%] Built target tensorrt
Generating python 3.8 bindings for TensorRT 8.2.3.0
~/TensorRT/python/packaging ~/TensorRT/python/build ~/TensorRT/python
~/TensorRT/python/build ~/TensorRT/python
~/TensorRT/python
Post Reply