From patchwork Sun Aug 29 22:06:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Langlois X-Patchwork-Id: 32403 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 98F9127BBE3; Mon, 30 Aug 2021 00:32:13 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 855D227BBE1 for ; Mon, 30 Aug 2021 00:32:12 +0100 (BST) Received: from localhost ([::1]:37436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKUHb-0003Tq-FE for patchwork@mira.cbaines.net; Sun, 29 Aug 2021 19:32:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55908) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKUHS-0003Te-97 for guix-patches@gnu.org; Sun, 29 Aug 2021 19:32:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46197) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mKUHS-0002M6-1i for guix-patches@gnu.org; Sun, 29 Aug 2021 19:32:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mKUHR-0004jn-U5 for guix-patches@gnu.org; Sun, 29 Aug 2021 19:32:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50261] [PATCH] gnu: node: Enable cross-compilation. Resent-From: Pierre Langlois Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 29 Aug 2021 23:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 50261 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 50261@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.163027991117711 (code B ref -1); Sun, 29 Aug 2021 23:32:01 +0000 Received: (at submit) by debbugs.gnu.org; 29 Aug 2021 23:31:51 +0000 Received: from localhost ([127.0.0.1]:57743 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mKUHD-0004YJ-Tf for submit@debbugs.gnu.org; Sun, 29 Aug 2021 19:31:51 -0400 Received: from lists.gnu.org ([209.51.188.17]:40844) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mKUHB-0004WM-Pe for submit@debbugs.gnu.org; Sun, 29 Aug 2021 19:31:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55906) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKUHB-0003Sp-IE for guix-patches@gnu.org; Sun, 29 Aug 2021 19:31:45 -0400 Received: from mout.gmx.net ([212.227.15.15]:50413) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKUH8-0002AQ-EX for guix-patches@gnu.org; Sun, 29 Aug 2021 19:31:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1630279899; bh=DtvswSsucaZ41VvihkagOeOXyNAvLVN8O0UuuvPlPUc=; h=X-UI-Sender-Class:From:To:Subject:Date; b=Qums9Jh+b6FmWCzMOj9PyL/UiutLoy2ukMo2Q5TuOB+SrOJfZR6elcRpahDoflzl0 XozyVKor6mtZrmVPNlEqE0tGNO6hYZXa8/+LngPqbWm9UUAw7XWQySEfg/67FOhIcW y5WroCCHBkPi9dOGp5UGtwUNGKVi6suiRVCYw7bc= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from labiere ([82.69.64.142]) by mail.gmx.net (mrgmx004 [212.227.17.184]) with ESMTPSA (Nemesis) id 1N3bWr-1n3YK144OZ-010doI for ; Mon, 30 Aug 2021 01:31:39 +0200 User-agent: mu4e 1.6.5; emacs 27.2 From: Pierre Langlois Date: Sun, 29 Aug 2021 23:06:00 +0100 Message-ID: <87a6kzsu92.fsf@gmx.com> MIME-Version: 1.0 X-Provags-ID: V03:K1:KumiYM/0n7epiV3SOc2LAh44WJ2NDNyfLZkvCtu35xzUm+q4WYA g8rlbZDoSwACJWx+EMK6kuUiURgB/X5IsSXik303HLz884aeQFVPdAB/3AoORizIuwFvRBM tC7VE6p7ALGgqhUaDq72Yq0eskwaDtjikdEJ+EK8fXgcwmPT9Bwu5j1Vq4kVL9D+ODiRi2+ uLsNeXS21CQSLy84Bs8Sg== X-UI-Out-Filterresults: notjunk:1;V03:K0:eWdy9dR2RIM=:zgoIaxekkLnuGFGXHe6jlj C6fGzMNV7Xpyzhr0VSlBZk4bl6J4fntSoatUU3b32ZZ9xjkJ6VIz2mIa7lp809FNq3NdMYFwr 0ZZfkn95lupMEbl+zPZnZrpo90hcsFgQrBw6xdTPIkreRKZGO9ck55UTG3tuUj+GtX9Jz6vM6 lnFC+OtrGM+tpy63/V3G+cb/G+RWIeo6gBKitsznrkAoY2QE4bRXeuanvsdUVAJ0xEbL5HYjP qimQCy67xOQ+fkeHoYFXyLV6z5Hg90h888zmvd6VUl1e+a/rVC3WPafmFilAPJ46dsC54/3PJ 9iZ8PeU8yxOebhPd2hR1yAgE5a/5G4ntn4WDCk3o64ccOLXsXZhuE9YpvuQnuF64x6i7AgVqx gFPzbTqTA3LNIg8E0p0msvi8TI+nS5iE0pQ9wSf0Why9N0c7JvDU/73TPuSJ135a/YcUl6mv8 kXgoMOtr37whwrkCDFc6oMkvSO4E9GgtswWpI6IR+B453BvD1rQsT/EP4kVslMaAQIV1D7/+1 Wb5QLJXw1Qae847xK+BZqVhpyO+CF3NHs3WV6YZ0Br9AtdzrxZrSj+/rqVovgGn7yLr6B92Tz Q9mReJF35V+9gTCqg6opo83h/rCGBLM4bJiFmLfp4x/ydi94CRVJfvwCqvJLqSGUap66w+Ydg 3abLC3J0b49ActGgyeAMHmtCn9Bq9HwVnUJOcH1nLVMVCpm9WkOpIhUIopsxSuD+qmXEuFyw4 q1Kjw/bj0+QiZYZN+ht/PMAqB7wqkqrd5GSGQl4HrGr9Y/eN1kgw9Oa7DRj3ppMFtiEGkWtk6 TTotvQoXYOA3x5Tubo5VJDC7YhIkxkWLPINx3RtBNwNGZvxIhpNFcWsfWIhWPRpOAlhZpApNv qHpWP2eKgJEk6knOWU5Kb+OUqSM0fPUcHZmbxCgnWnoSBQKPMs5nux6kxVvBrBYVqng+jzKZ2 ZztoDtGy44QLFlZUcBpNmA1HFht9UpTN49otJPCIT/FyddG+LZ0/41WuCIqilE375w9L59lTx Uk7M446o2ia5nHkgCdhd5YUaYc9/t5VwqxX8uofqgXIyxbeHf4d1YxRnQMW9SX5gbZNfVrXQQ 7NuakOOcstkJ5heqHyfgB4cu4Jylio4NOua3Vmwq7NqsKjgg+L2KSYZdA== Received-SPF: pass client-ip=212.227.15.15; envelope-from=pierre.langlois@gmx.com; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Hi Guix! While working on tree-sitter I realized our node packages didn't cross-compile [0] so I thought I'd give it a go, here's a patch! Note that fundamentally, because of how the V8 JavaScript engine bootstraps itself, cross-compiling only works for platforms with the same bitness. So a 32-bit binary cannot be produced on a 64-bit system, for example on x86_64: --8<---------------cut here---------------start------------->8--- # Build OK. $ guix build --target=aarch64-linux-gnu node # Will fail... $ guix build --target=arm-linux-gnueabihf node # ... unless the host is 32-bit. $ guix build --system=i686-linux --target=arm-linux-gnueabihf node --8<---------------cut here---------------end--------------->8--- I'm not sure there's any way to express this restriction in the package definition, it would be good to fail in a useful way, any thoughts? I suspect a mechanism for this isn't really worth the effort, I don't know of any other packages like this. As a drive-by, the esbuild package didn't build on 32-bit systems so I attached another patch for that. It was due to the build system using the "-race" option to detect race conditions in the tests, and this mechanism only works on 64-bit platforms. Thanks, Pierre [0]: https://lists.gnu.org/archive/html/guix-patches/2021-08/msg00646.html From 17cd8ccb2255d4bb392a94468abeb785e134ff1e Mon Sep 17 00:00:00 2001 From: Pierre Langlois Date: Mon, 30 Aug 2021 00:25:58 +0100 Subject: [PATCH 2/2] gnu: esbuild: Disable race detector on 32-bit targets. * gnu/packages/web.scm (esbuild)[arguments]: Set the ESBUILD_RACE variable to an empty string to remove the -race option. --- gnu/packages/web.scm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm index f0ac9ccee2..5817d2dd95 100644 --- a/gnu/packages/web.scm +++ b/gnu/packages/web.scm @@ -1672,13 +1672,17 @@ used to validate and fix HTML data.") #t)))) (build-system go-build-system) (arguments - '(#:import-path "github.com/evanw/esbuild/cmd/esbuild" + `(#:import-path "github.com/evanw/esbuild/cmd/esbuild" #:unpack-path "github.com/evanw/esbuild" #:phases (modify-phases %standard-phases (replace 'check (lambda* (#:key tests? unpack-path #:allow-other-keys) (when tests? + ;; The "Go Race Detector" is only supported on 64-bit + ;; platforms, this variable disables it. + (unless ,(target-64bit?) + (setenv "ESBUILD_RACE" "")) (with-directory-excursion (string-append "src/" unpack-path) (invoke "make" "test-go"))) #t))))) -- 2.33.0