pkg-config files are wrong for static builds #789

Closed
opened 2025-04-07 17:05:16 +00:00 by alois31 · 1 comment
Member

Describe the bug

When building a Lix package for static linkage, its pkg-config files do not contain explicit instructions to link against the dependencies, even though they should. (The behaviour is the same for dynamic linkage, but there it is actually correct since transitive dependencies are encoded in the shared libraries themselves.)

Steps To Reproduce

The reproducer is on stable Lix as packaged in nixpkgs for simplicity, but the issue remains on the main branch.

  1. Obtain nixpkgs unstable (I have tested on 42a1c966be226125b48c384171c44c651c236c22 which is latest nixos-unstable at the time of writing)
  2. nix-build -A pkgsStatic.lixPackageSets.latest.lix.dev
  3. cat result-dev/lib/pkgconfig/lix-util.pc
  4. Observe there are no Libs.private for linking against the dependencies

Expected behavior

There are Libs.private for linking against the dependencies (libarchive etc.)

nix --version output

nix (Lix, like Nix) 2.93.0-dev
System type: x86_64-linux
Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux
Features: gc, signed-caches
System configuration file: /etc/nix/nix.conf
User configuration files: [redacted]
Store directory: /nix/store
State directory: /nix/var/nix
Data directory: /nix/store/4fifp1n33jbz50npi5bdbydipfq0fh7z-lix-2.93.0-dev-pre-63d550938ba2/share

Additional context

The pkg-config files are created manually with code like the following:

Lines 321 to 331 in 2ef4b69
configure_file(
input : 'lix-util.pc.in',
output : 'lix-util.pc',
install_dir : libdir / 'pkgconfig',
configuration : {
'prefix' : prefix,
'libdir' : libdir,
'includedir' : includedir,
'PACKAGE_VERSION' : meson.project_version(),
},
)

. If no way is found to make meson's automatic generation behave reasonably, the static case needs to be handled separately.

## Describe the bug When building a Lix package for static linkage, its pkg-config files do not contain explicit instructions to link against the dependencies, even though they should. (The behaviour is the same for dynamic linkage, but there it is actually correct since transitive dependencies are encoded in the shared libraries themselves.) ## Steps To Reproduce The reproducer is on stable Lix as packaged in nixpkgs for simplicity, but the issue remains on the main branch. 1. Obtain nixpkgs unstable (I have tested on 42a1c966be226125b48c384171c44c651c236c22 which is latest nixos-unstable at the time of writing) 2. `nix-build -A pkgsStatic.lixPackageSets.latest.lix.dev` 3. `cat result-dev/lib/pkgconfig/lix-util.pc` 4. Observe there are no `Libs.private` for linking against the dependencies ## Expected behavior There are `Libs.private` for linking against the dependencies (libarchive etc.) ## `nix --version` output ``` nix (Lix, like Nix) 2.93.0-dev System type: x86_64-linux Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux Features: gc, signed-caches System configuration file: /etc/nix/nix.conf User configuration files: [redacted] Store directory: /nix/store State directory: /nix/var/nix Data directory: /nix/store/4fifp1n33jbz50npi5bdbydipfq0fh7z-lix-2.93.0-dev-pre-63d550938ba2/share ``` ## Additional context The pkg-config files are created manually with code like the following: https://git.lix.systems/lix-project/lix/src/commit/2ef4b69760af183792a740f425eb371a6aeb0009/lix/libutil/meson.build#L321-L331 . If no way is found to make meson's automatic generation behave reasonably, the static case needs to be handled separately.
Member

This issue was mentioned on Gerrit on the following CLs:

  • commit message in cl/3778 ("packaging: fix pkg-config files")
<!-- GERRIT_LINKBOT: {"cls": [{"backlink": "https://gerrit.lix.systems/c/lix/+/3778", "number": 3778, "kind": "commit message"}], "cl_meta": {"3778": {"change_title": "packaging: fix pkg-config files"}}} --> This issue was mentioned on Gerrit on the following CLs: * commit message in [cl/3778](https://gerrit.lix.systems/c/lix/+/3778) ("packaging: fix pkg-config files")
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lix-project/lix#789
No description provided.