Ensure CMAKE install directory matches link search directory#558
Ensure CMAKE install directory matches link search directory#558hori985 wants to merge 1 commit into
Conversation
Signed-off-by: hori985h <horiapaulas@gmail.com>
|
Interesting, I am on Arch, and I never saw this problem. |
It happens to me on Fedora, idk if it's just my machine being crazy, but I was guessing that it's not such a bad idea to hardcode install dir since the linking is also hardcoded. 🤷 |
|
@pedro-alves-ferreira What do you think about this change? any risk of breaking the crates or application using them (gstreamer plugins, etc) |
KimonHoffmann
left a comment
There was a problem hiding this comment.
Isn't this the wrong way around to go about this?
The Rust bindings should search for the library where its is located according to the standards implied by the distribution, rather than forcing the library to be located at the location the bindings expect it at.
I think this is fine. |
@KimonHoffmann This is only used when building the bindings and running the Rust applications in "development mode", that is, when the MXL SDK is not installed. In runtime, it will load libmxl.so from the system-defined ld path. We are not hardcoding the RPATH. |
KimonHoffmann
left a comment
There was a problem hiding this comment.
Thanks for the clarification @pedro-alves-ferreira.
Looks good to me then.
Details
On Linux distributions that default to
lib64for 64-bit libraries (Fedora, RHEL, openSUSE, Arch), CMake installslibmxl.sounderout/lib64while themxl-sysbuild script unconditionally emitscargo:rustc-link-search=.../out/lib, causing the linker to fail with unable to find library-lmxl.This fix explicitly sets
CMAKE_INSTALL_LIBDIR=libin the CMake invocation, ensuring the install path and the link search path always agree regardless of system defaults.Changed:
rust/mxl-sys/build.rs: added.define("CMAKE_INSTALL_LIBDIR", "lib")to thecmake::ConfigbuilderBackport requirements
This is a build system bug affecting any
lib64-defaulting distro. Recommend backporting to all supported release branches.