From patchwork Wed Nov 13 12:30:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Buck X-Patchwork-Id: 2991 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 504F027BBEA; Wed, 13 Nov 2024 14:06:28 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 6DB1527BBE2 for ; Wed, 13 Nov 2024 14:06:26 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBE0X-0000cR-OK; Wed, 13 Nov 2024 09:06:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tBE0U-0000bw-1Z for guix-patches@gnu.org; Wed, 13 Nov 2024 09:06:06 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBE0T-00068O-GO for guix-patches@gnu.org; Wed, 13 Nov 2024 09:06:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=kQE+AkEfjVSzWkLHInrMm28pRgLe4Z4JcJQLEtkY9fQ=; b=YfqCLqtCmz7BlueRL6BFaswTO1mPcktpZh+0d1qJd38XmQSrGsQOKPKZaBpKKQiLzXif8Z1o6rhRgvSWXStOK/OaZ/d7QFh2LWi2/lB1RNedb7iiWInJP0NaWvLG2JhaI2ee24t0m44k8bxYDLz11rWl003nPhWz7B6va2gGXqjikypUeNYTeWvCkeCjK4aVauq2qOi21TyjDWG66gFfpQmFpLdbFqNdA2MB+kCruFjDhMBVauTQkZGqAwSge1eltRy+RlcLV8WArHHYooYsaOjwqglKXtmrG8bc3kOb/jzvJ2Xmy5l5b/uUl/GGiASIZy48Bt4LXjaBVZQKaeL4EA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tBE0T-0000SQ-7d; Wed, 13 Nov 2024 09:06:05 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74343] [PATCH 0/1] Fix cross-compilation for isc-dhcp Resent-From: Christoph Buck Original-Sender: "Debbugs-submit" Resent-CC: rekado@elephly.net, guix-patches@gnu.org Resent-Date: Wed, 13 Nov 2024 14:06:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74343@debbugs.gnu.org Cc: Christoph Buck , Ricardo Wurmus X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Ricardo Wurmus Received: via spool by submit@debbugs.gnu.org id=B.17315067301664 (code B ref -1); Wed, 13 Nov 2024 14:06:05 +0000 Received: (at submit) by debbugs.gnu.org; 13 Nov 2024 14:05:30 +0000 Received: from localhost ([127.0.0.1]:41330 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tBDzt-0000Qf-FA for submit@debbugs.gnu.org; Wed, 13 Nov 2024 09:05:30 -0500 Received: from lists.gnu.org ([209.51.188.17]:44634) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tBCW5-0004eZ-UE for submit@debbugs.gnu.org; Wed, 13 Nov 2024 07:30:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tBCW4-0000zz-Uh for guix-patches@gnu.org; Wed, 13 Nov 2024 07:30:37 -0500 Received: from mail-108-mta81.mxroute.com ([136.175.108.81]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBCW2-0002CR-1S for guix-patches@gnu.org; Wed, 13 Nov 2024 07:30:36 -0500 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta81.mxroute.com (ZoneMTA) with ESMTPSA id 1932580ec820003e01.001 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Wed, 13 Nov 2024 12:30:26 +0000 X-Zone-Loop: 0d23d1f0b1c83d64380c7ee00cb0a66c624cf861691b X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=icepic.de; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:Cc:To: From:Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=kQE+AkEfjVSzWkLHInrMm28pRgLe4Z4JcJQLEtkY9fQ=; b=R b5CK8ZnUxL2h5xzUXVVfcYTo8su029CJ+DQp5MsPhlT6UZMu3PpMwlY0r+W63zmOm0EMUqySDJtMS avtSLp2UWlcwa8As26y+et+ChDZ6zkuwLmg5hm4tg941jFWlPlT6DPROLFsbGXiMqBLh6mdYbAvf9 nSD0yunyI88JQ0n2+j4BU97E6KlL3Ywc7DGnRSzC780A0GNgQdiXdO3rBtYJHAeKoEftewInWqRmr zT/RqyInbdkCgbZj6btlS6VatMIzIsoklfaTvATR6YnEamiSAv1B6Oc6oewjvv6oQ/lFX7pwuQzYV HaM0paZpxj7cedpaPMI0ZU4YdNlJbvzyg==; From: Christoph Buck Date: Wed, 13 Nov 2024 13:30:09 +0100 Message-ID: MIME-Version: 1.0 X-Authenticated-Id: dev@icepic.de Received-SPF: pass client-ip=136.175.108.81; envelope-from=dev@icepic.de; helo=mail-108-mta81.mxroute.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 13 Nov 2024 09:05:26 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Hi! Cross-compiling isc-dhcp from x64 to arm32 is broken as you can see below (output shortend to include only the relevant information) --8<---------------cut here---------------start------------->8--- icepic@G16-Buck ~/guix/src/guix [env]$ ./pre-inst-env guix describe Git checkout: repository: /home/icepic/guix/src/guix/ branch: master commit: b10ce47d8be5b6c15987f4e1d93b3bd71b1eb220 ./pre-inst-env guix build --target=arm-linux-gnueabihf isc-dhcp -K [...] phase `post-configure' succeeded after 0.5 seconds starting phase `patch-generated-file-shebangs' patch-shebang: ./bind/bind-9.11.37/contrib/dnsperf-2.1.0.0-1/contrib/queryparse/queryparse: warning: no binary for interpreter `python' found in $PATH phase `patch-generated-file-shebangs' succeeded after 0.1 seconds starting phase `update-config-scripts-for-bind' phase `update-config-scripts-for-bind' succeeded after 0.0 seconds starting phase `build' Making all in ./bind make[1]: Entering directory '/tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1/bind' /tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1/bind/bind-9.11.37 already unpacked... Configuring BIND libraries for DHCP. Building BIND libraries - this takes some time. Building isc library in /tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1/bind/bind-9.11.37/lib/isc /gnu/store/ylgkrq9j1gyfig2y66srmgsbyh9w20d9-binutils-2.41/bin/ar: `u' modifier ignored since `D' is the default (see `U') /gnu/store/ylgkrq9j1gyfig2y66srmgsbyh9w20d9-binutils-2.41/bin/ar: `u' modifier ignored since `D' is the default (see `U') Building dns library in /tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1/bind/bind-9.11.37/lib/dns make[3]: *** [Makefile:601: include/dns/enumtype.h] Error 1 make[2]: *** [Makefile:595: include] Error 2 Building isccfg library in /tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1/bind/bind-9.11.37/lib/isccfg In file included from /tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1/bind/bind-9.11.37/lib/isccfg/include/isccfg/aclconf.h:24, from aclconf.c:24: /tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1/bind/bind-9.11.37/lib/dns/include/dns/types.h:230:10: fatal error: dns/enumtype.h: No such file or directory 230 | #include /* Provides dns_rdatatype_t. */ | ^~~~~~~~~~~~~~~~ compilation terminated. make[2]: *** [Makefile:239: aclconf.o] Error 1 Building irs library in /tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1/bind/bind-9.11.37/lib/irs In file included from /tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1/bind/bind-9.11.37/lib/dns/include/dns/tsig.h:28, from /tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1/bind/bind-9.11.37/lib/dns/include/dns/client.h:45, from context.c:28: /tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1/bind/bind-9.11.37/lib/dns/include/dns/types.h:230:10: fatal error: dns/enumtype.h: No such file or directory 230 | #include /* Provides dns_rdatatype_t. */ | ^~~~~~~~~~~~~~~~ compilation terminated. make[2]: *** [Makefile:237: context.o] Error 1 Installing BIND libraries to /tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1/bind. mkdir /tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1/bind/include mkdir /tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1/bind/include/isc mkdir /tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1/bind/include/pk11 mkdir /tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1/bind/include/pkcs11 mkdir /tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1/bind/lib make[3]: *** [Makefile:601: include/dns/enumtype.h] Error 1 make[2]: *** [Makefile:595: include] Error 2 In file included from /tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1/bind/bind-9.11.37/lib/isccfg/include/isccfg/aclconf.h:24, from aclconf.c:24: /tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1/bind/bind-9.11.37/lib/dns/include/dns/types.h:230:10: fatal error: dns/enumtype.h: No such file or directory 230 | #include /* Provides dns_rdatatype_t. */ | ^~~~~~~~~~~~~~~~ compilation terminated. make[2]: *** [Makefile:239: aclconf.o] Error 1 In file included from /tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1/bind/bind-9.11.37/lib/dns/include/dns/tsig.h:28, from /tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1/bind/bind-9.11.37/lib/dns/include/dns/client.h:45, from context.c:28: /tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1/bind/bind-9.11.37/lib/dns/include/dns/types.h:230:10: fatal error: dns/enumtype.h: No such file or directory 230 | #include /* Provides dns_rdatatype_t. */ | ^~~~~~~~~~~~~~~~ compilation terminated. make[2]: *** [Makefile:237: context.o] Error 1 make[1]: *** [Makefile:77: bind2] Error 2 make[1]: Leaving directory '/tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1/bind' make: *** [Makefile:463: all-recursive] Error 1 error: in phase 'build': uncaught exception: %exception #<&invoke-error program: "make" arguments: () exit-status: 2 term-signal: #f stop-signal: #f> phase `build' failed after 14.3 seconds command "make" failed with status 2 build process 18 exited with status 256 note: keeping build directory `/tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0' builder for `/gnu/store/havk5qmkfa6vz9f7vw794vp3n49fx21a-isc-dhcp-4.4.3-P1.drv' failed with exit code 1 --8<---------------cut here---------------end--------------->8--- From what i understand the following goes wrong. During compilation of the `isc-dhcp` package, the package `bind` is also build. `isc-dhcp` includes the bind source tree but guix replaces it with a more recent version. During the build process of `bind`, which is triggered from `isc-dhcp` an executable named `gen` (see `lib/dns`) is compiled and executed to generate the `dns/enumtype.h` header. Execution on `gen` during cross-compilation however fails, because `gen` was cross-compiled and not build for the host system where it is executed. --8<---------------cut here---------------start------------->8--- icepic@G16-Buck:~$ file /tmp/guix-build-isc-dhcp-4.4.3-P1.drv-1/dhcp-4.4.3-P1/bind/bind-9.11.37/lib/dns/gen /tmp/guix-build-isc-dhcp-4.4.3-P1.drv-1/dhcp-4.4.3-P1/bind/bind-9.11.37/lib/dns/gen: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /gnu/store/yxbip29ib6rf69pfpqsxpi8wvslm1gng-glibc-cross-arm-linux-gnueabihf-2.39/lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, with debug_info, not stripped icepic@G16-Buck:~$ --8<---------------cut here---------------end--------------->8--- According to the documentation setting the `BUILD_CC` variable to the native compiler should prevent this error, and indeed guilx sets this variable in the build process. But this variable is ignored by the `configure` script of bind. --8<---------------cut here---------------start------------->8--- icepic@G16-Buck:/tmp/guix-build-isc-dhcp-4.4.3-P1.drv-1$ source environment-variables icepic@G16-Buck:/tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1$ printenv | grep BUILD_CC BUILD_CC=gcc icepic@G16-Buck:/tmp/guix-build-isc-dhcp-4.4.3-P1.drv-0/dhcp-4.4.3-P1$ cat dhcp-4.4.3-P1/bind/bind-9.11.37/lib/dns/Makefile | grep BUILD_CC BUILD_CC = arm-linux-gnueabihf-gcc ${BUILD_CC} ${BUILD_CFLAGS} -I${top_srcdir}/lib/isc/include \ --8<---------------cut here---------------end--------------->8--- Configure of bind is called with the following paramters: --8<---------------cut here---------------start------------->8--- $ ./configure CONFIG_SHELL=/gnu/store/3jhfhxdf6v5ms10x5zmnl166dh3yhbr1-bash-minimal-5.1.16/bin/sh SHELL=/gnu/store/3jhfhxdf6v5ms10x5zmnl166dh3yhbr1-bash-minimal-5.1.16/bin/sh --without-openssl --without-libxml2 --without-libjson --without-gssapi --disable-threads --without-lmdb --includedir=/gnu/store/qfndmj9gi31qbzl7f9b00pcylnah4pf2-isc-dhcp-4.4.3-P1/include --libdir=/gnu/store/qfndmj9gi31qbzl7f9b00pcylnah4pf2-isc-dhcp-4.4.3-P1/lib --without-python --disable-kqueue --disable-epoll --disable-devpoll --host=arm-linux-gnueabihf CC_FOR_BUILD=gcc CONFIG_SHELL=/gnu/store/3jhfhxdf6v5ms10x5zmnl166dh3yhbr1-bash-minimal-5.1.16/bin/bash SHELL=/gnu/store/3jhfhxdf6v5ms10x5zmnl166dh3yhbr1-bash-minimal-5.1.16/bin/bash --with-randomdev=/dev/random --enable-full-report --8<---------------cut here---------------end--------------->8--- If you look closely, you can see that parameter `--host` is set to `arm-linux-gnueabihf` but `--build` is missing. A quick look in the configure script of bind reveals, that `BUILD_CC` is only propagated from the env, if we are in a cross-compiling context : --8<---------------cut here---------------start------------->8--- if test "yes" = "$cross_compiling"; then if test -z "$BUILD_CC"; then as_fn_error $? "BUILD_CC not set" "$LINENO" 5 fi BUILD_CFLAGS="$BUILD_CFLAGS" BUILD_CPPFLAGS="$BUILD_CPPFLAGS" BUILD_LDFLAGS="$BUILD_LDFLAGS" BUILD_LIBS="$BUILD_LIBS" else BUILD_CC="$CC" BUILD_CFLAGS="$CFLAGS" BUILD_CPPFLAGS="$CPPFLAGS $GEN_NEED_OPTARG" BUILD_LDFLAGS="$LDFLAGS" BUILD_LIBS="$LIBS" fi --8<---------------cut here---------------end--------------->8--- And finally if we are in a cross compiled context is checked by --8<---------------cut here---------------start------------->8--- # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi --8<---------------cut here---------------end--------------->8--- in the configure script of `bind`. Since we don't have explicitly set the `--build` parameter of the configure script, i suspect this test fails and the `BUILD_CC` variable from the environment is not picked up. One can test this quickly, by extending the the `--build` parameter in the package description in admin.scm, namely --8<---------------cut here---------------start------------->8--- (lambda _ (substitute* "configure" (("--host=\\$host") "--host=$host_alias --build=$build_alias")) ;; BIND needs a native compiler because the DHCP ;; build system uses the built 'gen' executable. (setenv "BUILD_CC" "gcc") ;; powerpc-linux needs to be told to use -latomic. ,@(if (target-ppc32?) `((setenv "LIBS" "-latomic")) '())))) --8<---------------cut here---------------end--------------->8--- And indeed, building this package description seems to fix the problem. One thing however is suspicious. Why did cross compilation for aarch64 work? I didn't figure this out. However, the following patch should fix this issue for arm32 and aarch64 crossbuild still works. Christoph Buck (1): gnu: isc-dhcp: Fix cross compilation for arm32 gnu/packages/admin.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: 1f057603ef59c7b9c32f610a897321fd75dc4dad