ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
7

"The library is neither a target nor built/installed properly"

asked 2016-06-16 05:04:53 -0500

sumperfees gravatar image

updated 2016-06-16 05:18:44 -0500

Hello, Hello I have a package called wp3_driver_pkg which builds without errors when I build it alone but when I'm trying to use it in another package (ur10) I have the following error :


  Project 'ur10' tried to find library 'wp3_driver_pkg'.  The library is
  neither a target nor built/installed properly.  Did you compile project
  'wp3_driver_pkg'? Did you find_package() it before the subdirectory
  containing its code is included?

The package wp3_driver_pkg has been added to the ur10 package.xml for build and run. and is called in the cmakefile.txt of the ur10:


find_package( wp3_driver_pkg REQUIRED)

This is the catkin_package() in the cmakefile.txt for the wp3_driver_pkg


catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME} wp3_driver_lib
CATKIN_DEPENDS message_runtime roscpp rospy roslib ${MSG_DEPS}
)

the wp3_driver_lib is a library added in the same cmakefile with the source file



 add_library(wp3_driver_lib
         src/wp3_driver.cpp
)
target_link_libraries(wp3_driver_lib
        ${catkin_LIBRARIES}
)

I can even see the package being built before in the terminal : image description

And if I use the command "rospack fin wp3_driver_pkg" just after the failed compilation and the package is found, even if I suppress the devel and build folder of the workspace.

Thanks for the answers if you see what I'm doing wrong !

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
3

answered 2016-06-16 05:20:18 -0500

updated 2022-11-16 12:24:19 -0500

You are trying to export a hypotetical library called ${PROJECT_NAME}. In your case it looks you don't have any target or library called ${PROJECT_NAME}. Instead, in your case you only have to export the library "wp3_driver_lib" that is the only artifact that really exits.

catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME} wp3_driver_lib
CATKIN_DEPENDS message_runtime roscpp rospy roslib ${MSG_DEPS}
)
edit flag offensive delete link more

Comments

1

I don't understand your answer. I have a similiar problem and I did it like you quoted it. But the proplem persists. Is there another command how to export the library?

moatilliatta gravatar image moatilliatta  ( 2016-10-13 07:51:26 -0500 )edit

Me neither. Isn't the code snippet posted in your answer exactly the same as the one in the question? What has to be changed?

bluenote gravatar image bluenote  ( 2019-01-16 11:50:14 -0500 )edit

I had to remove the LIBRARIES line entirely, I wasn't building anything named ${PROJECT_NAME} (or building anything conventionally at all, just messages for _msgs style package).

lucasw gravatar image lucasw  ( 2019-03-29 10:35:38 -0500 )edit
6

answered 2018-06-18 10:14:48 -0500

bergercookie gravatar image

I was getting the same kind of errors. After stripping the problem down to a very basic setup I found out that for some reason catkin doesn't like catkin_package being after add_library. If it is, you get these kind of errors.

add_library(a_library_name)
catkin_package(LIBRARIES a_library_name) # WRONG

catkin_package(LIBRARIES a_library_name) # CORRECT
add_library(a_library_name)
edit flag offensive delete link more

Comments

1

I had the same problem, and this is the actually the correct answer. The order does matter.

Tal gravatar image Tal  ( 2018-11-08 01:57:07 -0500 )edit

Excuse me, under which file did you change it?

luna wu gravatar image luna wu  ( 2021-12-01 21:03:19 -0500 )edit

This is about the package's CMakeLists.txt

bergercookie gravatar image bergercookie  ( 2021-12-09 04:54:34 -0500 )edit

Thanks, I tried, but still can't solve the problems

luna wu gravatar image luna wu  ( 2021-12-09 05:20:09 -0500 )edit

Question Tools

3 followers

Stats

Asked: 2016-06-16 05:04:53 -0500

Seen: 10,980 times

Last updated: Nov 16 '22