Message ID | 20220329013728.d2flni2rrt46wyes@peregrine |
---|---|
State | New |
Headers |
Return-Path: <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id AF72027BBEA; Tue, 29 Mar 2022 02:38:08 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=unavailable 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 8D1C927BBE9 for <patchwork@mira.cbaines.net>; Tue, 29 Mar 2022 02:38:08 +0100 (BST) Received: from localhost ([::1]:39794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org>) id 1nZ0oB-0002Gu-NP for patchwork@mira.cbaines.net; Mon, 28 Mar 2022 21:38:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41552) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1nZ0o6-0002Gk-MS for guix-patches@gnu.org; Mon, 28 Mar 2022 21:38:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37343) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1nZ0o6-0007mX-Dl for guix-patches@gnu.org; Mon, 28 Mar 2022 21:38:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1nZ0o6-0003Sk-B5 for guix-patches@gnu.org; Mon, 28 Mar 2022 21:38:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#54619] [PATCH] gnu: lsof: Fix cross-compilation. Resent-From: Brian Kubisiak <brian@kubisiak.com> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 29 Mar 2022 01:38:02 +0000 Resent-Message-ID: <handler.54619.B.164851786013278@debbugs.gnu.org> Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 54619 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54619@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.164851786013278 (code B ref -1); Tue, 29 Mar 2022 01:38:02 +0000 Received: (at submit) by debbugs.gnu.org; 29 Mar 2022 01:37:40 +0000 Received: from localhost ([127.0.0.1]:59473 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1nZ0nk-0003S6-Cu for submit@debbugs.gnu.org; Mon, 28 Mar 2022 21:37:40 -0400 Received: from lists.gnu.org ([209.51.188.17]:37668) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <brian@kubisiak.com>) id 1nZ0ni-0003Rx-Iw for submit@debbugs.gnu.org; Mon, 28 Mar 2022 21:37:38 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41548) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <brian@kubisiak.com>) id 1nZ0ni-0002F7-2C for guix-patches@gnu.org; Mon, 28 Mar 2022 21:37:38 -0400 Received: from mn-69-69-108-139.sta.embarqhsd.net ([69.69.108.139]:2253 helo=mail.kubisiak.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <brian@kubisiak.com>) id 1nZ0ng-0007kX-H0 for guix-patches@gnu.org; Mon, 28 Mar 2022 21:37:37 -0400 Received: from peregrine (108-237-41-25.lightspeed.sntcca.sbcglobal.net [108.237.41.25]) by mail.kubisiak.com with ESMTPSA (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256) ; Mon, 28 Mar 2022 20:37:29 -0500 Date: Mon, 28 Mar 2022 18:37:28 -0700 From: Brian Kubisiak <brian@kubisiak.com> Message-ID: <20220329013728.d2flni2rrt46wyes@peregrine> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Received-SPF: pass client-ip=69.69.108.139; envelope-from=brian@kubisiak.com; helo=mail.kubisiak.com X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) BAYES_00=-1.9, PDS_RDNS_DYNAMIC_FP=0.001, RDNS_DYNAMIC=0.982, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: <guix-patches.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=unsubscribe> List-Archive: <https://lists.gnu.org/archive/html/guix-patches> List-Post: <mailto:guix-patches@gnu.org> List-Help: <mailto:guix-patches-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=subscribe> Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-getmail-retrieved-from-mailbox: Patches |
Series |
[bug#54619] gnu: lsof: Fix cross-compilation.
|
|
Commit Message
Brian Kubisiak
March 29, 2022, 1:37 a.m. UTC
* gnu/packages/lsof (lsof)[arguments]: Add LINUX_CONF_CC environment variable. --- gnu/packages/lsof.scm | 1 + 1 file changed, 1 insertion(+)
Comments
Hello Brian, Without your patch lsof seems to cross-build successfully, why is it required to set this LINUX_CONF_CC variable? Thanks, Mathieu
Hello Mathieu, I see the following compiler errors during the build phase when trying to build with `guix build --target=aarch64-linux-gnu lsof': dsock.c: In function ‘build_IPstates’: dsock.c:392:49: error: ‘TCP_ESTABLISHED’ undeclared (first use in this function) 392 | (void) enter_IPstate("TCP", "ESTABLISHED", TCP_ESTABLISHED); | ^~~~~~~~~~~~~~~ dsock.c:392:49: note: each undeclared identifier is reported only once for each function it appears in aarch64-linux-gnu-gcc -DLINUXV=00000 -DHASNORPC_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -DLSOF_VSTR=\"0.0.0\" -O -c -o usage.o usage.c dsock.c:393:46: error: ‘TCP_SYN_SENT’ undeclared (first use in this function); did you mean ‘TCP_SYNCNT’? 393 | (void) enter_IPstate("TCP", "SYN_SENT", TCP_SYN_SENT); | ^~~~~~~~~~~~ | TCP_SYNCNT dsock.c:394:46: error: ‘TCP_SYN_RECV’ undeclared (first use in this function) 394 | (void) enter_IPstate("TCP", "SYN_RECV", TCP_SYN_RECV); | ^~~~~~~~~~~~ dsock.c:395:47: error: ‘TCP_FIN_WAIT1’ undeclared (first use in this function) 395 | (void) enter_IPstate("TCP", "FIN_WAIT1", TCP_FIN_WAIT1); | ^~~~~~~~~~~~~ dsock.c:396:47: error: ‘TCP_FIN_WAIT2’ undeclared (first use in this function) 396 | (void) enter_IPstate("TCP", "FIN_WAIT2", TCP_FIN_WAIT2); | ^~~~~~~~~~~~~ dsock.c:397:47: error: ‘TCP_TIME_WAIT’ undeclared (first use in this function); did you mean ‘TCP_TIMESTAMP’? 397 | (void) enter_IPstate("TCP", "TIME_WAIT", TCP_TIME_WAIT); | ^~~~~~~~~~~~~ | TCP_TIMESTAMP dsock.c:398:43: error: ‘TCP_CLOSE’ undeclared (first use in this function); did you mean ‘TCP_CORK’? 398 | (void) enter_IPstate("TCP", "CLOSE", TCP_CLOSE); | ^~~~~~~~~ | TCP_CORK dsock.c:399:48: error: ‘TCP_CLOSE_WAIT’ undeclared (first use in this function) 399 | (void) enter_IPstate("TCP", "CLOSE_WAIT", TCP_CLOSE_WAIT); | ^~~~~~~~~~~~~~ dsock.c:400:46: error: ‘TCP_LAST_ACK’ undeclared (first use in this function); did you mean ‘TCP_FLAG_ACK’? 400 | (void) enter_IPstate("TCP", "LAST_ACK", TCP_LAST_ACK); | ^~~~~~~~~~~~ | TCP_FLAG_ACK dsock.c:401:44: error: ‘TCP_LISTEN’ undeclared (first use in this function); did you mean ‘TCP_FASTOPEN’? 401 | (void) enter_IPstate("TCP", "LISTEN", TCP_LISTEN); | ^~~~~~~~~~ | TCP_FASTOPEN dsock.c:402:45: error: ‘TCP_CLOSING’ undeclared (first use in this function); did you mean ‘POF_CLOSING’? 402 | (void) enter_IPstate("TCP", "CLOSING", TCP_CLOSING); | ^~~~~~~~~~~ | POF_CLOSING dsock.c: In function ‘get_tcpudp’: dsock.c:2998:20: error: ‘TCP_ESTABLISHED’ undeclared (first use in this function) 2998 | if (tp->state == TCP_ESTABLISHED) { | ^~~~~~~~~~~~~~~ dsock.c: In function ‘get_unix’: dsock.c:3527:64: error: ‘UINT32_MAX’ undeclared (first use in this function); did you mean ‘UINT_MAX’? 3527 | || (ty = (uint32_t)strtoul(fp[4], &ep, 16)) == (uint32_t)UINT32_MAX | ^~~~~~~~~~ | UINT_MAX make: *** [<builtin>: dsock.o] Error 1 make: *** Waiting for unfinished jobs.... Checking the build log, I see the following error: Testing C library type with aarch64-linux-gnu-gcc ... ./Configure: line 2922: ./lsof_Configure_tmp_26.x: cannot execute binary file: Exec format error done Cannot determine C library type; assuming it is not glibc. So I believe the compiler errors are caused by attempting to build with glibc without adding glibc-specific build flags. The root cause of this is that the c library detection in lsof builds and runs a small program in order to see if it's using glibc. Since it is building this with the cross-compiler, the resulting binary (usually) won't be able to run on the host. If you have binfmt_misc + qemu set up on your machine, you may not see this error. The solution is to point LINUX_CONF_CC at the build machine's compiler instead of using the cross compiler for this step, which should build and execute the test program natively. Thanks, Brian
Hello Brian, Thanks for the explanation! > If you have binfmt_misc + qemu set up on your machine, you may not see > this error. Oh right, that's probably why I didn't see those errors. > The solution is to point LINUX_CONF_CC at the build machine's compiler > instead of using the cross compiler for this step, which should build > and execute the test program natively. Pushed as a006b7d34757dbafc0d71d875613e6df521efe51. Mathieu
diff --git a/gnu/packages/lsof.scm b/gnu/packages/lsof.scm index 98bcdab468..f872eb8de8 100644 --- a/gnu/packages/lsof.scm +++ b/gnu/packages/lsof.scm @@ -54,6 +54,7 @@ (define-public lsof (replace 'configure (lambda _ (setenv "LSOF_CC" ,(cc-for-target)) + (setenv "LINUX_CONF_CC" "gcc") (setenv "LSOF_MAKE" "make") ;; By default, the makefile captures the output of 'uname -a'.