Install location for the pkg-config file

Hello,

I'm working on bringing a better multilib experience for Gentoo users,
and I've tripped a bit on default install layout of libclc. By default,
libclc configure.py uses $prefix/lib/pkgconfig which is not really
a valid location on a multilib system.

As far as I can see, libclc installs only LLVM bytecode and headers,
and explicitly uses libexecdir rather than libdir. Does that mean that
libclc is completely ABI-agnostic? In that case, the proper install
location for pkg-config would be $prefix/share/pkgconfig.

Could you please tell me if I'm correct? And if I am, I think it would
be really beneficial to change the default within libclc sources
as well.

Hello,

I'm working on bringing a better multilib experience for Gentoo users,
and I've tripped a bit on default install layout of libclc. By default,
libclc configure.py uses $prefix/lib/pkgconfig which is not really
a valid location on a multilib system.

As far as I can see, libclc installs only LLVM bytecode and headers,
and explicitly uses libexecdir rather than libdir. Does that mean that
libclc is completely ABI-agnostic? In that case, the proper install
location for pkg-config would be $prefix/share/pkgconfig.

Yes, libclc only installs LLVM bytecode and headers. Currently, only
GPU targets are supported, so it is ABI-agnostic in the sense that the
ABI of the host machine doesn't matter. However, it is possible that it
could support CPU targets in the future which might not be ABI-agnostic.

Could you please tell me if I'm correct? And if I am, I think it would
be really beneficial to change the default within libclc sources
as well.

I don't know much about system layout best practices, but I am in favor of changing the
install prefix if it makes things easier for distros. I'm not sure how
the current install prefixes were selected.

-Tom

> Hello,
>
> I'm working on bringing a better multilib experience for Gentoo users,
> and I've tripped a bit on default install layout of libclc. By default,
> libclc configure.py uses $prefix/lib/pkgconfig which is not really
> a valid location on a multilib system.
>
> As far as I can see, libclc installs only LLVM bytecode and headers,
> and explicitly uses libexecdir rather than libdir. Does that mean that
> libclc is completely ABI-agnostic? In that case, the proper install
> location for pkg-config would be $prefix/share/pkgconfig.
>

Yes, libclc only installs LLVM bytecode and headers. Currently, only
GPU targets are supported, so it is ABI-agnostic in the sense that the
ABI of the host machine doesn't matter. However, it is possible that it
could support CPU targets in the future which might not be ABI-agnostic.

Well, I suspect that those targets would still be selectable in such
a way that having separate 64-bit and 32-bit libclc wouldn't be needed.
And in the worst case, pkg-config can be moved freely.

> Could you please tell me if I'm correct? And if I am, I think it would
> be really beneficial to change the default within libclc sources
> as well.

I don't know much about system layout best practices, but I am in favor of changing the
install prefix if it makes things easier for distros. I'm not sure how
the current install prefixes were selected.

Well, there are two valid pkg-config file locations:

$libdir/pkgconfig is for pkg-config that refer directly to libraries
and other ABI-specific stuff. That is, there can be
e.g. /usr/lib64/pkgconfig/libfoo.pc for 64-bit libfoo
and /usr/lib/pkgconfig/libfoo.pc for 32-bit libfoo (exact directories
depend on arch and multilib layout, if any).

$datarootdir/pkgconfig for ABI-agnostic stuff (usually things that are
installed in /usr/share, /usr/libexec or /usr/lib, or pure headers
which are guaranteed not to change depending on arch/ABI).

The current choice of 'lib/pkgconfig' hits quite a random ABI
on multilib distros (native on standard Gentoo, 32-bit on Fedora).
Choice of $libdir/pkgconfig would limit libclc to the specific ABI it
was built with, and -- to be honest -- it seems that libclc's build
system is thoroughly confused by our multilib attempts. Using
$datarootdir/pkgconfig would allow us to simply use libclc for multilib
mesa.

I will send a patch implementing that solution in reply to this mail.
I assumed there's no point in implementing whole --datarootdir here,
and just replaced the default path.

libclc is ABI-agnostic, and $prefix/lib/pkgconfig causes issues
on multilib setups. Using $prefix/share/pkgconfig allows us to reuse
a single libclc build across all system ABIs.

libclc is ABI-agnostic, and $prefix/lib/pkgconfig causes issues
on multilib setups. Using $prefix/share/pkgconfig allows us to reuse
a single libclc build across all system ABIs.

This looks OK to me, but I think we will need to tell users to adjust
their PKG_CONFIG_PATH if they have installed libclc to a non-standard
prefix.

-Tom

> libclc is ABI-agnostic, and $prefix/lib/pkgconfig causes issues
> on multilib setups. Using $prefix/share/pkgconfig allows us to reuse
> a single libclc build across all system ABIs.

This looks OK to me, but I think we will need to tell users to adjust
their PKG_CONFIG_PATH if they have installed libclc to a non-standard
prefix.

I've pushed this patch. Sorry for the delay.

-Tom