Jetson-inference cmake fail with xvaier nx and jetpack5.0.1

jetson-infernce cmake with no problem on 4.5.1,4.6,4.6.2,while cmake failed on 5.0.1.issue similiar to his problem.my CMakeOutput.log is like his.
the folllowing is the log while cmaking :

Note: this project uses git submodules in the source tree.
if you haven’t already, run the following command from
the project’s root directory:

       git submodule update --init

– using patched FindCUDA.cmake
– CUDA version: 11.4
– CUDA 11 detected, enabling SM_72
– system arch: aarch64
– output path: /data/3rd-rely/jetson-inference/build/aarch64
– BUILD_EXPERIMENTAL disabled
– Copying /data/3rd-rely/jetson-inference/c/depthNet.h
– Copying /data/3rd-rely/jetson-inference/c/detectNet.h
– Copying /data/3rd-rely/jetson-inference/c/imageNet.h
– Copying /data/3rd-rely/jetson-inference/c/poseNet.h
– Copying /data/3rd-rely/jetson-inference/c/segNet.h
– Copying /data/3rd-rely/jetson-inference/c/tensorConvert.h
– Copying /data/3rd-rely/jetson-inference/c/tensorNet.h
– Copying /data/3rd-rely/jetson-inference/calibration/randInt8Calibrator.h
– Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
CMake Warning at tools/camera-capture/CMakeLists.txt:8 (find_package):
By not providing “FindQt5.cmake” in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by “Qt5”, but
CMake did not find one.

Could not find a package configuration file provided by “Qt5” with any of
the following names:

Qt5Config.cmake
qt5-config.cmake

Add the installation prefix of “Qt5” to CMAKE_PREFIX_PATH or set “Qt5_DIR”
to a directory containing one of the above files. If “Qt5” provides a
separate development package or SDK, be sure it has been installed.

