Skip to content

Missing pkg-config name transforms (for libarchive, libcrypto, etc) #13551

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

Open
TheZeus121 opened this issue Nov 15, 2022 · 2 comments
Open

Missing pkg-config name transforms (for libarchive, libcrypto, etc) #13551

TheZeus121 opened this issue Nov 15, 2022 · 2 comments
Labels
bug Observed behavior contradicts documented or intended behavior zig build system std.Build, the build runner, `zig build` subcommand, package management
Milestone

Comments

@TheZeus121
Copy link

Zig Version

0.11.0-dev.174+d823680e1

Steps to Reproduce and Observed Behavior

Add linkSystemLibrary("archive") to build.zig. Observe that Zig just adds -larchive without any -L or -I flags (it actually doesn't call pkg-config --cflags --libs) so it fails if libarchive is installed to a non-standard path.

Now replace that with linkSystemLibrary("libarchive") and pkg-config gets called properly but if you remove pkg-config, you get -llibarchive which doesn't work.

Expected Behavior

For linkSystemLibrary("archive") to call pkg-config --cflags --libs libarchive.

linkSystemLibraryPkgConfigOnly("libarchive") is not a solution because if libarchive is installed in a standard location it should still be linkable without pkg-config, but currently there is no portable way to do this without checking if pkg-config is in PATH in build.zig.


Currently lib/std/build.zig's runPkgConfig doesn't support the following "transform kinds" I've seen in the wild (on Homebrew and on Debian):

  • -larchive -> pkg-config libarchive
  • -lrsvg-2 -> pkg-config librsvg-2.0
  • -lxml2 -> pkg-config libxml-2.0

Aside from libxml2, it seems it should be possible to go through the checks that are in place already just also check them for names with added "lib" prefix.


I'd tackle this issue myself but I don't feel like learning how to compile zig from source tonight 🙈

@TheZeus121 TheZeus121 added the bug Observed behavior contradicts documented or intended behavior label Nov 15, 2022
@TheZeus121 TheZeus121 changed the title More pkg-config name transforms (for libarchive, libcrypto, etc) Missing pkg-config name transforms (for libarchive, libcrypto, etc) Nov 15, 2022
@matu3ba
Copy link
Contributor

matu3ba commented Nov 15, 2022

I'd tackle this issue myself but I don't feel like learning how to compile zig from source tonight

You can use the instructions in https://github.com/ziglang/zig/wiki/Building-Zig-From-Source and on problems/unclear things, ask in a community place https://github.com/ziglang/zig/wiki/Community.

@BratishkaErik
Copy link
Contributor

Related: #3671

@andrewrk andrewrk added the zig build system std.Build, the build runner, `zig build` subcommand, package management label Jan 23, 2023
@andrewrk andrewrk added this to the 0.12.0 milestone Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior zig build system std.Build, the build runner, `zig build` subcommand, package management
Projects
None yet
Development

No branches or pull requests

4 participants