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

Provide pkg-config file with the C library #592

Closed
sdroege opened this issue Mar 6, 2023 · 6 comments
Closed

Provide pkg-config file with the C library #592

sdroege opened this issue Mar 6, 2023 · 6 comments

Comments

@sdroege
Copy link

sdroege commented Mar 6, 2023

Providing a pkg-config file makes it easier for users of the library to actually find it, check its version and get the correct compiler and linker flags.

cargo-c could be helpful here for generating the pkg-config file and also to provide a mechanism for installing it, the library itself and the header. It also ensures that the library has a valid and correct soname set, which cargo doesn't set at all when building a cdylib.

cargo-c also allows running cbindgen automatically but AFAIU you're manually editing the output of it so that's maybe not very useful here.

@sdroege
Copy link
Author

sdroege commented Mar 6, 2023

It will also make static linking easier as all the required linker flags would be part of the pkg-config file

@RazrFalcon
Copy link
Owner

I'm not familiar with pkg-config or cargo-c, so unless someone wants to make a PR it would take a while for me to figure it all out.

@RazrFalcon
Copy link
Owner

Out of scope unless someone would send a path.

@sdroege
Copy link
Author

sdroege commented Aug 7, 2023

You might want to add something to the README.md that Linux distros should not package it for the time being then as without a proper soname etc it's only going to cause problems. I'm not using resvg myself and only reported that here because someone ran into such problems and had the impression that Rust's build tools are too immature for providing proper C shared libraries. (Which is kind of true if only using cargo, like in your project here)

@RazrFalcon
Copy link
Owner

RazrFalcon commented Aug 7, 2023

without a proper soname

Afaik this is a cargo bug, not resvg one. And Linux-only one. It's up to distro maintainers to decide what to do. Out of scope.

@sdroege
Copy link
Author

sdroege commented Aug 7, 2023

Fine with me, next time someone complains about stuff being broken I'll just point them to this issue :)

Linux-only one

On macOS you don't get proper dylib versioning either.

Afaik this is a cargo bug

More a missing feature than a bug, but until then cargo alone is unsuitable for this purpose.

rust-lang/cargo#5045 and rust-lang/cargo#2273 FWIW

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

No branches or pull requests

2 participants