Search code examples
c++boostcmakeyocto

yocto image with boost 1.77: libboost_atomic.so is not on image, but is in sdk


I have an aarch64 based yocto image, and it contains also an app that I compile as a package and that app uses and links with boost 1.77 and uses boost::filesystem using cmake. The app on the image works and everything is ok.

The problem I have is: I also generated the SDK part for yocto, and that SDK contains all boost libraries, also ones that are not on the image, for example libboost_atomic.so. And when I externally compile my app using the SDK, then it links also to libboost_atomic.so.

But of course, it's not on the image, so I can't run it on my device because it does not find the atomic lib at runtime. So how should I solve this problem? The libboost_atomic.so library does not really seem to be needed, but the sdk thinks it does.

I am using yocto Honister.


Solution

  • I found the problem: for the SDK, I use a cmake toolchain file, and so that file did not contain a linker option that yocto uses: -Wl,--as-needed

    So using that option, the linker is not linking to libboost_atomic.so anymore and I can run my sdk-compiled version on the image!