PKG_CONFIG_SYSROOT_DIR get also prepended to libraries outside of SYSROOT #213
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
I've got a problem when employing
PKG_CONFIG_SYSROOT_DIR
:Not all of my libraries are contained in the sysroot, but there are other libraries built outside of the sysroot. (The sysroot is provided to me, so it is not so easily changed)
A concrete example:
my project needs libssh2, (which is not in the sysroot) is configured with
prefix=/home/tobi/libs/libssh2/usr
and it creates libssh2.pc with said prefix (libssh2.pc quoted in full at the bottom)However, when
PKG_CONFIG_SYSROOT_DIR
is defined, for example toPKG_CONFIG_SYSROOT=/home/tobi/sysroot
, the generated pathpkgconf --cflags libssh2
will get me:
/home/tobi/sysroot/home/tobi/libs/libssh/usr/include
which of course is not a valid path.
Should PKG_CONFIG_SYSROOT_DIR only be applied if the pc was coming from the sysroot?
TIA for any hints!
(note I've sent basically the same text also to pkg-config [1] and after I checked that pkgconf unfortunatly could not help me here, I thought it might be a good idea to post it here too.
On pkg-config. there is a PR pending with an another approach idea to us a new env map ( PKG_CONFIG_SYSROOT_MAP) to map pathes between several sysroots. Maybe interesting approach as well… [2]
[1] https://gitlab.freedesktop.org/pkg-config/pkg-config/-/issues/52
[2] https://gitlab.freedesktop.org/pkg-config/pkg-config/-/merge_requests/7
Cheers,
tobi
the
PKG_CONFIG_SYSROOT_MAP
proposal is flawed and pending reimplementation. it will be part of pkgconf 2.0.@kaniini thaks for the feedback
I wrote myself a wrapper script removing PKG_CONFIG_SYSROOT_DIR from the generated path if the generated path is not resolving to a file system object. Would that be a possible solution to pick up solving my problem?
That seems like a reasonable workaround for now that could be documented.
I'm not enthusiastic about implementing workarounds in pkgconf itself code-wise, but I am hoping that we can implement the revised
PKG_CONFIG_SYSROOT_MAP
in the current development cycle.FWIIW, here is my wrapper script; note that I only implemented enough for my usage; YMMV.
(saved to a script and export PKG_CONFIG='filename' should do the trick for most buildsystem generators like autotools and cmake)
So, the purpose of
PKG_CONFIG_SYSROOT_DIR
is to enable building a sysroot where you usemake install DESTDIR=$PKG_CONFIG_SYSROOT_DIR
on everything (or equivalent for Meson).So I agree with you that we should only mangle
.pc
files inside the sysroot itself.However this is going to require a bit of rework to accomplish, so it won't make 1.7.4.