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. [closed]

asked 2023-02-16 01:55:58 -0500

bc524 gravatar image

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/issu... , 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 ...
(more)
edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant. Please see http://wiki.ros.org/Support for more details. by gvdhoorn
close date 2023-02-16 02:08:04.838323

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.

gvdhoorn gravatar image gvdhoorn  ( 2023-02-16 02:09:13 -0500 )edit