– camera-capture: Qt5Widgets package not found, skipping…
– camera-capture: run ‘sudo apt-get install qtbase5-dev’
– jetson-utils: building as submodule, /data/3rd-rely/jetson-inference
– Copying /data/3rd-rely/jetson-inference/utils/URI.h
– Copying /data/3rd-rely/jetson-inference/utils/XML.h
– Copying /data/3rd-rely/jetson-inference/utils/alphanum.h
– Copying /data/3rd-rely/jetson-inference/utils/camera/gstCamera.h
– Copying /data/3rd-rely/jetson-inference/utils/camera/v4l2Camera.h
– Copying /data/3rd-rely/jetson-inference/utils/codec/gstBufferManager.h
– Copying /data/3rd-rely/jetson-inference/utils/codec/gstDecoder.h
– Copying /data/3rd-rely/jetson-inference/utils/codec/gstEncoder.h
– Copying /data/3rd-rely/jetson-inference/utils/codec/gstUtility.h
– Copying /data/3rd-rely/jetson-inference/utils/codec/nvbuf_utils.h
– Copying /data/3rd-rely/jetson-inference/utils/commandLine.h
– Copying /data/3rd-rely/jetson-inference/utils/csvReader.h
– Copying /data/3rd-rely/jetson-inference/utils/csvReader.hpp
– Copying /data/3rd-rely/jetson-inference/utils/csvWriter.h
– Copying /data/3rd-rely/jetson-inference/utils/csvWriter.hpp
– Copying /data/3rd-rely/jetson-inference/utils/cuda/cudaAlphaBlend.cuh
– Copying /data/3rd-rely/jetson-inference/utils/cuda/cudaBayer.h
– Copying /data/3rd-rely/jetson-inference/utils/cuda/cudaColormap.h
– Copying /data/3rd-rely/jetson-inference/utils/cuda/cudaColorspace.h
– Copying /data/3rd-rely/jetson-inference/utils/cuda/cudaCrop.h
– Copying /data/3rd-rely/jetson-inference/utils/cuda/cudaDraw.h
– Copying /data/3rd-rely/jetson-inference/utils/cuda/cudaFilterMode.cuh
– Copying /data/3rd-rely/jetson-inference/utils/cuda/cudaFilterMode.h
– Copying /data/3rd-rely/jetson-inference/utils/cuda/cudaFont.h
– Copying /data/3rd-rely/jetson-inference/utils/cuda/cudaGrayscale.h
– Copying /data/3rd-rely/jetson-inference/utils/cuda/cudaMappedMemory.h
– Copying /data/3rd-rely/jetson-inference/utils/cuda/cudaMath.h
– Copying /data/3rd-rely/jetson-inference/utils/cuda/cudaNormalize.h
– Copying /data/3rd-rely/jetson-inference/utils/cuda/cudaOverlay.h
– Copying /data/3rd-rely/jetson-inference/utils/cuda/cudaPointCloud.h
– Copying /data/3rd-rely/jetson-inference/utils/cuda/cudaRGB.h
– Copying /data/3rd-rely/jetson-inference/utils/cuda/cudaResize.h
– Copying /data/3rd-rely/jetson-inference/utils/cuda/cudaUtility.h
– Copying /data/3rd-rely/jetson-inference/utils/cuda/cudaVector.h
– Copying /data/3rd-rely/jetson-inference/utils/cuda/cudaWarp.h
– Copying /data/3rd-rely/jetson-inference/utils/cuda/cudaYUV.h
– Copying /data/3rd-rely/jetson-inference/utils/display/glBuffer.h
– Copying /data/3rd-rely/jetson-inference/utils/display/glCamera.h
– Copying /data/3rd-rely/jetson-inference/utils/display/glDisplay.h
– Copying /data/3rd-rely/jetson-inference/utils/display/glEvents.h
– Copying /data/3rd-rely/jetson-inference/utils/display/glTexture.h
– Copying /data/3rd-rely/jetson-inference/utils/display/glUtility.h
– Copying /data/3rd-rely/jetson-inference/utils/display/glWidget.h
– Copying /data/3rd-rely/jetson-inference/utils/filesystem.h
– Copying /data/3rd-rely/jetson-inference/utils/image/imageFormat.h
– Copying /data/3rd-rely/jetson-inference/utils/image/imageFormat.inl
– Copying /data/3rd-rely/jetson-inference/utils/image/imageIO.h
– Copying /data/3rd-rely/jetson-inference/utils/image/imageLoader.h
– Copying /data/3rd-rely/jetson-inference/utils/image/imageWriter.h
– Copying /data/3rd-rely/jetson-inference/utils/image/loadImage.h
– Copying /data/3rd-rely/jetson-inference/utils/input/devInput.h
– Copying /data/3rd-rely/jetson-inference/utils/input/devJoystick.h
– Copying /data/3rd-rely/jetson-inference/utils/input/devKeyboard.h
– Copying /data/3rd-rely/jetson-inference/utils/json.hpp
– Copying /data/3rd-rely/jetson-inference/utils/logging.h
– Copying /data/3rd-rely/jetson-inference/utils/mat33.h
– Copying /data/3rd-rely/jetson-inference/utils/network/Endian.h
– Copying /data/3rd-rely/jetson-inference/utils/network/IPv4.h
– Copying /data/3rd-rely/jetson-inference/utils/network/NetworkAdapter.h
– Copying /data/3rd-rely/jetson-inference/utils/network/Socket.h
– Copying /data/3rd-rely/jetson-inference/utils/pi.h
– Copying /data/3rd-rely/jetson-inference/utils/rand.h
– Copying /data/3rd-rely/jetson-inference/utils/threads/Event.h
– Copying /data/3rd-rely/jetson-inference/utils/threads/Event.inl
– Copying /data/3rd-rely/jetson-inference/utils/threads/Mutex.h
– Copying /data/3rd-rely/jetson-inference/utils/threads/Mutex.inl
– Copying /data/3rd-rely/jetson-inference/utils/threads/Process.h
– Copying /data/3rd-rely/jetson-inference/utils/threads/RingBuffer.h
– Copying /data/3rd-rely/jetson-inference/utils/threads/RingBuffer.inl
– Copying /data/3rd-rely/jetson-inference/utils/threads/Thread.h
– Copying /data/3rd-rely/jetson-inference/utils/timespec.h
– Copying /data/3rd-rely/jetson-inference/utils/video/videoOptions.h
– Copying /data/3rd-rely/jetson-inference/utils/video/videoOutput.h
– Copying /data/3rd-rely/jetson-inference/utils/video/videoSource.h
– trying to build Python bindings for Python versions: 2.7;3.6;3.7
– detecting Python 2.7…
– found Python version: 2.7 (2.7.18)
– found Python include: /usr/include/python2.7
– found Python library: /usr/lib/aarch64-linux-gnu/libpython2.7.so
– CMake module path: /data/3rd-rely/jetson-inference/utils/cuda;/data/3rd-rely/jetson-inference/utils/python/bindings
– NumPy ver. 1.16.5 found (include: /usr/lib/python2.7/dist-packages/numpy/core/include)
– found NumPy version: 1.16.5
– found NumPy include: /usr/lib/python2.7/dist-packages/numpy/core/include
– detecting Python 3.6…
– found Python version: 3.8 (3.8.10)
– found Python include: /usr/include/python3.8
– found Python library: /usr/lib/aarch64-linux-gnu/libpython3.8.so
– CMake module path: /data/3rd-rely/jetson-inference/utils/cuda;/data/3rd-rely/jetson-inference/utils/python/bindings
– NumPy ver. 1.17.4 found (include: /usr/lib/python3/dist-packages/numpy/core/include)
– found NumPy version: 1.17.4
– found NumPy include: /usr/lib/python3/dist-packages/numpy/core/include
– detecting Python 3.7…
– found Python version: 3.8 (3.8.10)
– found Python include: /usr/include/python3.8
– found Python library: /usr/lib/aarch64-linux-gnu/libpython3.8.so
– CMake module path: /data/3rd-rely/jetson-inference/utils/cuda;/data/3rd-rely/jetson-inference/utils/python/bindings
– NumPy ver. 1.17.4 found (include: /usr/lib/python3/dist-packages/numpy/core/include)
– found NumPy version: 1.17.4
– found NumPy include: /usr/lib/python3/dist-packages/numpy/core/include
CMake Error at utils/cuda/FindCUDA.cmake:1802 (add_library):
add_library cannot create target “jetson-utils-python-38” because another
target with the same name already exists. The existing target is a shared
library created in source directory
“/data/3rd-rely/jetson-inference/utils/python/bindings”. See documentation
for policy CMP0002 for more details.
Call Stack (most recent call first):
utils/python/bindings/CMakeLists.txt:57 (cuda_add_library)

