Skip to content

Ensure CMAKE install directory matches link search directory#558

Open
hori985 wants to merge 1 commit into
dmf-mxl:mainfrom
hori985:bugfix/force-cmake-install-lib-directory
Open

Ensure CMAKE install directory matches link search directory#558
hori985 wants to merge 1 commit into
dmf-mxl:mainfrom
hori985:bugfix/force-cmake-install-lib-directory

Conversation

@hori985

@hori985 hori985 commented Jun 12, 2026

Copy link
Copy Markdown

Details

On Linux distributions that default to lib64 for 64-bit libraries (Fedora, RHEL, openSUSE, Arch), CMake installs libmxl.so under out/lib64 while the mxl-sys build script unconditionally emits cargo:rustc-link-search=.../out/lib, causing the linker to fail with unable to find library -lmxl.
This fix explicitly sets CMAKE_INSTALL_LIBDIR=lib in 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 the cmake::Config builder

Backport requirements

This is a build system bug affecting any lib64-defaulting distro. Recommend backporting to all supported release branches.

Signed-off-by: hori985h <horiapaulas@gmail.com>
@hori985 hori985 closed this Jun 12, 2026
@hori985 hori985 reopened this Jun 12, 2026
@jonasohland

Copy link
Copy Markdown
Contributor

Interesting, I am on Arch, and I never saw this problem.

@jonasohland jonasohland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hori985

hori985 commented Jun 12, 2026

Copy link
Copy Markdown
Author

@jonasohland

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. 🤷

@vt-tv

vt-tv commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

@pedro-alves-ferreira What do you think about this change? any risk of breaking the crates or application using them (gstreamer plugins, etc)

@KimonHoffmann KimonHoffmann left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@pedro-alves-ferreira

Copy link
Copy Markdown
Contributor

@pedro-alves-ferreira What do you think about this change? any risk of breaking the crates or application using them (gstreamer plugins, etc)

I think this is fine.

@pedro-alves-ferreira

Copy link
Copy Markdown
Contributor

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.

@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.

@pedro-alves-ferreira pedro-alves-ferreira left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@KimonHoffmann KimonHoffmann left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification @pedro-alves-ferreira.
Looks good to me then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants