mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] pkg-config-wrapper libdir confusion, ABI dynamic-linker path.
@ 2021-04-22 19:59 Christian Melki
  2021-04-23  7:39 ` Michael Olbrich
  0 siblings, 1 reply; 9+ messages in thread
From: Christian Melki @ 2021-04-22 19:59 UTC (permalink / raw)
  To: ptxdist

I'm using a crosstool-ng toolchain which adheres to the ld.so ABI path
for x86_64 (glibc).

Afaiu, ptxdist does not like multilib.
But it will happily get the dynamic-linker path which contain a multilib
description or just a regular lib64 path.

https://git.pengutronix.de/cgit/ptxdist/tree/scripts/lib/ptxd_make_00-init.sh#n169

This might be a symbolic link to the real dynamic linker, because a
demultilibbed toolchain must still adhere to the ABI specifications.
For x86_64: 64-bit, hard-float, LE: /lib64/ld-linux-x86-64.so.2

So ptxdist will use lib64 as it's base for libdirs placing various
libraries in a lib64 path.

But when using the pkg-config-wrapper it looks like all libraries are
only statically set from a something /lib path.

https://git.pengutronix.de/cgit/ptxdist/tree/scripts/pkg-config-wrapper#n19

So building a library yields:
$ ls -la platform-tracker/sysroot-target/usr/lib64/libmnl.so*
lrwxrwxrwx 2 xxx users    15 Apr 22 21:01
platform-tracker/sysroot-target/usr/lib64/libmnl.so -> libmnl.so.0.2.0*
lrwxrwxrwx 2 xxx users    15 Apr 22 21:01
platform-tracker/sysroot-target/usr/lib64/libmnl.so.0 -> libmnl.so.0.2.0*
-rwxr-xr-x 2 xxx users 77216 Apr 22 21:01
platform-tracker/sysroot-target/usr/lib64/libmnl.so.0.2.0*

$ ls -la platform-tracker/sysroot-target/usr/lib64/pkgconfig/libmnl.pc
-rw-r--r-- 2 xxx users 318 Apr 22 21:01
platform-tracker/sysroot-target/usr/lib64/pkgconfig/libmnl.pc

In the search for the library:
PKG_CONFIG_DEBUG_SPEW variable enabling debug spew
Adding directory
'/home/xxx/work/tracker/bin/platform-tracker/sysroot-target/usr/lib/pkgconfig'
from PKG_CONFIG_PATH
Adding directory
'/home/xxx/work/tracker/bin/platform-tracker/sysroot-target/usr/share/pkgconfig'
from PKG_CONFIG_PATH
Global variable definition 'pc_sysrootdir' = '/'
Global variable definition 'pc_top_builddir' = '$(top_builddir)'
Error printing enabled by default due to use of output options besides
--exists, --atleast/exact/max-version or --list-all. Value of
--silence-errors: 0
Error printing enabled
Adding virtual 'pkg-config' package to list of known packages
Looking for package 'libmnl'
Looking for package 'libmnl-uninstalled'
No package 'libmnl' found

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ptxdist] pkg-config-wrapper libdir confusion, ABI dynamic-linker path.
  2021-04-22 19:59 [ptxdist] pkg-config-wrapper libdir confusion, ABI dynamic-linker path Christian Melki
@ 2021-04-23  7:39 ` Michael Olbrich
  2021-04-23  8:17   ` Christian Melki
  2021-04-24 17:02   ` Christian Melki
  0 siblings, 2 replies; 9+ messages in thread
From: Michael Olbrich @ 2021-04-23  7:39 UTC (permalink / raw)
  To: ptxdist

On Thu, Apr 22, 2021 at 09:59:06PM +0200, Christian Melki wrote:
> I'm using a crosstool-ng toolchain which adheres to the ld.so ABI path
> for x86_64 (glibc).
> 
> Afaiu, ptxdist does not like multilib.
> But it will happily get the dynamic-linker path which contain a multilib
> description or just a regular lib64 path.
> 
> https://git.pengutronix.de/cgit/ptxdist/tree/scripts/lib/ptxd_make_00-init.sh#n169
> 
> This might be a symbolic link to the real dynamic linker, because a
> demultilibbed toolchain must still adhere to the ABI specifications.
> For x86_64: 64-bit, hard-float, LE: /lib64/ld-linux-x86-64.so.2
> 
> So ptxdist will use lib64 as it's base for libdirs placing various
> libraries in a lib64 path.

Right, that was contributed a long time ago. But since I don't have a
test-case for this, the support for this has not been maintained.


