Issues trying to build gtsam 4.0.2 using cmake: CMake Error at wrap/CMakeLists.txt:32 (target_link_libraries): The "debug" argument must be followed by a library.
Running on Ubuntu 20.04 on Jetson Orin (arm64, Noetic)
I am trying to build gtsam 4.0.2, but when I reach the step to run: cmake -DGTSAM_BUILD_WITH_MARCH_NATIVE=OFF -DCMAKE_INSTALL_PREFIX=/usr/local/include/gtsam402 ..
I get:
-- GTSAM_SOURCE_ROOT_DIR: [/home/isp/Downloads/gtsam-4.0.2]
-- GTSAM_BOOST_LIBRARIES: optimized;/usr/lib/aarch64-linux-gnu/libboost_serialization.so.1.71.0;optimized;/usr/lib/aarch64-linux-gnu/libboost_system.so.1.71.0;optimized;/usr/lib/aarch64-linux-gnu/libboost_filesystem.so.1.71.0;optimized;/usr/lib/aarch64-linux-gnu/libboost_thread.so.1.71.0;optimized;/usr/lib/aarch64-linux-gnu/libboost_date_time.so.1.71.0;optimized;/usr/lib/aarch64-linux-gnu/libboost_regex.so.1.71.0;debug;debug;debug;debug;debug;debug
-- Could NOT find MKL (missing: MKL_INCLUDE_DIR MKL_LIBRARIES)
-- Found Eigen version: 3.3.7
CMake Error at wrap/CMakeLists.txt:32 (target_link_libraries):
The "debug" argument must be followed by a library.
-- Configuring incomplete, errors occurred!
See also "/home/isp/Downloads/gtsam-4.0.2/build/CMakeFiles/CMakeOutput.log".
See also "/home/isp/Downloads/gtsam-4.0.2/build/CMakeFiles/CMakeError.log".
I have found a similar issue in the thread https://github.com/borglab/gtsam/issues/120 , which the contributor states that its not an issue with gtsam, but a permission issue. I'm not entirely sure what this refers to, but I tried to run it under sudo and still no such luck.
CmakeError.log:
Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /home/isp/Downloads/gtsam-4.0.2/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_97e14/fast && /usr/bin/make -f CMakeFiles/cmTC_97e14.dir/build.make CMakeFiles/cmTC_97e14.dir/build
make[1]: Entering directory '/home/isp/Downloads/gtsam-4.0.2/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_97e14.dir/src.c.o
/usr/bin/cc -DCMAKE_HAVE_LIBC_PTHREAD -o CMakeFiles/cmTC_97e14.dir/src.c.o -c /home/isp/Downloads/gtsam-4.0.2/build/CMakeFiles/CMakeTmp/src.c
Linking C executable cmTC_97e14
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_97e14.dir/link.txt --verbose=1
/usr/bin/cc -DCMAKE_HAVE_LIBC_PTHREAD -rdynamic CMakeFiles/cmTC_97e14.dir/src.c.o -o cmTC_97e14
/usr/bin/ld: CMakeFiles/cmTC_97e14.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_97e14.dir/build.make:87: cmTC_97e14] Error 1
make[1]: Leaving directory '/home/isp/Downloads/gtsam-4.0.2/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_97e14/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: /home/isp/Downloads/gtsam-4.0.2/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_1c5cf/fast && /usr/bin/make -f CMakeFiles/cmTC_1c5cf.dir/build.make CMakeFiles/cmTC_1c5cf.dir/build
make[1]: Entering directory '/home/isp/Downloads/gtsam-4.0.2/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_1c5cf.dir/CheckFunctionExists.c.o
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_1c5cf.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.16/Modules/CheckFunctionExists.c
Linking C executable cmTC_1c5cf
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_1c5cf.dir/link.txt --verbose=1
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -rdynamic CMakeFiles/cmTC_1c5cf.dir/CheckFunctionExists.c.o -o cmTC_1c5cf -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_1c5cf.dir/build.make:87: cmTC_1c5cf] Error 1
make[1]: Leaving directory '/home/isp/Downloads/gtsam-4.0.2/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_1c5cf/fast] Error 2
Asked by bc524 on 2023-02-16 02:55:58 UTC
Comments
While gtsam is certainly used by certain ROS packages, it's not a ROS package itself, nor does your question appear to be ROS related.
I would advise you to post your question somewhere else. ROS Answers isn't really meant to be a generic software forum.
Asked by gvdhoorn on 2023-02-16 03:09:13 UTC