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

Issue with linking when build in yocto #12

Closed
sapoluri opened this issue Mar 9, 2021 · 2 comments
Closed

Issue with linking when build in yocto #12

sapoluri opened this issue Mar 9, 2021 · 2 comments

Comments

@sapoluri
Copy link

sapoluri commented Mar 9, 2021

I tried to include this package in meta-ros2-foxy by adding yocto recipes and compile it.
However, it fails with the following:
CMakeFiles/gscam_main.dir/src/gscam_node.cpp.o: undefined reference to symbol 'gst_base_sink_get_type'
| ..../recipe-sysroot/usr/lib/libgstbase-1.0.so.0: error adding symbols: DSO missing from command line

I notice in the CMakeCache.txt that under the gscam_node_LIB_DEPENDS, I see gstapp-1.0.so but gstbase-1.0 and gstreamer-1.0 are missing. Which is causing the above error. However, gstbase-1.0 and gstreamer-1.0 are installed to the same location as gstapp-1.0 and the library files contain the above required symbol.

I am at a complete loss as to why this failure is happening and how to go about debugging this. I am neither a Yocto build expert nor a CMake expert but I have done all the due diligence I know how to, to ensure that all the libraries are available and the paths are set properly.

Can someone please help?!

@clydemcqueen
Copy link
Owner

The CMakeLists.txt file uses PkgConfig (not CMake) to find gstreamer libraries. I know little about PkgConfig, but the docs are here: https://people.freedesktop.org/~dbn/pkg-config-guide.html

This is building fine on my Ubuntu 20.04 install. If I understand the flow correctly, PkgConfig reads and parses gstreamer-app-1.0.pc, discovers a dependency on gstreamer-1.0 and gstreamer-base-1.0, so PkgConfig further reads and parses gstreamer-base-1.0.pc. There the library gstbase-1.0 is listed. These libraries are bound to the symbol GST_APP, and then the Ament macro ament_target_dependencies add those libraries to the call to target_link_libraries.

I don't know why this flow breaks in your build. I would look at the various *.pc files to see if the PkgConfig dependency chain is broken.

A brute force fix is to add the the library directly: target_link_libraries(gscam_node libgstbase-1.0.so).

You could also try pkg_check_modules(GSTBASE REQUIRED gstreamer-base-1.0) and then add GSTBASE to GSCAM_NODE_DEPS.

@sapoluri
Copy link
Author

sapoluri commented Mar 11, 2021

So I had already tried both the methods that you suggested prior to creating this issue and failed but I eventually did find a way to resolve the issue.

I added the following to the CMakeLists.txt:

target_link_libraries(gscam_main
libgstbase-1.0.so
libgstreamer-1.0.so
libgobject-2.0.so
libglib-2.0.so
)

I am not sure how the build works on ubuntu even though the explicitly link libraries for gscam_main are not specified.

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