pkgconf: Add HOST_MAKE_ENV sytem include and lib
diff mbox series

Message ID 20191021123810.23135-1-thomas.preston@codethink.co.uk
State New
Headers show
Series
  • pkgconf: Add HOST_MAKE_ENV sytem include and lib
Related show

Commit Message

Thomas Preston Oct. 21, 2019, 12:38 p.m. UTC
Recently, a change to the pkg-config wrapper made it more explicit about
where the system include and library directories are, so that pkgconf
does not print them. See upstream commit 9cc8680.

By default, we configure the pkg-config wrapper for the target sysroot,
however the default system include and library directories are not
reconfigured for the host build environment (they still point at the
target sysroot). Fix this by adding the host system include and library
directories to HOST_MAKE_ENV.

Note: this isn't likely to fix any bugs at present, but the incorrect
configuration may hide an include-order related error which the original
patch was supposed to fix!

Signed-off-by: Thomas Preston <thomas.preston@codethink.co.uk>
---
 package/Makefile.in | 2 ++
 1 file changed, 2 insertions(+)

Comments

Thomas Petazzoni Oct. 21, 2019, 2:18 p.m. UTC | #1
On Mon, 21 Oct 2019 13:38:10 +0100
Thomas Preston <thomas.preston@codethink.co.uk> wrote:

> Recently, a change to the pkg-config wrapper made it more explicit about
> where the system include and library directories are, so that pkgconf
> does not print them. See upstream commit 9cc8680.
> 
> By default, we configure the pkg-config wrapper for the target sysroot,
> however the default system include and library directories are not
> reconfigured for the host build environment (they still point at the
> target sysroot). Fix this by adding the host system include and library
> directories to HOST_MAKE_ENV.
> 
> Note: this isn't likely to fix any bugs at present, but the incorrect
> configuration may hide an include-order related error which the original
> patch was supposed to fix!

I think this could potentially fix:

  https://bugs.busybox.net/show_bug.cgi?id=11776
  https://bugs.busybox.net/show_bug.cgi?id=12131

which are precisely include-order related.

Thomas
Arnout Vandecappelle Oct. 22, 2019, 7:31 p.m. UTC | #2
On 21/10/2019 16:18, Thomas Petazzoni wrote:
> On Mon, 21 Oct 2019 13:38:10 +0100
> Thomas Preston <thomas.preston@codethink.co.uk> wrote:
> 
>> Recently, a change to the pkg-config wrapper made it more explicit about
>> where the system include and library directories are, so that pkgconf
>> does not print them. See upstream commit 9cc8680.
>>
>> By default, we configure the pkg-config wrapper for the target sysroot,
>> however the default system include and library directories are not
>> reconfigured for the host build environment (they still point at the
>> target sysroot). Fix this by adding the host system include and library
>> directories to HOST_MAKE_ENV.
>>
>> Note: this isn't likely to fix any bugs at present, but the incorrect
>> configuration may hide an include-order related error which the original
>> patch was supposed to fix!
> 
> I think this could potentially fix:
> 
>   https://bugs.busybox.net/show_bug.cgi?id=11776
>   https://bugs.busybox.net/show_bug.cgi?id=12131
> 
> which are precisely include-order related.

 It's not very likely that a change in HOST_MAKE_ENV will fix an issue when
building a target package...

 However, the recently-applied commit 9cc8680fe5 may indeed do so. I'll do a
test build and update the issues if they're fixed.

 Regards,
 Arnout
Thomas Preston Oct. 23, 2019, 12:19 p.m. UTC | #3
On 22/10/2019 20:31, Arnout Vandecappelle wrote:
> On 21/10/2019 16:18, Thomas Petazzoni wrote:
>> On Mon, 21 Oct 2019 13:38:10 +0100
>> Thomas Preston <thomas.preston@codethink.co.uk> wrote:
>>
>>> Recently, a change to the pkg-config wrapper made it more explicit about
>>> where the system include and library directories are, so that pkgconf
>>> does not print them. See upstream commit 9cc8680.
>>>
>>> By default, we configure the pkg-config wrapper for the target sysroot,
>>> however the default system include and library directories are not
>>> reconfigured for the host build environment (they still point at the
>>> target sysroot). Fix this by adding the host system include and library
>>> directories to HOST_MAKE_ENV.
>>>
>>> Note: this isn't likely to fix any bugs at present, but the incorrect
>>> configuration may hide an include-order related error which the original
>>> patch was supposed to fix!
>>
>> I think this could potentially fix:
>>
>>   https://bugs.busybox.net/show_bug.cgi?id=11776
>>   https://bugs.busybox.net/show_bug.cgi?id=12131
>>
>> which are precisely include-order related.
> 
>  It's not very likely that a change in HOST_MAKE_ENV will fix an issue when
> building a target package...
> 
>  However, the recently-applied commit 9cc8680fe5 may indeed do so. I'll do a
> test build and update the issues if they're fixed.
> 

fwiw I just tested the last posted config [0] based on 37be55a5db (no fix)
and master + HOST_MAKE_ENV fix, and see the same error in both:

	/mnt/output/host/i586-buildroot-linux-gnu/include/c++/9.2.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
	   75 | #include_next <stdlib.h>

Which suggest these patches don't fix this particular issue.

[0] https://bugs.busybox.net/show_bug.cgi?id=11776#c4

Patch
diff mbox series

diff --git a/package/Makefile.in b/package/Makefile.in
index 0a7899c852..3ae4d4d4e9 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -309,6 +309,8 @@  HOST_MAKE_ENV = \
 	PATH=$(BR_PATH) \
 	PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
 	PKG_CONFIG_SYSROOT_DIR="/" \
+	PKG_CONFIG_SYSTEM_INCLUDE_PATH="/usr/include" \
+	PKG_CONFIG_SYSTEM_LIBRARY_PATH="/usr/lib" \
 	PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 \
 	PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
 	PKG_CONFIG_LIBDIR="$(HOST_DIR)/lib/pkgconfig:$(HOST_DIR)/share/pkgconfig"