> But when using the pkg-config-wrapper it looks like all libraries are
> only statically set from a something /lib path.
> 
> https://git.pengutronix.de/cgit/ptxdist/tree/scripts/pkg-config-wrapper#n19

Right, and here it get's ugly. I don't want to rely on some external
environment variable here. Maybe just search for the paths:

libdir=( $(find ${prefix} -maxdepth 3 -type d -name pkgconfig )

Would care to provide a patch for this?

Michael

> So building a library yields:
> $ ls -la platform-tracker/sysroot-target/usr/lib64/libmnl.so*
> lrwxrwxrwx 2 xxx users    15 Apr 22 21:01
> platform-tracker/sysroot-target/usr/lib64/libmnl.so -> libmnl.so.0.2.0*
> lrwxrwxrwx 2 xxx users    15 Apr 22 21:01
> platform-tracker/sysroot-target/usr/lib64/libmnl.so.0 -> libmnl.so.0.2.0*
> -rwxr-xr-x 2 xxx users 77216 Apr 22 21:01
> platform-tracker/sysroot-target/usr/lib64/libmnl.so.0.2.0*
> 
> $ ls -la platform-tracker/sysroot-target/usr/lib64/pkgconfig/libmnl.pc
> -rw-r--r-- 2 xxx users 318 Apr 22 21:01
> platform-tracker/sysroot-target/usr/lib64/pkgconfig/libmnl.pc
> 
> In the search for the library:
> PKG_CONFIG_DEBUG_SPEW variable enabling debug spew
> Adding directory
> '/home/xxx/work/tracker/bin/platform-tracker/sysroot-target/usr/lib/pkgconfig'
> from PKG_CONFIG_PATH
> Adding directory
> '/home/xxx/work/tracker/bin/platform-tracker/sysroot-target/usr/share/pkgconfig'
> from PKG_CONFIG_PATH
> Global variable definition 'pc_sysrootdir' = '/'
> Global variable definition 'pc_top_builddir' = '$(top_builddir)'
> Error printing enabled by default due to use of output options besides
> --exists, --atleast/exact/max-version or --list-all. Value of
> --silence-errors: 0
> Error printing enabled
> Adding virtual 'pkg-config' package to list of known packages
> Looking for package 'libmnl'
> Looking for package 'libmnl-uninstalled'
> No package 'libmnl' found
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
> 

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ptxdist] pkg-config-wrapper libdir confusion, ABI dynamic-linker path.
  2021-04-23  7:39 ` Michael Olbrich
@ 2021-04-23  8:17   ` Christian Melki
  2021-04-24 17:02   ` Christian Melki
  1 sibling, 0 replies; 9+ messages in thread
From: Christian Melki @ 2021-04-23  8:17 UTC (permalink / raw)
  To: ptxdist

On 4/23/21 9:39 AM, Michael Olbrich wrote:
> On Thu, Apr 22, 2021 at 09:59:06PM +0200, Christian Melki wrote:
>> I'm using a crosstool-ng toolchain which adheres to the ld.so ABI path
>> for x86_64 (glibc).
>>
>> Afaiu, ptxdist does not like multilib.
>> But it will happily get the dynamic-linker path which contain a multilib
>> description or just a regular lib64 path.
>>
>> https://git.pengutronix.de/cgit/ptxdist/tree/scripts/lib/ptxd_make_00-init.sh#n169
>>
>> This might be a symbolic link to the real dynamic linker, because a
>> demultilibbed toolchain must still adhere to the ABI specifications.
>> For x86_64: 64-bit, hard-float, LE: /lib64/ld-linux-x86-64.so.2
>>
>> So ptxdist will use lib64 as it's base for libdirs placing various
>> libraries in a lib64 path.
> 
> Right, that was contributed a long time ago. But since I don't have a
> test-case for this, the support for this has not been maintained.
> 
> 
>> But when using the pkg-config-wrapper it looks like all libraries are
>> only statically set from a something /lib path.
>>
>> https://git.pengutronix.de/cgit/ptxdist/tree/scripts/pkg-config-wrapper#n19
> 
> Right, and here it get's ugly. I don't want to rely on some external
> environment variable here. Maybe just search for the paths:
> 
> libdir=( $(find ${prefix} -maxdepth 3 -type d -name pkgconfig )
> 
> Would care to provide a patch for this?
> 
> Michael
> 

Sounds resonable. I can try that and provide a patch that (if?) works
for my case atleast. I'll rebuild a ct-ng toolchain without demultilibbing.

Maybe the following is valuable for someone reading this in the future.
I tinkered with ct-ng glibc extra params passed to configuration and
found these two to be useful to play with in situations like these.

# Forcibly try to set a libpath.
CT_GLIBC_EXTRA_CONFIG_ARRAY="libc_cv_slibdir=/lib"

# Make recognize multiple trusted directories upon start.
# Useful when ABI-spec is looking for /lib64 but stuff is elsewhere.
# The rest is managed with the regular ld.so path options.
CT_GLIBC_CONFIGPARMS="user-defined-trusted-dirs=/lib:/lib64"

>> So building a library yields:
>> $ ls -la platform-tracker/sysroot-target/usr/lib64/libmnl.so*
>> lrwxrwxrwx 2 xxx users    15 Apr 22 21:01
>> platform-tracker/sysroot-target/usr/lib64/libmnl.so -> libmnl.so.0.2.0*
>> lrwxrwxrwx 2 xxx users    15 Apr 22 21:01
>> platform-tracker/sysroot-target/usr/lib64/libmnl.so.0 -> libmnl.so.0.2.0*
>> -rwxr-xr-x 2 xxx users 77216 Apr 22 21:01
>> platform-tracker/sysroot-target/usr/lib64/libmnl.so.0.2.0*
>>
>> $ ls -la platform-tracker/sysroot-target/usr/lib64/pkgconfig/libmnl.pc
>> -rw-r--r-- 2 xxx users 318 Apr 22 21:01
>> platform-tracker/sysroot-target/usr/lib64/pkgconfig/libmnl.pc
>>
>> In the search for the library:
>> PKG_CONFIG_DEBUG_SPEW variable enabling debug spew
>> Adding directory
>> '/home/xxx/work/tracker/bin/platform-tracker/sysroot-target/usr/lib/pkgconfig'
>> from PKG_CONFIG_PATH
>> Adding directory
>> '/home/xxx/work/tracker/bin/platform-tracker/sysroot-target/usr/share/pkgconfig'
>> from PKG_CONFIG_PATH
>> Global variable definition 'pc_sysrootdir' = '/'
>> Global variable definition 'pc_top_builddir' = '$(top_builddir)'
>> Error printing enabled by default due to use of output options besides
>> --exists, --atleast/exact/max-version or --list-all. Value of
>> --silence-errors: 0
>> Error printing enabled
>> Adding virtual 'pkg-config' package to list of known packages
>> Looking for package 'libmnl'
>> Looking for package 'libmnl-uninstalled'
>> No package 'libmnl' found
>>
>> _______________________________________________
>> ptxdist mailing list
>> ptxdist@pengutronix.de
>> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
>>
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
> 


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ptxdist] pkg-config-wrapper libdir confusion, ABI dynamic-linker path.
  2021-04-23  7:39 ` Michael Olbrich
  2021-04-23  8:17   ` Christian Melki
@ 2021-04-24 17:02   ` Christian Melki
  2021-04-25  7:18     ` Michael Olbrich
  1 sibling, 1 reply; 9+ messages in thread
From: Christian Melki @ 2021-04-24 17:02 UTC (permalink / raw)
  To: ptxdist

On 4/23/21 9:39 AM, Michael Olbrich wrote:
> On Thu, Apr 22, 2021 at 09:59:06PM +0200, Christian Melki wrote:
>> I'm using a crosstool-ng toolchain which adheres to the ld.so ABI path
>> for x86_64 (glibc).
>>
>> Afaiu, ptxdist does not like multilib.
>> But it will happily get the dynamic-linker path which contain a multilib
>> description or just a regular lib64 path.
>>
>> https://git.pengutronix.de/cgit/ptxdist/tree/scripts/lib/ptxd_make_00-init.sh#n169
>>
>> This might be a symbolic link to the real dynamic linker, because a
>> demultilibbed toolchain must still adhere to the ABI specifications.
>> For x86_64: 64-bit, hard-float, LE: /lib64/ld-linux-x86-64.so.2
>>
>> So ptxdist will use lib64 as it's base for libdirs placing various
>> libraries in a lib64 path.
> 
> Right, that was contributed a long time ago. But since I don't have a
> test-case for this, the support for this has not been maintained.
> 
> 
>> But when using the pkg-config-wrapper it looks like all libraries are
>> only statically set from a something /lib path.
>>
>> https://git.pengutronix.de/cgit/ptxdist/tree/scripts/pkg-config-wrapper#n19
> 
> Right, and here it get's ugly. I don't want to rely on some external
> environment variable here. Maybe just search for the paths:
> 
> libdir=( $(find ${prefix} -maxdepth 3 -type d -name pkgconfig )
> 
> Would care to provide a patch for this?
> 
> Michael
> 

Tried a bit with a lib64 toolchain (non-demultilibbed). Got stuck in
whitelisting looking broken. So I found something else and got through
that bit.
But now I'm stuck in building OpenSSH after OpenSSL. OpenSSL gets placed
in /usr/lib not /usr/lib64.. Which I thought would be fine anyway, but
OpenSSH can't find libcrypto.

$ ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
--libdir=/usr/lib64 --build=x86_64-host-linux-gnu
--host=x86_64-tracker-linux-gnu --libexecdir=/usr/sbin
--sysconfdir=/etc/ssh --enable-largefile --disable-pkcs11
--disable-security-key --disable-strip --disable-etc-default-login
--disable-lastlog --disable-utmp --disable-utmpx --disable-wtmp
--disable-wtmpx --enable-libutil --disable-pututline
--disable-pututxline --with-openssl --with-stackprotect --with-hardening
--without-rpath --without-Werror
--with-zlib=/home/xxx/work/tracker/bin/platform-tracker/sysroot-target
--without-ldns --without-libedit --without-audit --with-pie
--without-ssl-engine --without-pam --with-privsep-user=sshd
--with-sandbox=seccomp_filter --without-selinux
--with-privsep-path=/var/run/sshd --without-md5-passwords

configure:12964: x86_64-tracker-linux-gnu-gcc -o conftest -g -O2 -pipe
-Wno-error=format-truncation -Wall -Wpointer-arith -Wuninitialized
-Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess
-Wno-pointer-sign -Wno-unused-result -Wimplicit-fallthrough
-fno-strict-aliasing -D_FORTIFY_SOURCE=2 -ftrapv -fno-builtin-memset
-fstack-protector-strong -fPIE
-I/home/xxx/work/tracker/bin/platform-tracker/sysroot-target/include
-D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE
-L/home/xxx/work/tracker/bin/platform-tracker/sysroot-target/lib
-Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -fstack-protector-strong -pie
conftest.c -lcrypto -ldl -lutil -lz  >&5
/home/xxx/work/tracker/x-tools/x86_64-tracker-linux-gnu/bin/../lib/gcc/x86_64-tracker-linux-gnu/10.3.0/../../../../x86_64-tracker-linux-gnu/bin/ld:
cannot find -lcrypto

-I and -L looks strange to me, but I can't figure out why.
I quite a few places looking like hardcoded stuff. But, yeah. My
knowledge of ptxdist innards is pretty limited.

This is what I got so far.

diff --git a/scripts/lib/ptxd_make_world_install.sh
b/scripts/lib/ptxd_make_world_install.sh
index e878a3231..22804f6e8 100644
--- a/scripts/lib/ptxd_make_world_install.sh
+++ b/scripts/lib/ptxd_make_world_install.sh
@@ -238,7 +238,7 @@ ptxd_make_world_install_post() {
     ptxd_make_world_init &&
     (
 	if [ -n "${pkg_pkg_dir}" -a -d "${pkg_pkg_dir}" ]; then
-	    find "${pkg_pkg_dir}"{,/usr}/{lib,share}/pkgconfig -name *.pc \
+	    find "${pkg_pkg_dir}"{,/usr}/{lib,lib64,share}/pkgconfig -name *.pc \
 		-printf "%f\n" 2>/dev/null | sed 's/\.pc$//'
 	elif [ "${pkg_type}" != "target" -a -n "${pkg_build_dir}" -a -d
"${pkg_build_dir}" ]; then
 	    # workaround for packages that install directly to sysroot
diff --git a/scripts/pkg-config-wrapper b/scripts/pkg-config-wrapper
index 53be1a987..f21676465 100755
--- a/scripts/pkg-config-wrapper
+++ b/scripts/pkg-config-wrapper
@@ -17,7 +17,7 @@ else
 fi

 declare -a libdir system_path system_incpath
-libdir=( "${prefix/%//lib/pkgconfig}" "${prefix/%//share/pkgconfig}" )
+libdir=( "$(find ${prefix} -maxdepth 3 -type d -name pkgconfig)" )
 system_libpath=( "${libdir[@]/%//../../lib}" "${libdir[@]/%//../lib}"
"/usr/lib" "/lib" )
 system_incpath=( "${libdir[@]/%//../../include}"
"${libdir[@]/%//../include}" "/usr/include" "/include" )



>> So building a library yields:
>> $ ls -la platform-tracker/sysroot-target/usr/lib64/libmnl.so*
>> lrwxrwxrwx 2 xxx users    15 Apr 22 21:01
>> platform-tracker/sysroot-target/usr/lib64/libmnl.so -> libmnl.so.0.2.0*
>> lrwxrwxrwx 2 xxx users    15 Apr 22 21:01
>> platform-tracker/sysroot-target/usr/lib64/libmnl.so.0 -> libmnl.so.0.2.0*
>> -rwxr-xr-x 2 xxx users 77216 Apr 22 21:01
>> platform-tracker/sysroot-target/usr/lib64/libmnl.so.0.2.0*
>>
>> $ ls -la platform-tracker/sysroot-target/usr/lib64/pkgconfig/libmnl.pc
>> -rw-r--r-- 2 xxx users 318 Apr 22 21:01
>> platform-tracker/sysroot-target/usr/lib64/pkgconfig/libmnl.pc
>>
>> In the search for the library:
>> PKG_CONFIG_DEBUG_SPEW variable enabling debug spew
>> Adding directory
>> '/home/xxx/work/tracker/bin/platform-tracker/sysroot-target/usr/lib/pkgconfig'
>> from PKG_CONFIG_PATH
>> Adding directory
>> '/home/xxx/work/tracker/bin/platform-tracker/sysroot-target/usr/share/pkgconfig'
>> from PKG_CONFIG_PATH
>> Global variable definition 'pc_sysrootdir' = '/'
>> Global variable definition 'pc_top_builddir' = '$(top_builddir)'
>> Error printing enabled by default due to use of output options besides
>> --exists, --atleast/exact/max-version or --list-all. Value of
>> --silence-errors: 0
>> Error printing enabled
>> Adding virtual 'pkg-config' package to list of known packages
>> Looking for package 'libmnl'
>> Looking for package 'libmnl-uninstalled'
>> No package 'libmnl' found
>>
>> _______________________________________________
>> ptxdist mailing list
>> ptxdist@pengutronix.de
>> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
>>
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
> 


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ptxdist] pkg-config-wrapper libdir confusion, ABI dynamic-linker path.
  2021-04-24 17:02   ` Christian Melki
