Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools/class_loader produces broken class_loader.pc #196

Open
moooeeeep opened this issue Oct 14, 2021 · 3 comments
Open

tools/class_loader produces broken class_loader.pc #196

moooeeeep opened this issue Oct 14, 2021 · 3 comments

Comments

@moooeeeep
Copy link

moooeeeep commented Oct 14, 2021

When I build tools/class_loader, the installed class_loader.pc seems to be broken.

Probably this is a cmake issue. It seems to configure the dependencies as a semicolon-separated string, instead of space-separated string. On Ubuntu 20.04 it additionally writes the cmake target aliases instead of the actual libraries.

Output on Ubuntu 18.04:

prefix=/path/to/ws/install/tools/class_loader
exec_prefix=/path/to/ws/install/tools/class_loader
libdir=${prefix}/lib
includedir=${prefix}/include

Name: class_loader
Description: "Package for loading plugins at runtime"
Version: 
Requires: console_bridge 
Libs: -L${libdir} -lclass_loader /usr/lib/x86_64-linux-gnu/libboost_thread.so;/usr/lib/x86_64-linux-gnu/libboost_system.so;/usr/lib/x86_64-linux-gnu/libboost_chrono.so;/usr/lib/x86_64-linux-gnu/libboost_date_time.so;/usr/lib/x86_64-linux-gnu/libboost_atomic.so;/usr/lib/x86_64-linux-gnu/libpthread.so;/path/to/ws/install/base/logging/lib/libbase-logging.so;/usr/lib/libPocoFoundation.so;dl
Cflags: -I${includedir} 

Output on Ubuntu 20.04:

prefix=/path/to/ws/install/tools/class_loader
exec_prefix=/path/to/ws/install/tools/class_loader
libdir=${prefix}/lib
includedir=${prefix}/include

Name: class_loader
Description: "Package for loading plugins at runtime"
Version: 
Requires: console_bridge 
Libs: -L${libdir} -lclass_loader Boost::thread;Boost::system;/path/to/ws/install/base/console_bridge/lib/libconsole_bridge.so;/path/to/ws/install/base/logging/lib/libbase-logging.so;/usr/lib/x86_64-linux-gnu/libPocoFoundation.so;dl
Cflags: -I${includedir} 

Expected output (or similar):

prefix=/path/to/ws/install/tools/class_loader
exec_prefix=/path/to/ws/install/tools/class_loader
libdir=${prefix}/lib
includedir=${prefix}/include

Name: class_loader
Description: "Package for loading plugins at runtime"
Version: 
Requires: console_bridge 
Libs: -L${libdir} -lclass_loader /usr/lib/x86_64-linux-gnu/libboost_thread.so /usr/lib/x86_64-linux-gnu/libboost_system.so /usr/lib/x86_64-linux-gnu/libboost_chrono.so /usr/lib/x86_64-linux-gnu/libboost_date_time.so /usr/lib/x86_64-linux-gnu/libboost_atomic.so /usr/lib/x86_64-linux-gnu/libpthread.so /path/to/ws/install/base/console_bridge/lib/libconsole_bridge.so /path/to/ws/install/base/logging/lib/libbase-logging.so /usr/lib/x86_64-linux-gnu/libPocoFoundation.so dl
Cflags: -I${includedir}

For comparison, the version installed by my ROS distribution:

prefix=/opt/ros/melodic

Name: class_loader
Description: Description of class_loader
Version: 0.4.1
Cflags: -I${prefix}/include -I/usr/include
Libs: -L${prefix}/lib -lclass_loader /usr/lib/x86_64-linux-gnu/libboost_thread.so /usr/lib/x86_64-linux-gnu/libboost_system.so /usr/lib/x86_64-linux-gnu/libboost_chrono.so /usr/lib/x86_64-linux-gnu/libboost_date_time.so /usr/lib/x86_64-linux-gnu/libboost_atomic.so /usr/lib/x86_64-linux-gnu/libpthread.so /usr/lib/libPocoFoundation.so -ldl /usr/lib/x86_64-linux-gnu/libconsole_bridge.so.0.4
Requires: 
@skasperski
Copy link

I think i should be fixed after this PR: ros/class_loader#187

@moooeeeep
Copy link
Author

It doesn't seem to work like that. At least when I try this, it will still write the PKGCONFIG_LIBS separated by semicolons. Also, I think you would need to add -l if you specify the libs this way?

The aliases from Boost_LIBRARIES will not appear then though. But I'm not sure if I like that the exact libraries are spelled out there again.

moooeeeep added a commit to moooeeeep/class_loader that referenced this issue Oct 14, 2021
moooeeeep added a commit to moooeeeep/class_loader that referenced this issue Oct 14, 2021
@moooeeeep
Copy link
Author

moooeeeep commented Oct 14, 2021

I have played around with the config myself, and this would be my suggestion: moooeeeep/class_loader@4adbad2

It seems to work even without forwarding all those dependencies to client code.

We might run into problems, when someone wants to link this statically, right? Related:

Related: generate a space separated string from the list: string(REPLACE ";" " " OUTPUT_VAR "${INPUT_VAR}")

Perspectively it may be a good idea to keep track with recent changes on the ROS2 branches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants