depthai-ros icon indicating copy to clipboard operation
depthai-ros copied to clipboard

CMake error on depthai-core install

Open jonathanleinola opened this issue 3 years ago • 18 comments

Hi,

i'm getting this kind of error: [14442C1051280AD100] [56.542] [system] [info] PRINT:LeonMss: Called by: LRT, controller: LOS [14442C1051280AD100] [56.629] [system] [error] Attempted to start Mono Left camera - NOT detected! [14442C1051280AD100] [56.629] [system] [error] Attempted to start Mono Right camera - NOT detected!

Do you have any ideas on how to solve this?

Kindly, Jonathan

jonathanleinola avatar Oct 21 '21 19:10 jonathanleinola

Do you have OAK-D or OAK-1 ?

saching13 avatar Oct 21 '21 19:10 saching13

OAK-D

jonathanleinola avatar Oct 21 '21 19:10 jonathanleinola

Does python depth example works? And if yes can you share the details of which depthai version is used there?

saching13 avatar Oct 21 '21 19:10 saching13

Yup, it works. Where to get the depthai version details?

jonathanleinola avatar Oct 21 '21 19:10 jonathanleinola

I went through this tutorial: https://github.com/luxonis/depthai-ros/blob/noetic-devel/README.md. The only difference was that I had to clone ros2-lux-d-lite_bringup branch of the depthai-core, since the other ros2 branch was not working. Might that be the reason?

jonathanleinola avatar Oct 21 '21 20:10 jonathanleinola

I went through this tutorial: https://github.com/luxonis/depthai-ros/blob/noetic-devel/README.md. The only difference was that I had to clone ros2-lux-d-lite_bringup branch of the depthai-core, since the other ros2 branch was not working. Might that be the reason?

Yes. that branch is for lite. it won't work for OAK-D. you need to install ros2 branch only. what was the issue with ros2 branch ?

saching13 avatar Oct 21 '21 22:10 saching13

Hmm, sorry for the delay. It just won't build. It gives me this error: "OpenCV and required libraries (opencv_core;opencv_imgproc) found. OpenCV Support enabled -- BUILD_DATETIME: 2021-10-25 15:50:08 +0000, BUILD_COMMIT: 5236690197390d743f097f788e546d14baa62a5a, BUILD_COMMIT_DATETIME: 2021-10-25 12:43:13 +0200 -- Configuring incomplete, errors occurred!"

Also, these failed: -- Performing Test FLAG_-Wduplicated-branches - Failed -- Performing Test FLAG_-Werror=self-assign-field - Failed -- Performing Test FLAG_-Werror=unused-lambda-capture - Failed

kindly, Jonathan

jonathanleinola avatar Oct 25 '21 15:10 jonathanleinola

@jonathanleinola Can you provide the whole CMake output? These tests are just for optionally setting available warning flags and don't relate much to configuration issues.

themarpe avatar Oct 25 '21 16:10 themarpe

Sure, that CmakeError.log output:

Determining if the pthread_create exist failed with the following output:
Change Dir: /tmp/depthai-core/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_20f22/fast"
/usr/bin/make -f CMakeFiles/cmTC_20f22.dir/build.make CMakeFiles/cmTC_20f22.dir/build
make[1]: Entering directory '/tmp/depthai-core/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_20f22.dir/CheckSymbolExists.c.o
/usr/bin/cc -DcmTC_20f22_EXPORTS  -fPIE   -o CMakeFiles/cmTC_20f22.dir/CheckSymbolExists.c.o   -c /tmp/depthai-core/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTC_20f22
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_20f22.dir/link.txt --verbose=1
/usr/bin/cc      -Wl,--export-dynamic -rdynamic CMakeFiles/cmTC_20f22.dir/CheckSymbolExists.c.o  -o cmTC_20f22 
CMakeFiles/cmTC_20f22.dir/CheckSymbolExists.c.o: In function `main':
CheckSymbolExists.c:(.text+0x1b): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_20f22.dir/build.make:97: recipe for target 'cmTC_20f22' failed
make[1]: *** [cmTC_20f22] Error 1
make[1]: Leaving directory '/tmp/depthai-core/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_20f22/fast' failed
make: *** [cmTC_20f22/fast] Error 2

File /tmp/depthai-core/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>

int main(int argc, char** argv)
{
  (void)argv;
#ifndef pthread_create
  return ((int*)(&pthread_create))[argc];
#else
  (void)argc;
  return 0;
#endif
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /tmp/depthai-core/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_da423/fast"
/usr/bin/make -f CMakeFiles/cmTC_da423.dir/build.make CMakeFiles/cmTC_da423.dir/build
make[1]: Entering directory '/tmp/depthai-core/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_da423.dir/CheckFunctionExists.c.o
/usr/bin/cc -DcmTC_da423_EXPORTS  -DCHECK_FUNCTION_EXISTS=pthread_create -fPIE   -o CMakeFiles/cmTC_da423.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-3.10/Modules/CheckFunctionExists.c
Linking C executable cmTC_da423
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_da423.dir/link.txt --verbose=1
/usr/bin/cc  -DCHECK_FUNCTION_EXISTS=pthread_create    -Wl,--export-dynamic -rdynamic CMakeFiles/cmTC_da423.dir/CheckFunctionExists.c.o  -o cmTC_da423 -lpthreads 
/usr/bin/x86_64-linux-gnu-ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_da423.dir/build.make:97: recipe for target 'cmTC_da423' failed
make[1]: *** [cmTC_da423] Error 1
make[1]: Leaving directory '/tmp/depthai-core/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_da423/fast' failed
make: *** [cmTC_da423/fast] Error 2


Performing C++ SOURCE FILE Test FLAG_-Wduplicated-branches failed with the following output:
Change Dir: /tmp/depthai-core/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_07208/fast"
/usr/bin/make -f CMakeFiles/cmTC_07208.dir/build.make CMakeFiles/cmTC_07208.dir/build
make[1]: Entering directory '/tmp/depthai-core/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_07208.dir/src.cxx.o
/usr/bin/c++  -DcmTC_07208_EXPORTS  -DFLAG_-Wduplicated-branches -fPIE   -Wduplicated-branches -o CMakeFiles/cmTC_07208.dir/src.cxx.o -c /tmp/depthai-core/build/CMakeFiles/CMakeTmp/src.cxx
c++: error: unrecognized command line option '-Wduplicated-branches'; did you mean '-Wduplicated-cond'?
CMakeFiles/cmTC_07208.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_07208.dir/src.cxx.o' failed
make[1]: *** [CMakeFiles/cmTC_07208.dir/src.cxx.o] Error 1
make[1]: Leaving directory '/tmp/depthai-core/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_07208/fast' failed
make: *** [cmTC_07208/fast] Error 2

Source file was:
int main() { return 0; }
Performing C++ SOURCE FILE Test FLAG_-Werror=self-assign-field failed with the following output:
Change Dir: /tmp/depthai-core/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_f8e94/fast"
/usr/bin/make -f CMakeFiles/cmTC_f8e94.dir/build.make CMakeFiles/cmTC_f8e94.dir/build
make[1]: Entering directory '/tmp/depthai-core/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_f8e94.dir/src.cxx.o
/usr/bin/c++  -DcmTC_f8e94_EXPORTS  -DFLAG_-Werror=self-assign-field -fPIE   -Werror=self-assign-field -o CMakeFiles/cmTC_f8e94.dir/src.cxx.o -c /tmp/depthai-core/build/CMakeFiles/CMakeTmp/src.cxx
cc1plus: error: -Werror=self-assign-field: no option -Wself-assign-field
CMakeFiles/cmTC_f8e94.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_f8e94.dir/src.cxx.o' failed
make[1]: *** [CMakeFiles/cmTC_f8e94.dir/src.cxx.o] Error 1
make[1]: Leaving directory '/tmp/depthai-core/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_f8e94/fast' failed
make: *** [cmTC_f8e94/fast] Error 2

Source file was:
int main() { return 0; }
Performing C++ SOURCE FILE Test FLAG_-Werror=unused-lambda-capture failed with the following output:
Change Dir: /tmp/depthai-core/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_67168/fast"
/usr/bin/make -f CMakeFiles/cmTC_67168.dir/build.make CMakeFiles/cmTC_67168.dir/build
make[1]: Entering directory '/tmp/depthai-core/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_67168.dir/src.cxx.o
/usr/bin/c++  -DcmTC_67168_EXPORTS  -DFLAG_-Werror=unused-lambda-capture -fPIE   -Werror=unused-lambda-capture -o CMakeFiles/cmTC_67168.dir/src.cxx.o -c /tmp/depthai-core/build/CMakeFiles/CMakeTmp/src.cxx
cc1plus: error: -Werror=unused-lambda-capture: no option -Wunused-lambda-capture
CMakeFiles/cmTC_67168.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_67168.dir/src.cxx.o' failed
make[1]: *** [CMakeFiles/cmTC_67168.dir/src.cxx.o] Error 1
make[1]: Leaving directory '/tmp/depthai-core/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_67168/fast' failed
make: *** [cmTC_67168/fast] Error 2

Source file was:
int main() { return 0; }

jonathanleinola avatar Oct 25 '21 16:10 jonathanleinola

This is for the CmakeOutput.log: https://pastebin.com/dvuMAGGX

jonathanleinola avatar Oct 25 '21 16:10 jonathanleinola

@jonathanleinola Can you also send over the output of running the CMake command (the configuration part, where that part of above message was printed)

themarpe avatar Oct 25 '21 17:10 themarpe

Oh, do you mean this?: https://pastebin.com/13f4pKVY

jonathanleinola avatar Oct 25 '21 19:10 jonathanleinola

Short update: seems that the cmake version was too low. Ubuntu 18.04 ships with cmake-3.10.2 and I upgraded that to cmake version 3.21.3. I hope it wont mess up the ROS, but now it seems to work!

jonathanleinola avatar Oct 25 '21 19:10 jonathanleinola

ROS melodic ships with cmake-3.10.2 and it shouldn't affect the build. Here is conversation with fix added to the repo for melodic

And CI is also building fine for melodic.

saching13 avatar Oct 25 '21 20:10 saching13

Interesting. I just went here: https://github.com/luxonis/depthai-core/tree/ros2-main-gen2 and saw the cmake>= 3.4 dependency requirement. But now it works with cmake 3.21.3 :)

jonathanleinola avatar Oct 25 '21 20:10 jonathanleinola

@jonathanleinola thanks for the log:

CMake Error at /home/jonathan/.hunter/_Base/062a19a/32dd29e/14f9c50/Install/lib/cmake/ZLIB/ZLIBConfig.cmake:36 (add_library):
  add_library cannot create ALIAS target "ZLIB::ZLIB" because target
  "ZLIB::zlib" is IMPORTED.

This was the main issue - and was also just fixed the other day by a similar report on Ubuntu 18.04: https://github.com/luxonis/depthai-core/pull/237

We also build for CMake 3.10.2 in CI now, so this is the actually tested minimal CMake version to be able to rely upon (could go lower, but might not work)

@saching13 can you update documentation on you end as well, pointing to this "minimal" CMake version?

themarpe avatar Oct 26 '21 14:10 themarpe

@jonathanleinola thanks for the log:

CMake Error at /home/jonathan/.hunter/_Base/062a19a/32dd29e/14f9c50/Install/lib/cmake/ZLIB/ZLIBConfig.cmake:36 (add_library):
  add_library cannot create ALIAS target "ZLIB::ZLIB" because target
  "ZLIB::zlib" is IMPORTED.

This was the main issue - and was also just fixed the other day by a similar report on Ubuntu 18.04: luxonis/depthai-core#237

We also build for CMake 3.10.2 in CI now, so this is the actually tested minimal CMake version to be able to rely upon (could go lower, but might not work)

@saching13 can you update documentation on you end as well, pointing to this "minimal" CMake version?

Sure. But depthai-core installation steps in depthai-ros takes into consideration of CMake 3.10.2. And I also have a CI running for Melodic and Ubuntu 18.04 which install depthaic-core and builds the depthai-ros on top of it without issues.

saching13 avatar Oct 26 '21 17:10 saching13

@saching13 this breaking change was introduced in 2.11.0 AFAIK, so might be the case that ROS wasn't targeting that yet? Otherwise maybe ROS has slightly tweaked CMake? (although not sure about this one)

themarpe avatar Oct 26 '21 19:10 themarpe

Fixed in newer depthai-core

saching13 avatar Nov 09 '22 02:11 saching13