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

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



src/wp3_driver.cpp
)
${catkin_LIBRARIES} )  I can even see the package being built before in the terminal : 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 close merge delete ## 2 Answers Sort by » oldest newest most voted 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}
)

more

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?

( 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?

( 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).

( 2019-03-29 10:35:38 -0600 )edit

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

more

1

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

( 2018-11-08 01:57:07 -0600 )edit