CMake Error at utils/python/bindings/CMakeLists.txt:59 (target_link_libraries):
Attempt to add link library “jetson-utils” to target
“jetson-utils-python-38” which is not built in this directory.

This is allowed only when policy CMP0079 is set to NEW.

CMake Error at utils/python/bindings/CMakeLists.txt:62 (target_link_libraries):
Attempt to add link library “npymath” to target “jetson-utils-python-38”
which is not built in this directory.

This is allowed only when policy CMP0079 is set to NEW.

– Copying /data/3rd-rely/jetson-inference/utils/python/examples/camera-viewer.py
– Copying /data/3rd-rely/jetson-inference/utils/python/examples/cuda-examples.py
– Copying /data/3rd-rely/jetson-inference/utils/python/examples/cuda-from-cv.py
– Copying /data/3rd-rely/jetson-inference/utils/python/examples/cuda-from-numpy.py
– Copying /data/3rd-rely/jetson-inference/utils/python/examples/cuda-to-cv.py
– Copying /data/3rd-rely/jetson-inference/utils/python/examples/cuda-to-numpy.py
– Copying /data/3rd-rely/jetson-inference/utils/python/examples/gl-display-test.py
– Copying /data/3rd-rely/jetson-inference/utils/python/examples/video-viewer.py
– trying to build Python bindings for Python versions: 2.7;3.6;3.7
– detecting Python 2.7…
– found Python version: 2.7 (2.7.18)
– found Python include: /usr/include/python2.7
– found Python library: /usr/lib/aarch64-linux-gnu/libpython2.7.so
– CMake module path: /data/3rd-rely/jetson-inference/utils/cuda;/data/3rd-rely/jetson-inference/python/bindings;/data/3rd-rely/jetson-inference/python/bindings/…/…/utils/python/bindings
– NumPy ver. 1.16.5 found (include: /usr/lib/python2.7/dist-packages/numpy/core/include)
– found NumPy version: 1.16.5
– found NumPy include: /usr/lib/python2.7/dist-packages/numpy/core/include
– detecting Python 3.6…
– found Python version: 3.8 (3.8.10)
– found Python include: /usr/include/python3.8
– found Python library: /usr/lib/aarch64-linux-gnu/libpython3.8.so
– CMake module path: /data/3rd-rely/jetson-inference/utils/cuda;/data/3rd-rely/jetson-inference/python/bindings;/data/3rd-rely/jetson-inference/python/bindings/…/…/utils/python/bindings
– NumPy ver. 1.17.4 found (include: /usr/lib/python3/dist-packages/numpy/core/include)
– found NumPy version: 1.17.4
– found NumPy include: /usr/lib/python3/dist-packages/numpy/core/include
– detecting Python 3.7…
– found Python version: 3.8 (3.8.10)
– found Python include: /usr/include/python3.8
– found Python library: /usr/lib/aarch64-linux-gnu/libpython3.8.so
– CMake module path: /data/3rd-rely/jetson-inference/utils/cuda;/data/3rd-rely/jetson-inference/python/bindings;/data/3rd-rely/jetson-inference/python/bindings/…/…/utils/python/bindings
– NumPy ver. 1.17.4 found (include: /usr/lib/python3/dist-packages/numpy/core/include)
– found NumPy version: 1.17.4
– found NumPy include: /usr/lib/python3/dist-packages/numpy/core/include
CMake Error at utils/cuda/FindCUDA.cmake:1802 (add_library):
add_library cannot create target “jetson-inference-python-38” because
another target with the same name already exists. The existing target is a
shared library created in source directory
“/data/3rd-rely/jetson-inference/python/bindings”. See documentation for
policy CMP0002 for more details.
Call Stack (most recent call first):
python/bindings/CMakeLists.txt:57 (cuda_add_library)

