Bug 89769 - udev.pc should go to libdir/pkgconfig not datadir/pkgconfig
Summary: udev.pc should go to libdir/pkgconfig not datadir/pkgconfig
Status: RESOLVED FIXED
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-26 00:31 UTC by Benedikt Morbach
Modified: 2019-08-22 11:05 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Benedikt Morbach 2015-03-26 00:31:50 UTC
udev.pc sets udevdir=@udevlibexecdir@ which is architecture-dependent.
It's /usr/lib/udev here and there are binaries installed to it.

Therefore it should be installed to the arch-specific pkgconfigdir, like libudev.pc
Comment 1 Lennart Poettering 2015-03-26 07:17:30 UTC
No.

These are binaries that can be shared between multiple compatible architectures. Hence they do not belong under libdir. 

libdir is only for libraries that need to be around in multiple versions on multiarch machines.
Comment 2 Benedikt Morbach 2015-03-26 10:40:33 UTC
I think you misunderstood me (probably my fault)

This is purely about the location of the pkgconfig file.

The path that is sets is arch specific, so udev.pc should go to the lib/pkgconfig.

This normally doesn't matter much because as you said, on a multilib system, there will only be one @udevlibexecdir@. But we are doing a debian-like multiarch approach where you can have incompatible arches installed for the sake of cross compiling.
Thus we need two versions of udev.pc, one with the x86/x86_64 path and one with e.g. the arm path, if you install that for cross compiling, otherwise you can't build things that need it.
Comment 3 Kay Sievers 2015-03-26 11:04:13 UTC
This is what we currently do:
  /usr/lib64/pkgconfig/systemd.pc
  /usr/share/pkgconfig/udev.pc

which looks just confusing and wrong.

So please move the systemd.pc back to share/ or move the udev.pc to $libdir. They should not be in different locations.
Comment 4 Zbigniew Jedrzejewski-Szmek 2015-03-26 15:01:25 UTC
udev.pc only contains one line which is architecture independent, but systemd.pc has $libdir and varies between archs.
Comment 5 Kay Sievers 2015-03-26 16:52:28 UTC
(In reply to Zbigniew Jedrzejewski-Szmek from comment #4)
> udev.pc only contains one line which is architecture independent, but
> systemd.pc has $libdir and varies between archs.

That does not matter a single bit. They serve the same purpose. They are
_generic_ package config files, and they do not belong in $libdir.

If the the whole purpose of pointing out the _primary_ arch in that file,
the the file should not be installed in the primary arch's libdir. This
is all backwards and as wrong as it can get.
Comment 6 Benedikt Morbach 2015-03-26 17:44:34 UTC
(In reply to Kay Sievers from comment #5)
> That does not matter a single bit. They serve the same purpose. They are
> _generic_ package config files, and they do not belong in $libdir.

That's not how it works. They export directories that are inherently arch-specific because they contain binaries. $libexecdir is arch-specific, some distros don't even use it and use $libdir instead, which is also arch specific. Arch-specific pkgconfig files belong in $libdir.

With a multiarch approach you can have systemd installed for multiple architectures, e.g. to /usr/lib/${host} and to be able to compile other programs against it, the arch-specific pkgconfig files have to be in $libdir as well. There really isn't much of a "primary arch" in that case.
Comment 7 Kay Sievers 2015-03-26 17:58:20 UTC
(In reply to Benedikt Morbach from comment #6)
> (In reply to Kay Sievers from comment #5)
> > That does not matter a single bit. They serve the same purpose. They are
> > _generic_ package config files, and they do not belong in $libdir.
> 
> That's not how it works. They export directories that are inherently
> arch-specific because they contain binaries. $libexecdir is arch-specific,
> some distros don't even use it and use $libdir instead, which is also arch
> specific. Arch-specific pkgconfig files belong in $libdir.
> 
> With a multiarch approach you can have systemd installed for multiple
> architectures, e.g. to /usr/lib/${host} and to be able to compile other
> programs against it, the arch-specific pkgconfig files have to be in $libdir
> as well. There really isn't much of a "primary arch" in that case.

This is all wrong. $libexedir is NOT arch specific. But none of the wrong
things here really matter.

What matters is that systemd.pc and udev.pc are GENERIC files,
not arch-dependent.

The SECONDARY arch needs to find the GENERIC file, but it will not look
into the PRIMARY arch's $libdir.

These files just do not belong into $libdir, it is not what they are provided
for and it will just not work as intended.

Also, that systemd.pc carries $libdir as a variable to point out the
PRIMARY arch, is no indication that this file should live in $libdir,
quite the opposite is the case.
Comment 8 Marc-Antoine Perennou 2015-04-07 13:56:34 UTC
(In reply to Kay Sievers from comment #7)
> 
> This is all wrong. $libexedir is NOT arch specific. But none of the wrong
> things here really matter.
> 
> What matters is that systemd.pc and udev.pc are GENERIC files,
> not arch-dependent.
> 
> The SECONDARY arch needs to find the GENERIC file, but it will not look
> into the PRIMARY arch's $libdir.
> 
> These files just do not belong into $libdir, it is not what they are provided
> for and it will just not work as intended.
> 
> Also, that systemd.pc carries $libdir as a variable to point out the
> PRIMARY arch, is no indication that this file should live in $libdir,
> quite the opposite is the case.

This file in itself is not arch-specific, sure, as it's only a text file.

Its contents though is arch-specific.

Just picture it this way:
I have a multiarch system (and by multiarch I do not mean multilib, but a system which can cross-compile to random archs)
My principal arch is x86_64, and I use my multiarch system to build arm binaries.

systemd.pc and udev.pc built for x86_64 will contain paths to my x86_64 libdir. The libraries contained into this lib are arch-dependents. When I build something which needs udev for x86_64, it will look for pkg-config files in my x86_64 libdir.

Now let's say I want to cross-compile the same software for arm. If systemd installs its udev.pc in $datadir and pkg-config reads that, it will try to link the arm binary to the x86_64 libs. If systemd however does the right things and installs it into the arch-specific libdir, the compilation for arm will get the right pkg-config files for the arm libdir.

Any pkg-config file containing paths to arch-sepcific stuff such as libraries should go into an arch-specific directory.
Comment 9 Kay Sievers 2015-04-08 16:53:30 UTC
This is true for the common use case of pkgconfig files, which is libraries.

These files are meant at generic files for the primary and secondary/compat
arch, not for cross compilation, like it is done for libs.

The primary and the secondary/compat arch/multilib share the same paths, and
the file should be in a non-libdir location.
Comment 10 Zbigniew Jedrzejewski-Szmek 2019-08-22 11:05:53 UTC
We now put (since at least the switch to meson in https://github.com/systemd/systemd/commit/5c23128dab) both systemd.pc and udev.pc in architecture-independent /usr/share/pkgconfig/.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.