From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Tue, 26 Jul 2022 09:43:56 +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 1oGFES-004OyP-OP for lore@lore.pengutronix.de; Tue, 26 Jul 2022 09:43:56 +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 1oGFER-0006Tn-BK; Tue, 26 Jul 2022 09:43:55 +0200 Received: from mail.thorsis.com ([92.198.35.195]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1oGFDi-0006Te-UD for ptxdist@pengutronix.de; Tue, 26 Jul 2022 09:43:12 +0200 From: Alexander Dahl To: ptxdist@pengutronix.de Date: Tue, 26 Jul 2022 09:43:09 +0200 Message-ID: <4722212.1oGcgTFBSJ@ada> In-Reply-To: References: <15979690.J2xNbxXsf2@ada> Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Clacks-Overhead: GNU Terry Pratchett X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on metis.ext.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-2.6 required=4.0 tests=AWL,BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 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 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 Good morning, Am Montag, 25. Juli 2022, 21:09:35 CEST schrieb Alexander Dahl: > Hello Michael, >=20 > 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: > > > Hei hei, > > >=20 > > > although claiming it's optional latest U-Boot versions require OpenSSL > > > on the host.=C2=B9 I added an option to build host-openssl with comm= it > > > 0c779a60e50c40d522b1e9c20b5c75b2e57fde5a ("u-boot: Add option to depe= nd > > > on > > > host-openssl") but ptxdist u-boot package still fails to link to host > > > openssl package, message is always missing some openssl symbols. > > >=20 > > > I tried the same thing as barebox now in rules/u-boot.make like this: > > >=20 > > > +# use host pkg-config for host tools > > > +U_BOOT_PATH :=3D PATH=3D$(HOST_PATH) > > >=20 > > > This does not help. > > >=20 > > > I'm somehow suspecting the wrong pkg-config is called. Affected is n= ot > > > 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). > > >=20 > > > I tried each combination of PTXCONF_U_BOOT_NEEDS_HOST_OPENSSL and > > > CONFIG_TOOLS_LIBCRYPTO in U-Boot kconfig, all fail. > > >=20 > > > 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. > > >=20 > > > Any ideas? > > >=20 > > > (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.) > >=20 > > 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). > >=20 > > 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. >=20 > Sorry, I wanted to paste the actual part from tools/Makefile (u-boot > source) and this is it: >=20 > 174 # MXSImage needs LibSSL > 175 ifneq > ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_TOOLS_LIBCRYPTO= ), > ) 176 HOSTCFLAGS_kwbimage.o +=3D \ > 177 $(shell pkg-config --cflags libssl libcrypto 2> /dev/null || echo > "") 178 HOSTLDLIBS_mkimage +=3D \ > 179 $(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo > "-lssl -lcrypto") 180 > 181 # OS X deprecate openssl in favour of CommonCrypto, supress deprecati= on > 182 # warnings on those systems > 183 ifeq ($(HOSTOS),darwin) > 184 HOSTCFLAGS_mxsimage.o +=3D -Wno-deprecated-declarations > 185 HOSTCFLAGS_image-sig.o +=3D -Wno-deprecated-declarations > 186 HOSTCFLAGS_rsa-sign.o +=3D -Wno-deprecated-declarations > 187 endif > 188 endif >=20 > 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:=20 $(info HOSTLDLIBS_mkimage is $(HOSTLDLIBS_mkimage)) (directly after that is assigned) Output is: HOSTLDLIBS_mkimage is -lssl -lcrypto=20 > 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= =20 _PATH and I tried that already (as written before). So I tried calling= =20 pkg-config with that path the same way the U-Boot Makefile does (redacted): % p print U_BOOT_PATH PATH=3D/home/adahl/Work/bsp/***/***/platform-***/sysroot-host/bin:/home/ada= hl/ 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/bi= n:/ 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=3D/home/adahl/Work/bsp/***/***/platform-***/sysroot-host/bin:/home/a= dahl/ 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/bi= n:/ 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 p= kg- config --libs libssl libcrypto =2DL/home/adahl/Work/bsp/***/***/platform-***/sysroot-host/lib/pkgconfig/..= /..// lib -lssl -lcrypto=20 Okay this seems to call some pkg-config which gives the right path (see the= -L=20 output) but U-Boot does not produce that output as you can see above.=20 When calling ptxdist (verbose) the path seems to be slightly different=20 however: % p -v -j1 compile u-boot =2D--------------------- target: u-boot.compile =2D--------------------- ptxdist: executing: PATH=3D\/home/adahl/Work/bsp/***/***/platform-***/sysro= ot- 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/bi= n:/ 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=20 PKGCONFIG_WHITELIST=3D'' PKGCONFIG_WHITELIST_SRC=3D'u-boot' PKG_CONFIG_PATH= =3D''=20 PKG_CONFIG_LIBDIR=3D'/home/adahl/Work/bsp/***/***/platform-***/sysroot-targ= et/ lib/pkgconfig:/home/adahl/Work/bsp/***/***/platform-***/sysroot-target/usr/ lib/pkgconfig:/home/adahl/Work/bsp/***/***/platform-***/sysroot-target/shar= e/ pkgconfig:/home/adahl/Work/bsp/***/***/platform-***/sysroot-target/usr/shar= e/ pkgconfig' PKG_CONFIG_SYSTEM_LIBRARY_PATH=3D'/home/adahl/Work/bsp/***/***/ platform-***/sysroot-target/lib/pkgconfig/../../lib:/home/adahl/Work/bsp/**= */ ***/platform-***/sysroot-target/usr/lib/pkgconfig/../../lib:/home/adahl/Wor= k/ bsp/***/***/platform-***/sysroot-target/share/pkgconfig/../../lib:/home/ada= hl/ Work/bsp/***/***/platform-***/sysroot-target/usr/share/pkgconfig/../../lib:/ home/adahl/Work/bsp/***/***/platform-***/sysroot-target/lib/pkgconfig/../li= b:/ home/adahl/Work/bsp/***/***/platform-***/sysroot-target/usr/lib/pkgconfig/.= =2E/ lib:/home/adahl/Work/bsp/***/***/platform-***/sysroot-target/share/ pkgconfig/../lib:/home/adahl/Work/bsp/***/***/platform-***/sysroot-target/u= sr/ share/pkgconfig/../lib:/usr/lib:/lib' PKG_CONFIG_SYSTEM_INCLUDE_PATH=3D'/ho= me/ 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/b= sp/ ***/***/platform-***/sysroot-target/usr/lib/pkgconfig/../include:/home/adah= l/ Work/bsp/***/***/platform-***/sysroot-target/share/pkgconfig/../include:/ho= me/ adahl/Work/bsp/***/***/platform-***/sysroot-target/usr/share/pkgconfig/../ include:/usr/include:/include' PKG_CONFIG=3D'/home/adahl/Work/bsp/***/***/ platform-***/sysroot-cross/bin/arm-v7a-linux-gnueabihf-pkg-config' SYSROOT= =3D'/ home/adahl/Work/bsp/***/***/platform-***/sysroot-target' V=3D1 VERBOSE=3D1= =20 CROSS_COMPILE=3Darm-v7a-linux-gnueabihf- HOSTCC=3Dgcc make -C /home/adahl/W= ork/ bsp/***/***/platform-***/build-target/u-boot-2022.04-build -C /home/adahl/ Work/bsp/***/***/platform-***/build-target/u-boot-2022.04 O=3D/home/adahl/W= ork/ bsp/***/***/platform-***/build-target/u-boot-2022.04-build V=3D1 -j1=20 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= =20 this, the output seems correct: % PATH=3D/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 =2DL/home/adahl/Work/bsp/***/***/platform-***/sysroot-host/lib/pkgconfig/..= /..// lib -lssl -lcrypto=20 I don't understand it. This is still ptxdist-2018.05.0 =E2=80=A6 can that be a problem here? Greets Alex