Skip to content
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

cargo-c: improve install path conventions #317

Closed
tmatth opened this issue May 10, 2023 · 7 comments · Fixed by #373
Closed

cargo-c: improve install path conventions #317

tmatth opened this issue May 10, 2023 · 7 comments · Fixed by #373
Labels
enhancement New feature or request F-MesonParity Mimic meson behaviour if possible

Comments

@tmatth
Copy link

tmatth commented May 10, 2023

When installing the gst-plugin-rtp plugin from https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs, I noticed that with:
cargo cinstall -p gst-plugin-rtp --prefix=/usr/local

the rust plugins (the shared libs) install to /usr/local/lib/gstreamer-1.0/libgstrsrtp.so

whereas other gstreamer packages install to e.g., /usr/local/lib/x86_64-linux-gnu/gstreamer-1.0/

For now I can workaround this by explicitly adding --libdir=${PREFIX}/lib/x86_64-linux-gnu but it'd be preferable for this to follow the meson + autotools conventions (at least as I understand them).

@sdroege's comment:

there's probably some useful heuristic to detect lib, lib32, lib64, lib/target-triple

@lu-zero
Copy link
Owner

lu-zero commented May 10, 2023

The normal libdir IS /usr/local/lib, adding a quasi-chost is a distribution-specific choice and I'm not aware of ways to know which it is which short of checking how they patched the rest of the toolchain.

See autotools docs.

If meson has some heuristic it is not exactly clear in that document, but if it works well enough there we can match it as long somebody provides a patch.

I'd avoid distro-specific logic though.

@lu-zero lu-zero added the enhancement New feature or request label May 10, 2023
@sdroege
Copy link
Contributor

sdroege commented May 10, 2023

If meson has some heuristic it is not exactly clear in that document

That seems like a question for @nirbheek

@eli-schwartz
Copy link

eli-schwartz commented May 11, 2023

meson detects the operating system, and for Debian-like systems it executes dpkg-architecture -qDEB_HOST_MULTIARCH. Elsewhere, it checks whether lib64 is its own thing and not just a compat symlink. There are some other relevant heuristics as well. Check out mesonbuild.utils.universal.default_libdir().

Unlike autotools, the rough heuristic is "we try to do what's actually correct on your OS, if we do not know then we can always just default to /usr/local/lib instead, but let's try to actually be correct if we can".

It's not precisely a moving target, but it's definitely one where the code evolves. We got Haiku patches recently, for example.

@lu-zero
Copy link
Owner

lu-zero commented May 11, 2023

Sounds like a fair amount of code who's willing to look into porting it? I wonder if would make sense making a separate crate for it.

@lu-zero
Copy link
Owner

lu-zero commented Sep 14, 2023

@eli-schwartz can you link the meson heuristics? Probably it could be distilled in a stand alone crate so other tools may use it for the same purpose.

@nirbheek
Copy link
Contributor

https://github.com/mesonbuild/meson/blob/master/mesonbuild/utils/universal.py#L1021-L1094

It's really quite simple, not worth putting it into a crate yet, IMO. Maybe you'd like to keep it as an internal module till it grows enough and then it can be split out?

@lu-zero
Copy link
Owner

lu-zero commented Sep 14, 2023

If you have a timeslice to convert to a patch and send it would be great since I have plans to make a release soon due cbindgen ^^;

@lu-zero lu-zero added the F-MesonParity Mimic meson behaviour if possible label May 3, 2024
amyspark added a commit to amyspark/cargo-c that referenced this issue May 4, 2024
amyspark added a commit to amyspark/cargo-c that referenced this issue May 9, 2024
amyspark added a commit to amyspark/cargo-c that referenced this issue May 28, 2024
lu-zero pushed a commit to amyspark/cargo-c that referenced this issue May 28, 2024
amyspark added a commit to amyspark/cargo-c that referenced this issue May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request F-MesonParity Mimic meson behaviour if possible
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants