Bug 15637

Summary: every var expansion in a .pc file prepended with sysroot
Product: buildroot Reporter: stsp <stsp2>
Component: OtherAssignee: unassigned
Status: RESOLVED MOVED    
Severity: normal CC: buildroot, yann.morin.1998
Priority: P5    
Version: 2023.05   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description stsp 2023-06-18 16:40:53 UTC
buildroot seems to have some pkg-config
wrapper that adds the sysroot path per every
variable expansion.
I have a .pc file that emits -rpath on --libs.
rpath with the sysroot prefix doesn't work.
How should I get the proper rpath with pkg-config
under buildroot? Can buildroot be told to not
add sysroot path to some variables?
Comment 1 Yann E. MORIN 2023-06-18 19:35:08 UTC
stsp, All,

> buildroot seems to have some pkg-config wrapper that adds the sysroot path per every variable expansion.

Yes and no. Basically, that's pkconf (the pkg-config implementation Buildroot
is using) thatadds the sysroot prefix to all variable expansions. The wrapper
probided by Buildroot just ensure that the proper sysroot is used.

> I have a .pc file that emits -rpath on --libs. rpath with the sysroot prefix doesn't work.

Adding an -rpath link option should not be done in a .pc file; that's rather
incorrect.

Furthermore, the RPATH is fixed before assembling the filesystem images,
so that only RPATH valid on the targt are present (usually, none is needed);
see Makefile line 768.

Regards,
Yann E. MORIN
Comment 2 stsp 2023-06-18 19:52:39 UTC
> Adding an -rpath link option should not be done in a .pc file; that's rather
> incorrect.

What would you suggest instead?
This is a plugin library for particular
program so it doesn't reside in an
ldconfig-known location.
I am not aware of any other way than
rpath of hardcoding the non-std locations.
Comment 3 stsp 2023-06-18 20:10:47 UTC
> so that only RPATH valid on the targt are present (usually, none is needed);

Maybe it can check if RPATH is
valid on target, by stripping the
sysroot path and checking the result?
Comment 4 Yann E. MORIN 2024-06-15 15:10:50 UTC
Thank you for your report.

The issue tracker for the Buildroot project has been moved to
the Gitlab.com issue tracker:
    https://gitlab.com/buildroot.org/buildroot/-/issues

We are taking this opportunity to close old issues in this old
tracker. If you believe your issue is still relevant, please
open one in the new issue tracker.

Thank you!