0
$\begingroup$

Rosanswers logo

I am trying to migrate a project from Indigo to Jade. When I run catkin_make I get cannot find -l: errors (output below).

I am running ubuntu 15.04 and installed ROS Jade via the package manager. As it looks like it might be a problem with ld I am using version 2.25

The installation of ROS appears to be fine. I do not have the problem if I create a new project with subscribers and publishers like the ROS tutorials

Does anyone have any ideas?

$ catkin_make
Base path: /home/**/catkin_ws
Source space: /home/**/catkin_ws/src
Build space: /home/**/catkin_ws/build
Devel space: /home/**/catkin_ws/devel
Install space: /home/**/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/**/catkin_ws/build"
####
####
#### Running command: "make -j8 -l8" in "/home/**/catkin_ws/build"
####
...
...
[  6%] Linking CXX executable ../../../../bin/a1
Building CXX object ../../../CMakeFiles/f.dir/dt.cxx.o
[  6%] /usr/bin/ld: cannot find -l:/usr/lib/x86_64-linux-gnu/libboost_signals.so
/usr/bin/ld: cannot find -l:/usr/lib/x86_64-linux-gnu/libboost_filesystem.so
/usr/bin/ld: cannot find -l:/usr/lib/x86_64-linux-gnu/libboost_system.so
...
collect2: error: ld returned 1 exit status
../../../../CMakeFiles/sc.dir/build.make:119: recipe for target 'bin/sc' failed
make[2]: *** [bin/sc] Error 1
CMakeFiles/Makefile2:1648: recipe for target '../../../../CMakeFiles/sc.dir/all' failed
make[1]: *** [../../../../CMakeFiles/sc.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
...
...

All the libraries it mentions are installed. For example

$ apt-cache policy libboost-signals-dev 
libboost-signals-dev:
  Installed: 1.55.0.2
  Candidate: 1.55.0.2
  Version table:
 *** 1.55.0.2 0
        500 http://us.archive.ubuntu.com/ubuntu/ vivid/universe amd64 Packages
        100 /var/lib/dpkg/status

CMakeLists.txt

The package is split up into many sub directories. So what follows below is the main package CMakeLists and then an example of one of the sub directory packages that is failing

cmake_minimum_required(VERSION 2.8.3)
project(main)

find_package(catkin REQUIRED COMPONENTS message_generation rospy)

catkin_package(CATKIN_DEPENDS roscpp)

...

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC")

...

set(CMAKE_INCLUDE_CURRENT_DIR ON)

include_directories(
  ${CMAKE_CURRENT_SOURCE_DIR}
)

catkin_python_setup()

add_subdirectory(dir1)
add_subdirectory(dir2)
add_subdirectory(sc)
add_subdirectory(dir4)
add_subdirectory(dir5)

Example sub directory CMakeLists.txt. This is just one of many that are failing:

cmake_minimum_required(VERSION 2.4.6)
   
# Find ros dependencies...
include($ENV{ROS_ROOT}/core/rosbuild/FindPkgConfig.cmake)
pkg_check_modules(ros-roscpp REQUIRED roscpp)
pkg_check_modules(ros-cv_bridge REQUIRED cv_bridge)
pkg_check_modules(ros-image_transport REQUIRED image_transport)
   
set( sc_srcs
  main.cpp
  ScNode.cpp
  ${sc_moc_files} 
)

set( sc_hrs
  ScNode.h
)

# All ros libs are in the same directory
# so we just list one of them here
link_directories(
  ${ros-roscpp_LIBRARY_DIRS}
)

set( sc_libs
  ${ros-roscpp_LIBRARIES}
  ${ros-cv_bridge_LIBRARIES}
  ${ros-image_transport_LIBRARIES}
)

include_directories(
  ${ros-roscpp_conversions_INCLUDE_DIRS}
)

add_executable(sc ${sc_srcs} ${sc_hdrs})
target_link_libraries(sc ${sc_libs})
set_target_properties(sc PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

Originally posted by mhar on ROS Answers with karma: 36 on 2016-03-18

Post score: 1


Original comments

Comment by al-dev on 2016-03-18:
Did you try to install dependencies of your packages via rosdep update / rosdep install mypkg ?

Comment by mhar on 2016-03-18:
Yes I have - no joy there

Comment by al-dev on 2016-03-18:
Can you edit your post to include your CMakeLists.txt ?

Comment by mhar on 2016-03-18:
Sure, done

Comment by al-dev on 2016-03-18:
I am just a bit confused by your example package CMakeLists.txt, is it intended to be used by catkin ? It does not contain any catkin instructions. Usually linking your targets against ${catkin_LIBRARIES} does the job for a catkin package.. Did you say this compiled with catkin on Indigo?

Comment by gvdhoorn on 2016-03-19:
@al-dev: that is not the CMakeLists.txt from the package, but of the workspace itself. @mhar: @al-dev asked for the CMakeLists.txt of the package that's giving you problems.

Comment by mhar on 2016-03-19:
I think I've given you the right CMakeLists.txt now.
@al-dev yes it complies fine with catkin on Indigo - hopefully it makes more sense now

The project is split into sub directories - so I've given you the main project CMakeLists.txt and then one of the sub directories

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Problem solved

The problem is less to do with the upgrade from Indigo to Jade and more about the ld version. Our older build (indigo) is still using rosbuild package config definitions (pkg_check_modules(...). As the upgraded system uses a newer version of ld (version 2.25) these rosbuild definitions were breaking.

The problem was solved by using catkin

For example:

include($ENV{ROS_ROOT}/core/rosbuild/FindPkgConfig.cmake)
pkg_check_modules(ros-roscpp REQUIRED roscpp)
pkg_check_modules(ros-cv_bridge REQUIRED cv_bridge)
pkg_check_modules(ros-image_transport REQUIRED image_transport)

becomes

find_package(catkin REQUIRED COMPONENTS cv_bridge image_transport)

Further detail

The package config files provides paths to that are incompatible with newer versions of ld. In versions 2.25 and greater the Libs path, in the form -l:/full/path/to/library.so no longer works. Instead the newer version of ld expects the path in the form -l:library. More information can be found here: https://github.com/ros/catkin/issues/694

The problem has been resolved in some of the magic under catkin. In find_package(catkin..) catkin looks up the pkgconfig file and fixes the paths under Libs.


Originally posted by mhar with karma: 36 on 2016-03-31

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.