CMake Error at python/bindings/CMakeLists.txt:59 (target_link_libraries):
Attempt to add link library “jetson-inference” to target
“jetson-inference-python-38” which is not built in this directory.

This is allowed only when policy CMP0079 is set to NEW.

CMake Error at python/bindings/CMakeLists.txt:62 (target_link_libraries):
Attempt to add link library “npymath” to target
“jetson-inference-python-38” which is not built in this directory.

This is allowed only when policy CMP0079 is set to NEW.

– Copying /data/3rd-rely/jetson-inference/python/examples/depthnet.py
– Copying /data/3rd-rely/jetson-inference/python/examples/depthnet_utils.py
– Copying /data/3rd-rely/jetson-inference/python/examples/detectnet.py
– Copying /data/3rd-rely/jetson-inference/python/examples/imagenet.py
– Copying /data/3rd-rely/jetson-inference/python/examples/my-detection.py
– Copying /data/3rd-rely/jetson-inference/python/examples/my-recognition.py
– Copying /data/3rd-rely/jetson-inference/python/examples/posenet.py
– Copying /data/3rd-rely/jetson-inference/python/examples/segnet.py
– Copying /data/3rd-rely/jetson-inference/python/examples/segnet_utils.py
– Copying examples/imagenet.py → imagenet-console.py
– Copying examples/imagenet.py → imagenet-camera.py
– Copying examples/detectnet.py → detectnet-console.py
– Copying examples/detectnet.py → detectnet-camera.py
– Copying examples/segnet.py → segnet-console.py
– Copying examples/segnet.py → segnet-camera.py
– Configuring incomplete, errors occurred!
See also “/data/3rd-rely/jetson-inference/build/CMakeFiles/CMakeOutput.log”.
See also “/data/3rd-rely/jetson-inference/build/CMakeFiles/CMakeError.log”.

