-
Notifications
You must be signed in to change notification settings - Fork 19
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
CMake install tests failing when using dependend libraries #155
Comments
An RPATH issue, I suppose. Or rather, a RUNPATH issue. RPATH propagates from the executable to the shared libraries, but RUNPATH does not. And there was also something with the Ubuntu linker being patched to use RUNPATH by default, as opposed to the usual RPATH by default. |
On Windows, the DLLs have to be in the search path, and there's nothing CMake can do about it, as there's no RPATH equivalent there (as far as I know). |
I was able to fix that for the subdir tests using However the install tests are still failing on Ubuntu and Windows. |
So we probably need to set LD_LIBRARY_PATH (Linux) or PATH (Windows) for the CI tests. |
I think that Timer is a good Guinea pig because it uses Chrono. Interestingly, the only place I see where a path is set is here: https://github.com/boostorg/timer/blob/9ee4c9cd9dec4f4ab5c38ffb9cb9978427916ee0/.github/workflows/ci.yml#L323 The rest of GHA and Appveyor seems to not need it for some reason. |
I think you misunderstood: I already have Boost.Locale to "play with". I wanted to fix and test this in Boost.CI for others to benefit. I.e. I need a shared Boost library which should be very small, i.e. few dependencies and fast to build which I can add here: https://github.com/boostorg/boost-ci/blob/master/CMakeLists.txt So basically recreate the issue using
That is the only place where the described situation appears: Consume the installed Boost library(ies). Works:
Doesn't work (needs the path-setting):
For the case(s) where the tests are build alongside Boost it works because all binaries (executables and DLLs) are put into the same folder which is in the "search path" on all platforms. |
As the dependency you can use Chrono (like Timer does) or e.g. Atomic. Chrono is more stable because it's in maintenance mode. |
Another possible reason for things working except in install scenarios is that both CMake and b2 clear the rpath when installing shared libraries. |
I was hoping for something with less dependencies. Chrono has 15 direct dependencies and Atomic has 8. All of them need to be cloned, which takes CI time. But might use Chrono anyway...
Possible, but mostly it is the usage of |
Nothing lighter than Atomic in https://pdimov.github.io/boostdep-report/develop/module-weights.html. My go-to compiled library was System but it's only nominally compiled now so it can't be used for testing.
I don't set the output directory in https://github.com/boostorg/timer/blob/develop/test/cmake_subdir_test/CMakeLists.txt though. |
Convert the header-only library to a compiled library which additionally depends (privately) on another compiled library (Boost.Atomic chosen as it has few other dependencies). This reproduces the runtime link failure of #155 when compiling shared libraries.
But it doesn't has Windows tests and the failures on Ubuntu might be something else or maybe something has changed since the last run. |
Convert the header-only library to a compiled library which additionally depends (privately) on another compiled library (Boost.Atomic chosen as it has few other dependencies). This reproduces the runtime link failure of #155 when compiling shared libraries.
Convert the header-only library to a compiled library which additionally depends (privately) on another compiled library (Boost.Atomic chosen as it has few other dependencies). This reproduces the runtime link failure of #155 when compiling shared libraries.
I tried Boost.CI on Boost.Locale where a test binary links against
Boost::locale
which privately links againstBoost::thread
.This fails on some platforms, e.g. Ubuntu 20.04 as the Boost.Thread library cannot be found. See e.g. https://github.com/Flamefire/locale/runs/6047122561?check_suite_focus=true
But the library is installed:
Also on Windows the test also fails likely due to the same reason:
It looks like we'd need to add the library install path to
LD_LIBRARY_PATH
on Linux and something similar on Windows (PATH
?) although I feel like this is something which should be handled by CMake but isn't.Would be good if we could fix that "by default" in the Boost.CI samples.
@pdimov Any ideas?
The text was updated successfully, but these errors were encountered: