undefined reference to symbol 'createInferBuilder_INTERNAL'

Hi everyone,

We’re trying to perform cross-compilation for our cpp code, we aim to create a tensorrt .engine file from a uff model.
In order to compile our code, we are using the cmake file for the SDK samples, we have added our source files to a new folder inside the sample folders and edited the cmake files to compile it as well.

We are compiling using these commands (as specified in the SDK samples README file):

sudo cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/usr/local/driveworks/samples/cmake/Toolchain-V4L.cmake -DVIBRANTE_PDK:STRING=/home/cellaerometer/NVIDIA/Drive/5050bL_SDK/DriveSDK/drive-t186ref-linux /usr/local/driveworks/samples -- VIBRANTE_PDK = /home/cellaerometer/NVIDIA/Drive/5050bL_SDK/DriveSDK/drive-t186ref-linux sudo make -j

The problem seems to be that the libraries specified in the cmake don’t include the implementations for the following function:

createInferBuilder_INTERNAL

This is the error:

/home/cellaerometer/NVIDIA/Drive/5050bL_SDK/DriveSDK/toolchains/tegra-4.9-nv/usr/bin/aarch64-gnu-linux/…/…/libexec/aarch64-gnu-linux/gcc/aarch64-gnu-linux/4.9.2/ld: CMakeFiles/pilotnet_inference.dir/PilotnetTRT.cpp.o: undefined reference to symbol ‘createInferBuilder_INTERNAL’

We have tried to somehow include the libnvinfer.so file, since we thought it might sort this out, but we get errors when trying to include it in the cmake.

Specs:

Ubuntu 16.04
Cuda 9.0
cudnn 7.0.4
g++ 5.4.0
Cross-compilation for Drive PX-2 Autochauffer, aarch64-linux

Could you help us with figuring this out?

Thanks

Hello,

I have the same problem with: undefined reference to symbol ‘createInferBuilder_INTERNAL’
Did you find any solution for this problem?

Thanks!

Similar issue, any update?

you have a linker error. createInferBuilder_INTERNAL should be defined in libnvinfer.so, so you need to link against the nvinfer libraries.

Not to awaken a sleeping topic, but I have linked it. See CMake output:

-- Found CUDNN: /usr/lib/x86_64-linux-gnu/libcudnn.so
-- Found CUDNN include: /usr/include
-- Found NVINFER: /usr/lib/x86_64-linux-gnu/libnvinfer.so
-- Found NVINFER include: /usr/include/x86_64-linux-gnu
install dir:/home/oren/Projects/AirSim/ros2/install/cinematography
/usr/bin/ld: warning: libopencv_imgcodecs.so.3.2, needed by /opt/ros/dashing/lib/libcv_bridge.so, may conflict with libopencv_imgcodecs.so.4.5
/usr/bin/ld: warning: libopencv_imgproc.so.3.2, needed by /opt/ros/dashing/lib/libcv_bridge.so, may conflict with libopencv_imgproc.so.4.5
/usr/bin/ld: warning: libopencv_core.so.3.2, needed by /opt/ros/dashing/lib/libcv_bridge.so, may conflict with libopencv_core.so.4.5
CMakeFiles/heading_estimation.dir/src/heading_estimation.cpp.o: In function `nvinfer1::(anonymous namespace)::createInferRuntime(nvinfer1::ILogger&)':
/usr/include/x86_64-linux-gnu/NvInferRuntime.h:1906: undefined reference to `createInferRuntime_INTERNAL'
collect2: error: ld returned 1 exit status

My cmake script has found it, and I’ve linked it in the appropriate executable here:

add_executable(heading_estimation src/heading_estimation.cpp)
ament_target_dependencies(heading_estimation rclcpp cinematography_msgs sensor_msgs geometry_msgs nav_msgs cv_bridge tf2_geometry_msgs)
target_link_libraries(heading_estimation ioHelper ${CUDA_LIBRARIES} ${CUDA_CUBLAS_LIBRARIES} ${CUDNN_LIBRARIES} ${OpenCV_LIBS} ${NVINFER_LIBRARIES})

But I still get the undefined reference error. Why?

Using TensorRT 7.1.3

Hi Oren,

Are you able to show the exact build commands that are run? Eg, if you’re using make, you could use make VERBOSE=1, or if you’re using ninja you could use ninja -v. There may be able to do this in a build system independent way through cmake :)

