From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Sun, 25 Apr 2021 09:18:45 +0200 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1laZ2T-00016t-7J for lore@lore.pengutronix.de; Sun, 25 Apr 2021 09:18:45 +0200 Received: from localhost ([127.0.0.1] helo=metis.ext.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1laZ2S-0003Sy-MN; Sun, 25 Apr 2021 09:18:44 +0200 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1laZ1o-0003Sr-Af for ptxdist@pengutronix.de; Sun, 25 Apr 2021 09:18:04 +0200 Received: from mol by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1laZ1o-0004HW-0c for ptxdist@pengutronix.de; Sun, 25 Apr 2021 09:18:04 +0200 Date: Sun, 25 Apr 2021 09:18:03 +0200 From: Michael Olbrich To: ptxdist@pengutronix.de Message-ID: <20210425071803.GD27464@pengutronix.de> Mail-Followup-To: ptxdist@pengutronix.de References: <30a9fa38-3276-c5dc-c36b-51f02483ed0f@t2data.com> <20210423073918.GG4162561@pengutronix.de> <9ac8d312-177c-36f4-3154-0138d56e56f9@t2data.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <9ac8d312-177c-36f4-3154-0138d56e56f9@t2data.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 09:11:21 up 66 days, 10:35, 61 users, load average: 0.20, 0.15, 0.12 User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [ptxdist] pkg-config-wrapper libdir confusion, ABI dynamic-linker path. X-BeenThere: ptxdist@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "ptxdist" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: ptxdist-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false 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