larics / cartographer_superbuild

Apache License 2.0
79 stars 35 forks source link

Cannot build in CLion #2

Open wuhy08 opened 5 years ago

wuhy08 commented 5 years ago

Hi,

I was trying to build the code in CLion. However, it gives me the following errors:

/opt/clion-2018.3.2/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -G "CodeBlocks - Unix Makefiles" /home/wd-ai/catkin_ws_debug/src/cartographer_superbuild
-- Build type: RelWithDebInfo
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   iostreams
--   regex
-- Found installed version of Eigen: /usr/local/share/eigen3/cmake
-- Found required Ceres dependency: Eigen version 3.3.5 in /usr/local/include/eigen3
-- Found required Ceres dependency: glog
-- Found required Ceres dependency: gflags
-- Found Ceres version: 2.0.0 installed in: /usr/local with components: [EigenSparse, SparseLinearAlgebraLibrary, LAPACK, SuiteSparse, CXSparse, SchurSpecializations]
-- Using CATKIN_DEVEL_PREFIX: /home/wd-ai/catkin_ws_debug/src/cartographer_superbuild/cmake-build-relwithdebinfo/devel
-- Using CMAKE_PREFIX_PATH: /home/wd-ai/catkin_ws/devel;/opt/ros/kinetic
-- This workspace overlays: /home/wd-ai/catkin_ws/devel;/opt/ros/kinetic
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/wd-ai/catkin_ws_debug/src/cartographer_superbuild/cmake-build-relwithdebinfo/test_results
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.14
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- cartographer_ros_msgs: 15 messages, 6 services
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   system
--   iostreams
--   regex
-- Eigen found (include: /usr/local/include/eigen3, version: 3.3.5)
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   system
--   filesystem
--   thread
--   date_time
--   iostreams
--   serialization
--   chrono
--   atomic
--   regex
-- looking for PCL_COMMON
-- Build type: RelWithDebInfo
-- Using CATKIN_DEVEL_PREFIX: /home/wd-ai/catkin_ws_debug/src/cartographer_superbuild/cmake-build-relwithdebinfo/devel
-- Using CMAKE_PREFIX_PATH: /home/wd-ai/catkin_ws/devel;/opt/ros/kinetic
-- This workspace overlays: /home/wd-ai/catkin_ws/devel;/opt/ros/kinetic
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/wd-ai/catkin_ws_debug/src/cartographer_superbuild/cmake-build-relwithdebinfo/test_results
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.14
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   system
--   iostreams
--   regex
-- Build type: RelWithDebInfo
-- Using CATKIN_DEVEL_PREFIX: /home/wd-ai/catkin_ws_debug/src/cartographer_superbuild/cmake-build-relwithdebinfo/devel
-- Using CMAKE_PREFIX_PATH: /home/wd-ai/catkin_ws/devel;/opt/ros/kinetic
-- This workspace overlays: /home/wd-ai/catkin_ws/devel;/opt/ros/kinetic
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/wd-ai/catkin_ws_debug/src/cartographer_superbuild/cmake-build-relwithdebinfo/test_results
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.14
CMake Error at cmake-build-relwithdebinfo/devel/share/cartographer_ros/cmake/cartographer_rosConfig.cmake:148 (message):
  Project 'cartographer_rviz' tried to find library '-lpthread'.  The library
  is neither a target nor built/installed properly.  Did you compile project
  'cartographer_ros'? Did you find_package() it before the subdirectory
  containing its code is included?
Call Stack (most recent call first):
  /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:76 (find_package)
  cartographer_ros/cartographer_rviz/CMakeLists.txt:39 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/wd-ai/catkin_ws_debug/src/cartographer_superbuild/cmake-build-relwithdebinfo/CMakeFiles/CMakeOutput.log".
See also "/home/wd-ai/catkin_ws_debug/src/cartographer_superbuild/cmake-build-relwithdebinfo/CMakeFiles/CMakeError.log".

[Finished]

The build works in the command line but not in CLion. Can you help me?

Thank you!

ojura commented 5 years ago

It‘s a bug with CMake 3.13 bundled with CLion and Catkin, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=915148.