the CMakeError.log is the following :

Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /data/3rd-rely/jetson-inference/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_ba6d3/fast && /usr/bin/make -f CMakeFiles/cmTC_ba6d3.dir/build.make CMakeFiles/cmTC_ba6d3.dir/build
make[1]: Entering directory ‘/data/3rd-rely/jetson-inference/build/CMakeFiles/CMakeTmp’
Building C object CMakeFiles/cmTC_ba6d3.dir/src.c.o
/usr/bin/cc -fPIC -DCMAKE_HAVE_LIBC_PTHREAD -o CMakeFiles/cmTC_ba6d3.dir/src.c.o -c /data/3rd-rely/jetson-inference/build/CMakeFiles/CMakeTmp/src.c
Linking C executable cmTC_ba6d3
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_ba6d3.dir/link.txt --verbose=1
/usr/bin/cc -fPIC -DCMAKE_HAVE_LIBC_PTHREAD -rdynamic CMakeFiles/cmTC_ba6d3.dir/src.c.o -o cmTC_ba6d3
/usr/bin/ld: CMakeFiles/cmTC_ba6d3.dir/src.c.o: in function main': src.c:(.text+0x48): undefined reference to pthread_create’
/usr/bin/ld: src.c:(.text+0x50): undefined reference to pthread_detach' /usr/bin/ld: src.c:(.text+0x5c): undefined reference to pthread_join’
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_ba6d3.dir/build.make:87: cmTC_ba6d3] Error 1
make[1]: Leaving directory ‘/data/3rd-rely/jetson-inference/build/CMakeFiles/CMakeTmp’
make: *** [Makefile:121: cmTC_ba6d3/fast] Error 2

Source file was:
#include <pthread.h>

void* test_func(void* data)
{
return data;
}

int main(void)
{
pthread_t thread;
pthread_create(&thread, NULL, test_func, NULL);
pthread_detach(thread);
pthread_join(thread, NULL);
pthread_atfork(NULL, NULL, NULL);
pthread_exit(NULL);

return 0;
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /data/3rd-rely/jetson-inference/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_7febf/fast && /usr/bin/make -f CMakeFiles/cmTC_7febf.dir/build.make CMakeFiles/cmTC_7febf.dir/build
make[1]: Entering directory ‘/data/3rd-rely/jetson-inference/build/CMakeFiles/CMakeTmp’
Building C object CMakeFiles/cmTC_7febf.dir/CheckFunctionExists.c.o
/usr/bin/cc -fPIC -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_7febf.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.16/Modules/CheckFunctionExists.c
Linking C executable cmTC_7febf
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_7febf.dir/link.txt --verbose=1
/usr/bin/cc -fPIC -DCHECK_FUNCTION_EXISTS=pthread_create -rdynamic CMakeFiles/cmTC_7febf.dir/CheckFunctionExists.c.o -o cmTC_7febf -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_7febf.dir/build.make:87: cmTC_7febf] Error 1
make[1]: Leaving directory ‘/data/3rd-rely/jetson-inference/build/CMakeFiles/CMakeTmp’

Hi,

It looks like there is a branch for JetPack 5.
Would you mind checking out the branch and trying it again?

Thanks.

That jp5 branch has already been merged into jetson-inference master - @robot_2022, please pull the latest master and try building again. You are missing some output from your cmake log that was added to support JetPack 5 which makes me think you are running older code from jetson-inference.

3ks,it works. @dusty_nv @AastaLLL

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.