long paths causing broken RPATH parameters
I'm using CMake 3.28
I've been tracking down a build error only seen in our regression system. I initially was unable to reproduce the issue on my local machine.
However by moving my conan cache to a location with a longer path, I was finally able to reproduce the same build failures as seen on the regression machine.
The build failure was due to missing symbols in the final link stage of the project's executable:
/bin/ld: warning: libfmt.so.8, needed by lib/libA.so, not found (try using -rpath or -rpath-link)
.../libfoo.so: undefined reference to "fmt::v8::detail::basic_data<void>::right_padding_shifts"
looking at the generated build.ninja You can see that the -rpath
parameter is missing paths to the external libraries in the LINK_LIBRARIES:
regression build.ninja:
LINK_LIBRARIES = -Wl,-rpath,"\$$ORIGIN/../lib64::" -lpthread -ldl lib/libA.so lib/libB.so lib/libC.so
local build.ninja:
LINK_LIBRARIES = -Wl,-rpath,"\$$ORIGIN/../lib64:::/..../.conan/data/libfmt/.../package/ab94ba2e1b6f777bcd2c8f381c6e9fd553273f1d/lib"
Both builds also link to the libfmt.so using their full path, I won't show the paths, but their path sizes (in characters) are:
regression path length: **426**
local path length: **247**
By increasing the length of the conan cache of my local dir to 526 characters, I was able to break my build with the above error.
I have ensured that the external libraries exist in the conan cache, I also ensured that the CMake module files that Conan generates are exactly the same between the two builds, except for the variable fmt_PACKAGE_FOLDER_RELEASE
that is defined. So I don't think Conan should be the source of any issues.
This looks like the long path to an external library is preventing the RPATH to be properly set. Is there a known limit?