Try setting CLion to use the lower version system CMake, or apply this to your Catkin install: https://github.com/ros/catkin/pull/975/files

RenzhiDuan commented 5 years ago

Much thanks! I've met the same problem and setting CLion to use a lower version system CMake works for me. I'm using ubuntu 16.04, and the system CMake is 3.5.1, whose executable file is located in /usr/bin.

The detailed operation for reference is: in CLion, File --- Settings --- Build, Execution, Deployment --- Toolchains, firstly push the "+" button to create a new toolchain setting called "System", alongside the origin "Default". And in this new "System" toolchain, set the "CMake:" as "Custom CMake Executable" and select the cmake binary from /usr/bin. The make and following C/C++ compilers should be automatically detected.

Save this new toolchain, and come to File --- Settings --- Build, Execution, Deployment ---CMake. After the Build type (which should be RelWithDebInfo as instructed), select the toolchain as newly created "System".

Apply the above operations and the whole system works fine.

Besides, I've also noticed that, if CLion is installed in /opt, this project may not be properly compiled because of the permission issue. But after reinstalling CLion to /home and configure the CMake toolchain to a lower version, everything works fine.

wyq0721 commented 5 years ago

Much thanks! I've met the same problem and setting CLion to use a lower version system CMake works for me. I'm using ubuntu 16.04, and the system CMake is 3.5.1, whose executable file is located in /usr/bin.

The detailed operation for reference is: in CLion, File --- Settings --- Build, Execution, Deployment --- Toolchains, firstly push the "+" button to create a new toolchain setting called "System", alongside the origin "Default". And in this new "System" toolchain, set the "CMake:" as "Custom CMake Executable" and select the cmake binary from /usr/bin. The make and following C/C++ compilers should be automatically detected.

Save this new toolchain, and come to File --- Settings --- Build, Execution, Deployment ---CMake. After the Build type (which should be RelWithDebInfo as instructed), select the toolchain as newly created "System".

Apply the above operations and the whole system works fine.

Besides, I've also noticed that, if CLion is installed in /opt, this project may not be properly compiled because of the permission issue. But after reinstalling CLion to /home and configure the CMake toolchain to a lower version, everything works fine.

I fixed the problem above, but i got another ( i have same environment with yours):

CMake Error in cartographer/CMakeLists.txt:
  Specified unknown feature "cxx_std_11" for target
  "cartographer.transform.transform_interpolation_buffer_test".

CMake Error in cartographer/CMakeLists.txt:
  Specified unknown feature "cxx_std_11" for target
  "cartographer.transform.timestamped_transform_test".
....

that means i have too older version of cmake?

UPDATE: I have updated my cmake to 3.8.1 (this version supports C++11) and the problem above is fixed. However, I got anthoer problem again. Luckily, I found the solution according the https://github.com/arvidn/libtorrent/issues/3101#issue-331122261

foreverlms commented 4 years ago

It‘s a bug with CMake 3.13 bundled with CLion and Catkin, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=915148.

Try setting CLion to use the lower version system CMake, or apply this to your Catkin install: https://github.com/ros/catkin/pull/975/files

Hi, thanks for the link you provided. May I ask how to apply those changes to my catkin install? I have already had catkin installed.

zhoupengwei commented 4 years ago

Dear I was trying to run cmake ../ to generate build, I get this problem. CMake Error in cartographer/CMakeLists.txt: Target "cartographer" INTERFACE_INCLUDE_DIRECTORIES property contains path:

"/home/zpw/cartographer_superbuild/cartographer/"

which is prefixed in the source directory.

can you find some solution?

liaozihang commented 3 years ago

Dear I was trying to run cmake ../ to generate build, I get this problem. CMake Error in cartographer/CMakeLists.txt: Target "cartographer" INTERFACE_INCLUDE_DIRECTORIES property contains path:

"/home/zpw/cartographer_superbuild/cartographer/"

which is prefixed in the source directory.

can you find some solution?

remove the following statement

install(

EXPORT CartographerExport

DESTINATION share/cartographer/cmake/

FILE CartographerTargets.cmake

)