From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Fri, 29 Jul 2022 08:40:36 +0200 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1oHJfo-003Gfe-Ru for lore@lore.pengutronix.de; Fri, 29 Jul 2022 08:40:36 +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 1oHJfo-0007Om-3d; Fri, 29 Jul 2022 08:40:36 +0200 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oHJfZ-0007OQ-Jq; Fri, 29 Jul 2022 08:40:21 +0200 Received: from [2a0a:edc0:0:1101:1d::39] (helo=dude03.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1oHJfY-000SRL-TE; Fri, 29 Jul 2022 08:40:20 +0200 Received: from mol by dude03.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1oHJfX-00A86T-Rr; Fri, 29 Jul 2022 08:40:19 +0200 Date: Fri, 29 Jul 2022 08:40:19 +0200 From: Michael Olbrich To: Alexander Dahl Message-ID: Mail-Followup-To: Alexander Dahl , ptxdist@pengutronix.de, Alexander Dahl References: <15979690.J2xNbxXsf2@ada> <4722212.1oGcgTFBSJ@ada> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4722212.1oGcgTFBSJ@ada> 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 Subject: Re: [ptxdist] Build U-Boot against host-openssl fails 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 Cc: Alexander Dahl , ptxdist@pengutronix.de 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 Tue, Jul 26, 2022 at 09:43:09AM +0200, Alexander Dahl wrote: > Am Montag, 25. Juli 2022, 21:09:35 CEST schrieb Alexander Dahl: > > Am Mon, Jul 25, 2022 at 05:36:57PM +0200 schrieb Michael Olbrich: > > > On Mon, Jul 25, 2022 at 04:41:45PM +0200, Alexander Dahl wrote: > > > > although claiming it's optional latest U-Boot versions require OpenSSL > > > > on the host.¹ I added an option to build host-openssl with commit > > > > 0c779a60e50c40d522b1e9c20b5c75b2e57fde5a ("u-boot: Add option to depend > > > > on > > > > host-openssl") but ptxdist u-boot package still fails to link to host > > > > openssl package, message is always missing some openssl symbols. > > > > > > > > I tried the same thing as barebox now in rules/u-boot.make like this: > > > > > > > > +# use host pkg-config for host tools > > > > +U_BOOT_PATH := PATH=$(HOST_PATH) > > > > > > > > This does not help. > > > > > > > > I'm somehow suspecting the wrong pkg-config is called. Affected is not > > > > the > > > > target image, but the host tools (like mkimage) built alongside with the > > > > target stuff (which you 1) can not disable to build and 2) need for > > > > certain > > > > parts of the ptxdist package anyways, so not building those is no > > > > option). > > > > > > > > I tried each combination of PTXCONF_U_BOOT_NEEDS_HOST_OPENSSL and > > > > CONFIG_TOOLS_LIBCRYPTO in U-Boot kconfig, all fail. > > > > > > > > buildroot has a fix for building against host-openssl, but I don't > > > > understand it, and I'm not sure if the same approach would work in > > > > ptxdist. > > > > > > > > Any ideas? > > > > > > > > (Disclaimer: this only happens on a quite recent U-Boot, e.g. from > > > > 2022.) > > > > (More disclaimer: it does not happen if libssl-dev is installed on the > > > > build host.) > > > > > > This sounds like u-boot is calling /usr/bin/pkg-config instead of > > > .../sysroot-host/bin/pkg-config (and not the cross pkg-config either). > > > > > > Maybe /usr/bin/pkg-config is called explicitly with the whole path > > > somewhere? That could be a "feature" to avoid the cross pkg-config when > > > cross-compiling. > > > > Sorry, I wanted to paste the actual part from tools/Makefile (u-boot > > source) and this is it: > > > > 174 # MXSImage needs LibSSL > > 175 ifneq > > ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_TOOLS_LIBCRYPTO), > > ) 176 HOSTCFLAGS_kwbimage.o += \ > > 177 $(shell pkg-config --cflags libssl libcrypto 2> /dev/null || echo > > "") 178 HOSTLDLIBS_mkimage += \ > > 179 $(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo > > "-lssl -lcrypto") 180 > > 181 # OS X deprecate openssl in favour of CommonCrypto, supress deprecation > > 182 # warnings on those systems > > 183 ifeq ($(HOSTOS),darwin) > > 184 HOSTCFLAGS_mxsimage.o += -Wno-deprecated-declarations > > 185 HOSTCFLAGS_image-sig.o += -Wno-deprecated-declarations > > 186 HOSTCFLAGS_rsa-sign.o += -Wno-deprecated-declarations > > 187 endif > > 188 endif > > > > I'm not sure how I can verify what's actually called here? > > Added this line in U-Boot source tools/Makefile to see what's going on: > > $(info HOSTLDLIBS_mkimage is $(HOSTLDLIBS_mkimage)) > > (directly after that is assigned) > > Output is: > > HOSTLDLIBS_mkimage is -lssl -lcrypto > > > Just had another look at what buildroot does. Seems like > > host-pkg-config is required, IIRC that was not used by ptxdist. Not > > sure how I can let ptxdist use host pkg-config, but I hope I'll find > > out tomorrow. > > Yeah well, it was late yesterday, what the barebox package does is setting > _PATH and I tried that already (as written before). So I tried calling > pkg-config with that path the same way the U-Boot Makefile does (redacted): > > > % p print U_BOOT_PATH > PATH=/home/adahl/Work/bsp/***/***/platform-***/sysroot-host/bin:/home/adahl/ > Work/bsp/***/***/platform-***/sysroot-host/sbin:/opt/ > OSELAS.Toolchain-2018.02.0/arm-v7a-linux-gnueabihf/gcc-7.3.1-glibc-2.27- > binutils-2.30-kernel-4.15-sanitized/bin:/usr/local/lib/ptxdist-2018.05.0/bin:/ > home/adahl/Work/bsp/***/***/platform-***/sysroot-host/bin:/home/adahl/Work/ > bsp/***/***/platform-***/sysroot-host/sbin:/opt/OSELAS.Toolchain-2018.02.0/ > arm-v7a-linux-gnueabihf/gcc-7.3.1-glibc-2.27-binutils-2.30-kernel-4.15- > sanitized/bin:/usr/local/lib/ptxdist-2022.05.0/bin:/home/adahl/bin:/home/ > adahl/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games > > % PATH=/home/adahl/Work/bsp/***/***/platform-***/sysroot-host/bin:/home/adahl/ > Work/bsp/***/***/platform-***/sysroot-host/sbin:/opt/ > OSELAS.Toolchain-2018.02.0/arm-v7a-linux-gnueabihf/gcc-7.3.1-glibc-2.27- > binutils-2.30-kernel-4.15-sanitized/bin:/usr/local/lib/ptxdist-2018.05.0/bin:/ > home/adahl/Work/bsp/***/***/platform-***/sysroot-host/bin:/home/adahl/Work/ > bsp/***/***/platform-***/sysroot-host/sbin:/opt/OSELAS.Toolchain-2018.02.0/ > arm-v7a-linux-gnueabihf/gcc-7.3.1-glibc-2.27-binutils-2.30-kernel-4.15- > sanitized/bin:/usr/local/lib/ptxdist-2022.05.0/bin:/home/adahl/bin:/home/ > adahl/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games pkg- > config --libs libssl libcrypto > -L/home/adahl/Work/bsp/***/***/platform-***/sysroot-host/lib/pkgconfig/../..// > lib -lssl -lcrypto > > > Okay this seems to call some pkg-config which gives the right path (see the -L > output) but U-Boot does not produce that output as you can see above. > > When calling ptxdist (verbose) the path seems to be slightly different > however: > > % p -v -j1 compile u-boot > > ---------------------- > target: u-boot.compile > ---------------------- > > ptxdist: executing: PATH=\/home/adahl/Work/bsp/***/***/platform-***/sysroot- > host/lib/wrapper:/home/adahl/Work/bsp/***/***/platform-***/sysroot-host/bin:/ > home/adahl/Work/bsp/***/***/platform-***/sysroot-host/sbin:/opt/ > OSELAS.Toolchain-2018.02.0/arm-v7a-linux-gnueabihf/gcc-7.3.1-glibc-2.27- > binutils-2.30-kernel-4.15-sanitized/bin:/usr/local/lib/ptxdist-2018.05.0/bin:/ > home/adahl/Work/bsp/***/***/platform-***/sysroot-host/bin:/home/adahl/Work/ > bsp/***/***/platform-***/sysroot-host/sbin:/opt/OSELAS.Toolchain-2018.02.0/ > arm-v7a-linux-gnueabihf/gcc-7.3.1-glibc-2.27-binutils-2.30-kernel-4.15- > sanitized/bin:/usr/local/lib/ptxdist-2022.05.0/bin:/home/adahl/bin:/home/ > adahl/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games > PKGCONFIG_WHITELIST='' PKGCONFIG_WHITELIST_SRC='u-boot' PKG_CONFIG_PATH='' With an empty whitelist like this, the pkg-config in ptxdist will reject all requests with error. > PKG_CONFIG_LIBDIR='/home/adahl/Work/bsp/***/***/platform-***/sysroot-target/ > lib/pkgconfig:/home/adahl/Work/bsp/***/***/platform-***/sysroot-target/usr/ > lib/pkgconfig:/home/adahl/Work/bsp/***/***/platform-***/sysroot-target/share/ > pkgconfig:/home/adahl/Work/bsp/***/***/platform-***/sysroot-target/usr/share/ > pkgconfig' PKG_CONFIG_SYSTEM_LIBRARY_PATH='/home/adahl/Work/bsp/***/***/ > platform-***/sysroot-target/lib/pkgconfig/../../lib:/home/adahl/Work/bsp/***/ > ***/platform-***/sysroot-target/usr/lib/pkgconfig/../../lib:/home/adahl/Work/ > bsp/***/***/platform-***/sysroot-target/share/pkgconfig/../../lib:/home/adahl/ > Work/bsp/***/***/platform-***/sysroot-target/usr/share/pkgconfig/../../lib:/ > home/adahl/Work/bsp/***/***/platform-***/sysroot-target/lib/pkgconfig/../lib:/ > home/adahl/Work/bsp/***/***/platform-***/sysroot-target/usr/lib/pkgconfig/../ > lib:/home/adahl/Work/bsp/***/***/platform-***/sysroot-target/share/ > pkgconfig/../lib:/home/adahl/Work/bsp/***/***/platform-***/sysroot-target/usr/ > share/pkgconfig/../lib:/usr/lib:/lib' PKG_CONFIG_SYSTEM_INCLUDE_PATH='/home/ > adahl/Work/bsp/***/***/platform-***/sysroot-target/lib/pkgconfig/../../ > include:/home/adahl/Work/bsp/***/***/platform-***/sysroot-target/usr/lib/ > pkgconfig/../../include:/home/adahl/Work/bsp/***/***/platform-***/sysroot- > target/share/pkgconfig/../../include:/home/adahl/Work/bsp/***/***/platform- > ***/sysroot-target/usr/share/pkgconfig/../../include:/home/adahl/Work/bsp/***/ > ***/platform-***/sysroot-target/lib/pkgconfig/../include:/home/adahl/Work/bsp/ > ***/***/platform-***/sysroot-target/usr/lib/pkgconfig/../include:/home/adahl/ > Work/bsp/***/***/platform-***/sysroot-target/share/pkgconfig/../include:/home/ > adahl/Work/bsp/***/***/platform-***/sysroot-target/usr/share/pkgconfig/../ > include:/usr/include:/include' PKG_CONFIG='/home/adahl/Work/bsp/***/***/ > platform-***/sysroot-cross/bin/arm-v7a-linux-gnueabihf-pkg-config' SYSROOT='/ > home/adahl/Work/bsp/***/***/platform-***/sysroot-target' V=1 VERBOSE=1 > CROSS_COMPILE=arm-v7a-linux-gnueabihf- HOSTCC=gcc make -C /home/adahl/Work/ > bsp/***/***/platform-***/build-target/u-boot-2022.04-build -C /home/adahl/ > Work/bsp/***/***/platform-***/build-target/u-boot-2022.04 O=/home/adahl/Work/ > bsp/***/***/platform-***/build-target/u-boot-2022.04-build V=1 -j1 > > > This adds an additional piece to the path (/home/adahl/Work/bsp/***/***/ > platform-***/sysroot-host/lib/wrapper), but even if I call pkg-config with > this, the output seems correct: > > > % PATH=/home/adahl/Work/bsp/***/***/platform-***/sysroot-host/lib/wrapper:/ > home/adahl/Work/bsp/***/***/platform-***/sysroot-host/bin:/home/adahl/Work/ > bsp/***/***/platform-***/sysroot-host/sbin:/opt/OSELAS.Toolchain-2018.02.0/ > arm-v7a-linux-gnueabihf/gcc-7.3.1-glibc-2.27-binutils-2.30-kernel-4.15- > sanitized/bin:/usr/local/lib/ptxdist-2018.05.0/bin:/home/adahl/Work/bsp/***/ > ***/platform-***/sysroot-host/bin:/home/adahl/Work/bsp/***/***/platform-***/ > sysroot-host/sbin:/opt/OSELAS.Toolchain-2018.02.0/arm-v7a-linux-gnueabihf/ > gcc-7.3.1-glibc-2.27-binutils-2.30-kernel-4.15-sanitized/bin:/usr/local/lib/ > ptxdist-2022.05.0/bin:/home/adahl/bin:/home/adahl/.local/bin:/usr/local/bin:/ > usr/bin:/bin:/usr/local/games:/usr/games pkg-config --libs libssl libcrypto > -L/home/adahl/Work/bsp/***/***/platform-***/sysroot-host/lib/pkgconfig/../..// > lib -lssl -lcrypto > > > I don't understand it. > > This is still ptxdist-2018.05.0 … can that be a problem here? With that ptxdist version pkg-config cannot find host libraries for target packages. That was introduced in 4c6e7fa28b66dee069d10b514d5e1317173da250. How does this fail anyways? The fall-back ("-lssl -lcrypto" and now search paths) should just work anyways. 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 |