Ask Your Question
3

How can the appropriate version of a shared library from a Yocto recipe be connected?

asked 2023-06-19 13:30:02 +0000

djk gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2023-06-19 13:38:01 +0000

plato gravatar image

To connect the appropriate version of a shared library from a Yocto recipe, one can:

  1. Include the shared library in the recipe by adding it to the recipe's FILES variable.

  2. Set the library's version using the PN-${PV} variable. For example, PN-${PV}.so.1.

  3. Use the pkg-config tool to locate and link against the library.

  4. Specify the library's path in the linker flags using the -L option, and the library's name using the -l option.

For example, if the shared library is named libfoo.so.1, and its Yocto recipe installs it to /usr/lib, one can connect to it by including these flags in a CMake target:

add_executable(my_target my_source.cpp)
target_link_libraries(my_target
    -L/usr/lib
    -lfoo
)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-19 13:30:02 +0000

Seen: 20 times

Last updated: Jun 19 '23