@ 2021-04-25  7:18     ` Michael Olbrich
  2021-05-03 13:43       ` Christian Melki
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Olbrich @ 2021-04-25  7:18 UTC (permalink / raw)
  To: ptxdist

On Sat, Apr 24, 2021 at 07:02:05PM +0200, Christian Melki wrote:
> On 4/23/21 9:39 AM, Michael Olbrich wrote:
> > On Thu, Apr 22, 2021 at 09:59:06PM +0200, Christian Melki wrote:
> >> I'm using a crosstool-ng toolchain which adheres to the ld.so ABI path
> >> for x86_64 (glibc).
> >>
> >> Afaiu, ptxdist does not like multilib.
> >> But it will happily get the dynamic-linker path which contain a multilib
> >> description or just a regular lib64 path.
> >>
> >> https://git.pengutronix.de/cgit/ptxdist/tree/scripts/lib/ptxd_make_00-init.sh#n169
> >>
> >> This might be a symbolic link to the real dynamic linker, because a
> >> demultilibbed toolchain must still adhere to the ABI specifications.
> >> For x86_64: 64-bit, hard-float, LE: /lib64/ld-linux-x86-64.so.2
> >>
> >> So ptxdist will use lib64 as it's base for libdirs placing various
> >> libraries in a lib64 path.
> > 
> > Right, that was contributed a long time ago. But since I don't have a
> > test-case for this, the support for this has not been maintained.
> > 
> > 
> >> But when using the pkg-config-wrapper it looks like all libraries are
> >> only statically set from a something /lib path.
> >>
> >> https://git.pengutronix.de/cgit/ptxdist/tree/scripts/pkg-config-wrapper#n19
> > 
> > Right, and here it get's ugly. I don't want to rely on some external
> > environment variable here. Maybe just search for the paths:
> > 
> > libdir=( $(find ${prefix} -maxdepth 3 -type d -name pkgconfig )
> > 
> > Would care to provide a patch for this?
> 
> Tried a bit with a lib64 toolchain (non-demultilibbed). Got stuck in
> whitelisting looking broken. So I found something else and got through
> that bit.
> But now I'm stuck in building OpenSSH after OpenSSL. OpenSSL gets placed
> in /usr/lib not /usr/lib64.. Which I thought would be fine anyway, but
> OpenSSH can't find libcrypto.

Take a look at rules/openssl.make. In OPENSSL_CONF_OPT there is:

'--libdir=/usr/lib --openssldir=/usr/lib/ssl'

This should probably be:

'--libdir=/usr/$(CROSS_LIB_DIR) --openssldir=/usr/$(CROSS_LIB_DIR)/ssl'

I think.

> $ ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
> --libdir=/usr/lib64 --build=x86_64-host-linux-gnu
> --host=x86_64-tracker-linux-gnu --libexecdir=/usr/sbin
> --sysconfdir=/etc/ssh --enable-largefile --disable-pkcs11
> --disable-security-key --disable-strip --disable-etc-default-login
> --disable-lastlog --disable-utmp --disable-utmpx --disable-wtmp
> --disable-wtmpx --enable-libutil --disable-pututline
> --disable-pututxline --with-openssl --with-stackprotect --with-hardening
> --without-rpath --without-Werror
> --with-zlib=/home/xxx/work/tracker/bin/platform-tracker/sysroot-target
> --without-ldns --without-libedit --without-audit --with-pie
> --without-ssl-engine --without-pam --with-privsep-user=sshd
> --with-sandbox=seccomp_filter --without-selinux
> --with-privsep-path=/var/run/sshd --without-md5-passwords
> 
> configure:12964: x86_64-tracker-linux-gnu-gcc -o conftest -g -O2 -pipe
> -Wno-error=format-truncation -Wall -Wpointer-arith -Wuninitialized
> -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess
> -Wno-pointer-sign -Wno-unused-result -Wimplicit-fallthrough
> -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -ftrapv -fno-builtin-memset
> -fstack-protector-strong -fPIE
> -I/home/xxx/work/tracker/bin/platform-tracker/sysroot-target/include
> -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE
> -L/home/xxx/work/tracker/bin/platform-tracker/sysroot-target/lib
> -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -fstack-protector-strong -pie
> conftest.c -lcrypto -ldl -lutil -lz  >&5
> /home/xxx/work/tracker/x-tools/x86_64-tracker-linux-gnu/bin/../lib/gcc/x86_64-tracker-linux-gnu/10.3.0/../../../../x86_64-tracker-linux-gnu/bin/ld:
> cannot find -lcrypto
> 
> -I and -L looks strange to me, but I can't figure out why.
> I quite a few places looking like hardcoded stuff. But, yeah. My
> knowledge of ptxdist innards is pretty limited.

That looks strange indeed. I'm not sure where this is coming from.

> This is what I got so far.
> 
> diff --git a/scripts/lib/ptxd_make_world_install.sh
> b/scripts/lib/ptxd_make_world_install.sh
> index e878a3231..22804f6e8 100644
> --- a/scripts/lib/ptxd_make_world_install.sh
> +++ b/scripts/lib/ptxd_make_world_install.sh
> @@ -238,7 +238,7 @@ ptxd_make_world_install_post() {
>      ptxd_make_world_init &&
>      (
>  	if [ -n "${pkg_pkg_dir}" -a -d "${pkg_pkg_dir}" ]; then
> -	    find "${pkg_pkg_dir}"{,/usr}/{lib,share}/pkgconfig -name *.pc \
> +	    find "${pkg_pkg_dir}"{,/usr}/{lib,lib64,share}/pkgconfig -name *.pc \

+	    find "${pkg_pkg_dir}"{,/usr}/{$(ptxd_get_lib_dir),share}/pkgconfig -name *.pc \

Should work here.

>  		-printf "%f\n" 2>/dev/null | sed 's/\.pc$//'
>  	elif [ "${pkg_type}" != "target" -a -n "${pkg_build_dir}" -a -d
> "${pkg_build_dir}" ]; then
>  	    # workaround for packages that install directly to sysroot
> diff --git a/scripts/pkg-config-wrapper b/scripts/pkg-config-wrapper
> index 53be1a987..f21676465 100755
> --- a/scripts/pkg-config-wrapper
> +++ b/scripts/pkg-config-wrapper
> @@ -17,7 +17,7 @@ else
>  fi
> 
>  declare -a libdir system_path system_incpath
> -libdir=( "${prefix/%//lib/pkgconfig}" "${prefix/%//share/pkgconfig}" )
> +libdir=( "$(find ${prefix} -maxdepth 3 -type d -name pkgconfig)" )

We just need the find here instead because ptxd_get_lib_dir is not
available here.

>  system_libpath=( "${libdir[@]/%//../../lib}" "${libdir[@]/%//../lib}"

Hmmm, we should fix that too, but that's mostly cosmetic: pkg-config skips
these paths when adding '-L' options. And some extra shouldn't hurt.

Michael

> "/usr/lib" "/lib" )
>  system_incpath=( "${libdir[@]/%//../../include}"
> "${libdir[@]/%//../include}" "/usr/include" "/include" )

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ptxdist] pkg-config-wrapper libdir confusion, ABI dynamic-linker path.
  2021-04-25  7:18     ` Michael Olbrich
@ 2021-05-03 13:43       ` Christian Melki
  2021-05-07  7:15         ` [ptxdist] [PATCH] pkg-config-wrapper: calculate the system paths dynamically as well Michael Olbrich
  0 siblings, 1 reply; 9+ messages in thread
From: Christian Melki @ 2021-05-03 13:43 UTC (permalink / raw)
  To: Michael Olbrich, ptxdist

> 
>>  system_libpath=( "${libdir[@]/%//../../lib}" "${libdir[@]/%//../lib}"
> 
> Hmmm, we should fix that too, but that's mostly cosmetic: pkg-config skips
> these paths when adding '-L' options. And some extra shouldn't hurt.
> 
> Michael

Hmm. I could not leave this out. Apparently some packages use this and
would resolve libraries on my host as -L/usr/lib64/whatever. Which would
contain other libraries (x86 compilation) and fail to link.

> 
>> "/usr/lib" "/lib" )
>>  system_incpath=( "${libdir[@]/%//../../include}"
>> "${libdir[@]/%//../include}" "/usr/include" "/include" )
> 


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ptxdist] [PATCH] pkg-config-wrapper: calculate the system paths dynamically as well
  2021-05-03 13:43       ` Christian Melki
@ 2021-05-07  7:15         ` Michael Olbrich
  2021-05-07 11:14           ` Christian Melki
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Olbrich @ 2021-05-07  7:15 UTC (permalink / raw)
  To: ptxdist; +Cc: Christian Melki, Michael Olbrich

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
---

Would this work? Or do we need to exclude /usr/lib explicitly as well?

Michael

 scripts/pkg-config-wrapper | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/scripts/pkg-config-wrapper b/scripts/pkg-config-wrapper
index d86fa7c683b5..dd786e47b212 100755
--- a/scripts/pkg-config-wrapper
+++ b/scripts/pkg-config-wrapper
@@ -17,9 +17,11 @@ else
 fi
 
 declare -a libdir system_path system_incpath
-libdir=( $(find ${prefix} -maxdepth 3 -type d -name pkgconfig) )
-system_libpath=( "${libdir[@]/%//../../lib}" "${libdir[@]/%//../lib}" "/usr/lib" "/lib" )
-system_incpath=( "${libdir[@]/%//../../include}" "${libdir[@]/%//../include}" "/usr/include" "/include" )
+libdir=( $(find ${prefix} -maxdepth 3 -type d -path */lib*/pkgconfig) )
+lib="$(basename $(dirname ${libdir[0]}))"
+libdir+=( "${prefix/%//share/pkgconfig}" )
+system_libpath=( "${libdir[@]/%//../../${lib}}" "/usr/${lib}" "/${lib}" )
+system_incpath=( "${libdir[@]/%//../../include}" "/usr/include" "/include" )
 
 orig_IFS="${IFS}"
 IFS=":"
-- 
2.29.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ptxdist] [PATCH] pkg-config-wrapper: calculate the system paths dynamically as well
  2021-05-07  7:15         ` [ptxdist] [PATCH] pkg-config-wrapper: calculate the system paths dynamically as well Michael Olbrich
@ 2021-05-07 11:14           ` Christian Melki
  2021-05-07 12:14             ` Michael Olbrich
  0 siblings, 1 reply; 9+ messages in thread
From: Christian Melki @ 2021-05-07 11:14 UTC (permalink / raw)
  To: Michael Olbrich, ptxdist

On 5/7/21 9:15 AM, Michael Olbrich wrote:
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
> ---
> 
> Would this work? Or do we need to exclude /usr/lib explicitly as well?
> 
> Michael
> 
>  scripts/pkg-config-wrapper | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/scripts/pkg-config-wrapper b/scripts/pkg-config-wrapper
> index d86fa7c683b5..dd786e47b212 100755
> --- a/scripts/pkg-config-wrapper
> +++ b/scripts/pkg-config-wrapper
> @@ -17,9 +17,11 @@ else
>  fi
>  
>  declare -a libdir system_path system_incpath
> -libdir=( $(find ${prefix} -maxdepth 3 -type d -name pkgconfig) > -system_libpath=( "${libdir[@]/%//../../lib}" "${libdir[@]/%//../lib}"
"/usr/lib" "/lib" )
> -system_incpath=( "${libdir[@]/%//../../include}" "${libdir[@]/%//../include}" "/usr/include" "/include" )
> +libdir=( $(find ${prefix} -maxdepth 3 -type d -path */lib*/pkgconfig) )
> +lib="$(basename $(dirname ${libdir[0]}))"

Only one libdir? Lost lib64 in translation? Not sure I understand this.

> +libdir+=( "${prefix/%//share/pkgconfig}" )
> +system_libpath=( "${libdir[@]/%//../../${lib}}" "/usr/${lib}" "/${lib}" )

This looks strange to me. libdir contains lib64, but $lib is only "lib".

Doesn't this assume that system libpath is the same as the target?
I'm a bit confused what the filtering needs to filter.
Removing host directories, whatever they may be or removing directories
that are similar to those we are including?

Couldn't host path filtering be of similar construction as the cross libdir?

> +system_incpath=( "${libdir[@]/%//../../include}" "/usr/include" "/include"

Not sure i understand libdir to include path filtering either. :)
This becomes sysroot-target/usr/lib{64}/pkgconfig/../../include,
/usr/include. /include?

>  
>  orig_IFS="${IFS}"
>  IFS=":"
> 


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ptxdist] [PATCH] pkg-config-wrapper: calculate the system paths dynamically as well
  2021-05-07 11:14           ` Christian Melki
@ 2021-05-07 12:14             ` Michael Olbrich
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Olbrich @ 2021-05-07 12:14 UTC (permalink / raw)
  To: ptxdist

On Fri, May 07, 2021 at 01:14:02PM +0200, Christian Melki wrote:
> On 5/7/21 9:15 AM, Michael Olbrich wrote:
> > Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
> > ---
> > 
> > Would this work? Or do we need to exclude /usr/lib explicitly as well?
> > 
> > Michael
> > 
> >  scripts/pkg-config-wrapper | 8 +++++---
> >  1 file changed, 5 insertions(+), 3 deletions(-)
> > 
> > diff --git a/scripts/pkg-config-wrapper b/scripts/pkg-config-wrapper
> > index d86fa7c683b5..dd786e47b212 100755
> > --- a/scripts/pkg-config-wrapper
> > +++ b/scripts/pkg-config-wrapper
> > @@ -17,9 +17,11 @@ else
> >  fi
> >  
> >  declare -a libdir system_path system_incpath
> > -libdir=( $(find ${prefix} -maxdepth 3 -type d -name pkgconfig) > -system_libpath=( "${libdir[@]/%//../../lib}" "${libdir[@]/%//../lib}"
> "/usr/lib" "/lib" )
> > -system_incpath=( "${libdir[@]/%//../../include}" "${libdir[@]/%//../include}" "/usr/include" "/include" )
> > +libdir=( $(find ${prefix} -maxdepth 3 -type d -path */lib*/pkgconfig) )
> > +lib="$(basename $(dirname ${libdir[0]}))"
> 
> Only one libdir? Lost lib64 in translation? Not sure I understand this.

My expectation was that ${libdir[0]} is .../sysroot-target/usr/lib64/pkgconfig
in your case. I want to use it to find out if lib or lib64 is correct.
What's the result of the 'find' above?

> > +libdir+=( "${prefix/%//share/pkgconfig}" )
> > +system_libpath=( "${libdir[@]/%//../../${lib}}" "/usr/${lib}" "/${lib}" )
> 
> This looks strange to me. libdir contains lib64, but $lib is only "lib".
> 
> Doesn't this assume that system libpath is the same as the target?
> I'm a bit confused what the filtering needs to filter.
> Removing host directories, whatever they may be or removing directories
> that are similar to those we are including?

The .pc files usually generate search paths like this:
1. Relative to the .pc file itself. This results in something like this:
   -L[....]/sysroot-target/usr/lib64/pkgconfig/../../lib64
2. Absolute based on the prefix/libdir specified during configure etc.:
   -L/usr/lib64

So note that the second on is not really a host path but a target path
without the sysroot prefix.

> Couldn't host path filtering be of similar construction as the cross libdir?
> 
> > +system_incpath=( "${libdir[@]/%//../../include}" "/usr/include" "/include"

They are not really host paths. See above.

> Not sure i understand libdir to include path filtering either. :)
> This becomes sysroot-target/usr/lib{64}/pkgconfig/../../include,
> /usr/include. /include?

Correct. Those paths will be removed from the pkg-config output.

Michael

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-05-07 12:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-22 19:59 [ptxdist] pkg-config-wrapper libdir confusion, ABI dynamic-linker path Christian Melki
2021-04-23  7:39 ` Michael Olbrich
2021-04-23  8:17   ` Christian Melki
2021-04-24 17:02   ` Christian Melki
2021-04-25  7:18     ` Michael Olbrich
2021-05-03 13:43       ` Christian Melki
2021-05-07  7:15         ` [ptxdist] [PATCH] pkg-config-wrapper: calculate the system paths dynamically as well Michael Olbrich
2021-05-07 11:14           ` Christian Melki
2021-05-07 12:14             ` Michael Olbrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox