Ask Your Question
5

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

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

sumperfees gravatar image

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

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
2

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

updated 2016-06-16 05:22:44 -0600

You are trying to export a hypotetical library called ${PROJECT_NAME}. In your case it looks you have not any target or library called like the project name. Instead, in your case it looks you only have to export the library "wp3_driver_lib" that really does exit.

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 imagemoatilliatta ( 2016-10-13 07:51:26 -0600 )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 imagebluenote ( 2019-01-16 11:50:14 -0600 )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 imagelucasw ( 2019-03-29 10:35:38 -0600 )edit
3

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

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 imageTal ( 2018-11-08 01:57:07 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

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

Seen: 5,383 times

Last updated: Jun 18 '18