Cheers,
Tom

(Using colcon, a cmake wrapper). The output is a lot because it’s a big project, but the relevant command on the relevant executable is:

/usr/bin/g++-8  -DOPENCV  -g CMakeFiles/heading_estimation.dir/src/heading_estimation.cpp.o -o heading_estimation   -L/usr/local/cuda/lib64  -Wl,-rpath,/usr/local/cuda/lib64:/opt/ros/dashing/lib:/home/oren/Projects/AirSim/ros2/install/cinematography_msgs/lib:/home/oren/Projects/AirSim/ros2/build/cinematography:/usr/local/lib: /opt/ros/dashing/lib/libtrajectory_msgs__rosidl_generator_c.so /opt/ros/dashing/lib/libtrajectory_msgs__rosidl_typesupport_c.so /opt/ros/dashing/lib/libtrajectory_msgs__rosidl_typesupport_cpp.so /opt/ros/dashing/lib/libtrajectory_msgs__rosidl_typesupport_introspection_c.so /opt/ros/dashing/lib/libtrajectory_msgs__rosidl_typesupport_introspection_cpp.so /opt/ros/dashing/lib/libtrajectory_msgs__rosidl_typesupport_fastrtps_c.so /opt/ros/dashing/lib/libtrajectory_msgs__rosidl_typesupport_fastrtps_cpp.so /home/oren/Projects/AirSim/ros2/install/cinematography_msgs/lib/libcinematography_msgs__rosidl_generator_c.so /home/oren/Projects/AirSim/ros2/install/cinematography_msgs/lib/libcinematography_msgs__rosidl_typesupport_c.so /home/oren/Projects/AirSim/ros2/install/cinematography_msgs/lib/libcinematography_msgs__rosidl_typesupport_cpp.so /home/oren/Projects/AirSim/ros2/install/cinematography_msgs/lib/libcinematography_msgs__rosidl_typesupport_introspection_c.so /home/oren/Projects/AirSim/ros2/install/cinematography_msgs/lib/libcinematography_msgs__rosidl_typesupport_introspection_cpp.so /home/oren/Projects/AirSim/ros2/install/cinematography_msgs/lib/libcinematography_msgs__rosidl_typesupport_fastrtps_c.so /home/oren/Projects/AirSim/ros2/install/cinematography_msgs/lib/libcinematography_msgs__rosidl_typesupport_fastrtps_cpp.so /opt/ros/dashing/lib/libsensor_msgs__rosidl_generator_c.so /opt/ros/dashing/lib/libsensor_msgs__rosidl_typesupport_c.so /opt/ros/dashing/lib/libsensor_msgs__rosidl_typesupport_cpp.so /opt/ros/dashing/lib/libsensor_msgs__rosidl_typesupport_introspection_c.so /opt/ros/dashing/lib/libsensor_msgs__rosidl_typesupport_introspection_cpp.so /opt/ros/dashing/lib/libsensor_msgs__rosidl_typesupport_fastrtps_c.so /opt/ros/dashing/lib/libsensor_msgs__rosidl_typesupport_fastrtps_cpp.so /opt/ros/dashing/lib/libnav_msgs__rosidl_generator_c.so /opt/ros/dashing/lib/libnav_msgs__rosidl_typesupport_c.so /opt/ros/dashing/lib/libnav_msgs__rosidl_typesupport_cpp.so /opt/ros/dashing/lib/libnav_msgs__rosidl_typesupport_introspection_c.so /opt/ros/dashing/lib/libnav_msgs__rosidl_typesupport_introspection_cpp.so /opt/ros/dashing/lib/libnav_msgs__rosidl_typesupport_fastrtps_c.so /opt/ros/dashing/lib/libnav_msgs__rosidl_typesupport_fastrtps_cpp.so /opt/ros/dashing/lib/libcv_bridge.so /opt/ros/dashing/lib/liborocos-kdl.so.1.4.0 /opt/ros/dashing/lib/libtf2_ros.so /opt/ros/dashing/lib/libmessage_filters.so /opt/ros/dashing/lib/librclcpp.so /opt/ros/dashing/lib/librcl.so /opt/ros/dashing/lib/librcl_interfaces__rosidl_typesupport_c.so /opt/ros/dashing/lib/librcl_interfaces__rosidl_typesupport_cpp.so /opt/ros/dashing/lib/librcl_interfaces__rosidl_generator_c.so /opt/ros/dashing/lib/librcl_interfaces__rosidl_typesupport_fastrtps_c.so /opt/ros/dashing/lib/librcl_interfaces__rosidl_typesupport_fastrtps_cpp.so /opt/ros/dashing/lib/librcl_interfaces__rosidl_typesupport_introspection_c.so /opt/ros/dashing/lib/librcl_interfaces__rosidl_typesupport_introspection_cpp.so -lpthread /opt/ros/dashing/lib/librmw_implementation.so /opt/ros/dashing/lib/librmw.so /opt/ros/dashing/lib/librcutils.so /opt/ros/dashing/lib/librcl_logging_noop.so /opt/ros/dashing/lib/librosgraph_msgs__rosidl_generator_c.so /opt/ros/dashing/lib/librosgraph_msgs__rosidl_typesupport_c.so /opt/ros/dashing/lib/librosgraph_msgs__rosidl_typesupport_cpp.so /opt/ros/dashing/lib/librosgraph_msgs__rosidl_typesupport_introspection_c.so /opt/ros/dashing/lib/librosgraph_msgs__rosidl_typesupport_introspection_cpp.so /opt/ros/dashing/lib/librosgraph_msgs__rosidl_typesupport_fastrtps_c.so /opt/ros/dashing/lib/librosgraph_msgs__rosidl_typesupport_fastrtps_cpp.so /opt/ros/dashing/lib/librcl_yaml_param_parser.so /opt/ros/dashing/lib/libstd_msgs__rosidl_generator_c.so /opt/ros/dashing/lib/libstd_msgs__rosidl_typesupport_c.so /opt/ros/dashing/lib/libstd_msgs__rosidl_typesupport_cpp.so /opt/ros/dashing/lib/libstd_msgs__rosidl_typesupport_introspection_c.so /opt/ros/dashing/lib/libstd_msgs__rosidl_typesupport_introspection_cpp.so /opt/ros/dashing/lib/libstd_msgs__rosidl_typesupport_fastrtps_c.so /opt/ros/dashing/lib/libstd_msgs__rosidl_typesupport_fastrtps_cpp.so /opt/ros/dashing/lib/libgeometry_msgs__rosidl_typesupport_c.so /opt/ros/dashing/lib/libgeometry_msgs__rosidl_typesupport_cpp.so /opt/ros/dashing/lib/libgeometry_msgs__rosidl_generator_c.so /opt/ros/dashing/lib/libgeometry_msgs__rosidl_typesupport_fastrtps_c.so /opt/ros/dashing/lib/libgeometry_msgs__rosidl_typesupport_fastrtps_cpp.so /opt/ros/dashing/lib/libgeometry_msgs__rosidl_typesupport_introspection_c.so /opt/ros/dashing/lib/libgeometry_msgs__rosidl_typesupport_introspection_cpp.so /opt/ros/dashing/lib/libbuiltin_interfaces__rosidl_typesupport_c.so /opt/ros/dashing/lib/libbuiltin_interfaces__rosidl_typesupport_cpp.so /opt/ros/dashing/lib/libbuiltin_interfaces__rosidl_generator_c.so /opt/ros/dashing/lib/libbuiltin_interfaces__rosidl_typesupport_fastrtps_c.so /opt/ros/dashing/lib/libbuiltin_interfaces__rosidl_typesupport_fastrtps_cpp.so /opt/ros/dashing/lib/libbuiltin_interfaces__rosidl_typesupport_introspection_c.so /opt/ros/dashing/lib/libbuiltin_interfaces__rosidl_typesupport_introspection_cpp.so /opt/ros/dashing/lib/libunique_identifier_msgs__rosidl_typesupport_c.so /opt/ros/dashing/lib/libunique_identifier_msgs__rosidl_typesupport_cpp.so /opt/ros/dashing/lib/libunique_identifier_msgs__rosidl_generator_c.so /opt/ros/dashing/lib/libunique_identifier_msgs__rosidl_typesupport_fastrtps_c.so /opt/ros/dashing/lib/libunique_identifier_msgs__rosidl_typesupport_fastrtps_cpp.so /opt/ros/dashing/lib/libunique_identifier_msgs__rosidl_typesupport_introspection_c.so /opt/ros/dashing/lib/libunique_identifier_msgs__rosidl_typesupport_introspection_cpp.so /opt/ros/dashing/lib/librosidl_typesupport_c.so /opt/ros/dashing/lib/librosidl_typesupport_cpp.so /opt/ros/dashing/lib/librosidl_generator_c.so /opt/ros/dashing/lib/librosidl_typesupport_introspection_c.so /opt/ros/dashing/lib/librosidl_typesupport_introspection_cpp.so /opt/ros/dashing/lib/libaction_msgs__rosidl_generator_c.so /opt/ros/dashing/lib/libaction_msgs__rosidl_typesupport_c.so /opt/ros/dashing/lib/libaction_msgs__rosidl_typesupport_cpp.so /opt/ros/dashing/lib/libaction_msgs__rosidl_typesupport_introspection_c.so /opt/ros/dashing/lib/libaction_msgs__rosidl_typesupport_introspection_cpp.so /opt/ros/dashing/lib/libaction_msgs__rosidl_typesupport_fastrtps_c.so /opt/ros/dashing/lib/libaction_msgs__rosidl_typesupport_fastrtps_cpp.so /opt/ros/dashing/lib/libtf2_msgs__rosidl_typesupport_c.so /opt/ros/dashing/lib/libtf2_msgs__rosidl_typesupport_cpp.so /opt/ros/dashing/lib/libtf2_msgs__rosidl_generator_c.so /opt/ros/dashing/lib/libtf2_msgs__rosidl_typesupport_fastrtps_c.so /opt/ros/dashing/lib/libtf2_msgs__rosidl_typesupport_fastrtps_cpp.so /opt/ros/dashing/lib/libtf2_msgs__rosidl_typesupport_introspection_c.so /opt/ros/dashing/lib/libtf2_msgs__rosidl_typesupport_introspection_cpp.so /opt/ros/dashing/lib/libconsole_bridge.so.0.4 /opt/ros/dashing/lib/libtf2.so libioHelper.so /usr/local/cuda/lib64/libcudart_static.a -ldl /usr/lib/x86_64-linux-gnu/librt.so /usr/local/cuda/lib64/libcublas.so /usr/local/lib/libopencv_gapi.so.4.5.1 /usr/local/lib/libopencv_stitching.so.4.5.1 /usr/local/lib/libopencv_alphamat.so.4.5.1 /usr/local/lib/libopencv_aruco.so.4.5.1 /usr/local/lib/libopencv_bgsegm.so.4.5.1 /usr/local/lib/libopencv_bioinspired.so.4.5.1 /usr/local/lib/libopencv_ccalib.so.4.5.1 /usr/local/lib/libopencv_cudabgsegm.so.4.5.1 /usr/local/lib/libopencv_cudafeatures2d.so.4.5.1 /usr/local/lib/libopencv_cudaobjdetect.so.4.5.1 /usr/local/lib/libopencv_cudastereo.so.4.5.1 /usr/local/lib/libopencv_dnn_objdetect.so.4.5.1 /usr/local/lib/libopencv_dnn_superres.so.4.5.1 /usr/local/lib/libopencv_dpm.so.4.5.1 /usr/local/lib/libopencv_face.so.4.5.1 /usr/local/lib/libopencv_freetype.so.4.5.1 /usr/local/lib/libopencv_fuzzy.so.4.5.1 /usr/local/lib/libopencv_hdf.so.4.5.1 /usr/local/lib/libopencv_hfs.so.4.5.1 /usr/local/lib/libopencv_img_hash.so.4.5.1 /usr/local/lib/libopencv_intensity_transform.so.4.5.1 /usr/local/lib/libopencv_line_descriptor.so.4.5.1 /usr/local/lib/libopencv_mcc.so.4.5.1 /usr/local/lib/libopencv_quality.so.4.5.1 /usr/local/lib/libopencv_rapid.so.4.5.1 /usr/local/lib/libopencv_reg.so.4.5.1 /usr/local/lib/libopencv_rgbd.so.4.5.1 /usr/local/lib/libopencv_saliency.so.4.5.1 /usr/local/lib/libopencv_sfm.so.4.5.1 /usr/local/lib/libopencv_stereo.so.4.5.1 /usr/local/lib/libopencv_structured_light.so.4.5.1 /usr/local/lib/libopencv_superres.so.4.5.1 /usr/local/lib/libopencv_surface_matching.so.4.5.1 /usr/local/lib/libopencv_tracking.so.4.5.1 /usr/local/lib/libopencv_videostab.so.4.5.1 /usr/local/lib/libopencv_viz.so.4.5.1 /usr/local/lib/libopencv_xfeatures2d.so.4.5.1 /usr/local/lib/libopencv_xobjdetect.so.4.5.1 /usr/local/lib/libopencv_xphoto.so.4.5.1 /usr/local/lib/libopencv_phase_unwrapping.so.4.5.1 /usr/local/lib/libopencv_cudacodec.so.4.5.1 /usr/local/lib/libopencv_highgui.so.4.5.1 /usr/local/lib/libopencv_datasets.so.4.5.1 /usr/local/lib/libopencv_plot.so.4.5.1 /usr/local/lib/libopencv_text.so.4.5.1 /usr/local/lib/libopencv_videoio.so.4.5.1 /usr/local/lib/libopencv_cudaoptflow.so.4.5.1 /usr/local/lib/libopencv_cudalegacy.so.4.5.1 /usr/local/lib/libopencv_cudawarping.so.4.5.1 /usr/local/lib/libopencv_optflow.so.4.5.1 /usr/local/lib/libopencv_ml.so.4.5.1 /usr/local/lib/libopencv_shape.so.4.5.1 /usr/local/lib/libopencv_ximgproc.so.4.5.1 /usr/local/lib/libopencv_video.so.4.5.1 /usr/local/lib/libopencv_dnn.so.4.5.1 /usr/local/lib/libopencv_imgcodecs.so.4.5.1 /usr/local/lib/libopencv_objdetect.so.4.5.1 /usr/local/lib/libopencv_calib3d.so.4.5.1 /usr/local/lib/libopencv_features2d.so.4.5.1 /usr/local/lib/libopencv_flann.so.4.5.1 /usr/local/lib/libopencv_photo.so.4.5.1 /usr/local/lib/libopencv_cudaimgproc.so.4.5.1 /usr/local/lib/libopencv_cudafilters.so.4.5.1 /usr/local/lib/libopencv_imgproc.so.4.5.1 /usr/local/lib/libopencv_cudaarithm.so.4.5.1 /usr/local/lib/libopencv_core.so.4.5.1 /usr/local/lib/libopencv_cudev.so.4.5.1 -lpthread -ldl /usr/lib/x86_64-linux-gnu/librt.so /usr/local/cuda/lib64/libcublas.so 
/usr/bin/g++-8                 -std=c++17 -ggdb -Wall -Wextra -Wstrict-aliasing -Wunreachable-code -Wcast-qual -Wctor-dtor-privacy                 -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-include-dirs -Wswitch-default                 -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wstrict-overflow=5 -Wswitch-default -Wundef                 -Wno-variadic-macros -Wno-parentheses -Wno-unused-function -Wno-unused -fdiagnostics-show-option                 -pthread                 -D MSGPACK_PP_VARIADICS_MSVC=0  -g -rdynamic CMakeFiles/MavLinkTest.dir/home/oren/Projects/AirSim/MavLinkCom/MavLinkTest/Commands.cpp.o CMakeFiles/MavLinkTest.dir/home/oren/Projects/AirSim/MavLinkCom/MavLinkTest/UnitTests.cpp.o CMakeFiles/MavLinkTest.dir/home/oren/Projects/AirSim/MavLinkCom/MavLinkTest/main.cpp.o -o ../../output/bin/MavLinkTest  -lpthread ../../output/lib/libMavLinkCom.a -lstdc++fs -fmax-errors=10 -Wnoexcept -Wstrict-null-sentinel -lpthread 

Note, I have built similar successfully built code that also has a createInferBuilder call in it, but that was built with a conventional makefile.

Hi Oren,

I grepped nvinfer in your build step there, and I don’t see it linked. Maybe message NVINFER_LIBRARIES in your cmakelists and see what it gives you. The variable you might want may be TensorRT_LIBRARIES

Both of those are undefined

It was NVINFER_LIBRARY. Singular

For those who don’t want to read the whole thread, the cmake solution is to add this line:

target_link_libraries(executable_name ${NVINFER_LIBRARY})
1 Like