From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 4MQIOaFs2mLI4wAAbAwnHQ (envelope-from ) for ; Fri, 22 Jul 2022 11:23:46 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id MGzkOKFs2mL8dAAAauVa8A (envelope-from ) for ; Fri, 22 Jul 2022 11:23:45 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8EE592A502 for ; Fri, 22 Jul 2022 11:23:45 +0200 (CEST) Received: from localhost ([::1]:41568 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oEosq-0000rk-DM for larch@yhetil.org; Fri, 22 Jul 2022 05:23:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48424) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEosW-0000qT-Ox for help-guix@gnu.org; Fri, 22 Jul 2022 05:23:24 -0400 Received: from flashner.co.il ([178.62.234.194]:45732) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oEosU-0003RA-Dt for help-guix@gnu.org; Fri, 22 Jul 2022 05:23:24 -0400 Received: from localhost (unknown [91.187.115.179]) by flashner.co.il (Postfix) with ESMTPSA id 71A6F402D5; Fri, 22 Jul 2022 09:23:21 +0000 (UTC) Date: Wed, 20 Jul 2022 18:16:54 +0300 From: Efraim Flashner To: Trev Cc: GUIX Help Subject: Re: Troubles building "nimble" with nim Message-ID: Mail-Followup-To: Trev , GUIX Help References: <87tu7uceff.fsf@codinator.mail-host-address-is-not-set> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="MQg4Bg7a1Hfb2RQV" Content-Disposition: inline In-Reply-To: <87tu7uceff.fsf@codinator.mail-host-address-is-not-set> X-PGP-Key-ID: 0x41AAE7DCCA3D8351 X-PGP-Key: https://flashner.co.il/~efraim/efraim_flashner.asc X-PGP-Fingerprint: A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Received-SPF: pass client-ip=178.62.234.194; envelope-from=efraim@flashner.co.il; helo=flashner.co.il X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_24_48=1.34, 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: help-guix@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: "Help-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1658481825; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=WGrOd6j3WULp+jf+HYJpMtACh3PekK/T+vJLcErRRjU=; b=lCpMzTuJeiMSXMEt0YOKwKHe/7lsL7SwjaJajC8UWchZdgFkA2DLrs8n7Hyu98MYNkUHRD L9XTNJWsAZF04ZDIlFa4lv4EdugK5iQ7kovtGygMO7yZ0EHCBgWknG2zfXHzHLawvBdffj kIUJd0l3kW64eUBF+B7WmOXB70tgspjyD6aVRyD8/XlcgWwT4CPqzL0IbFH7zG/xyd+OqQ e5IebtrN4qMEIclt91cmdrS/8tXov0X1BcvKRRXFKE7y5Sj5U9rxvXdY63gpykV9s1Rlqd BLZczm+BGKeVIRO4emc1TkDPEho1AGZoBohVs2w/O1Edr8+6SCMPXett/lVd1A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1658481825; a=rsa-sha256; cv=none; b=PyyosoRwhkhSPzQjg4+GqPhVkfw/5GcLRwvZAacYFm4ivHbe6HacaX5LzhV4/+9Bs04x3C m3EXl8QabngIAFT8IfRVS0UrmrWsGJi2mQdHLk0ea/G2kbSbR/OVnLSCSkdLyKTtFRuzyS 4tfjbw/0ayrXCbRH+dWVnrwlyCIfJxlkSA0xldfXg+gj3sXvitTKJPS4KmRFP7LTK8j32x FiU4rWpyLYn+9VeMfeM8DBpqv4fN/r0ql3ax9iukTu4VHv+d8Ak119Kq+R4vbfe0etv444 c/pXmv+PXFpLsqRP9cNLlzSi9zwRtOn6tdGWvv3scgczgzpOTPQnRPbAvPslXQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.14 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 8EE592A502 X-Spam-Score: -3.14 X-Migadu-Scanner: scn0.migadu.com X-TUID: KpwuQsRbnDCH --MQg4Bg7a1Hfb2RQV Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 06, 2022 at 10:57:08AM -0700, Trev wrote: >=20 > Hello Guix! >=20 > I am in the weeds while trying to properly build "nimble", the package > manager that is included with the nim programming language. The current > guix package (gnu/packages/nim) completely misses this build step. I > wonder if previous contributors also struggled with this. >=20 > For some context I am attempting to directly replicate these steps from > https://nim-lang.org/install_unix.html: >=20 > #+BEGIN_QUOTE > sh build.sh > bin/nim c koch > ./koch boot -d:release > ./koch tools > #+END_QUOTE >=20 > My (and the current package record) can build the nim binary using gcc, n= o problem. However when we get to the part where nim builds its own feature= s with the compiled compiler, something seems to be trying to call =3D/bin/= sh=3D directly, despite hard-coded references to that process having been b= een substituted out. >=20 > I have submitted a ticket with Nim here just so that I may ask some thoug= htful questions. That conversation is here: https://github.com/nim-lang/Nim= /issues/19976 >=20 > The error output is: >=20 > #+BEGIN_SRC sh > c_code/2_2/stdlib_browsers.nim.o c_code/2_2/@mnim.nim.o -ldl -lm -lrt > : SUCCESS > Hint: used config file '/tmp/guix-build-nim-1.6.6.drv-0/nim-1.6.6/config/= nim.cfg' [Conf] > Hint: used config file '/tmp/guix-build-nim-1.6.6.drv-0/nim-1.6.6/config/= config.nims' [Conf] > .........................................................................= =2E............................................ > CC: stdlib_digitsutils.nim > Error: invocation of external compiler program failed. No such file or di= rectory > Additional info: Could not find command: '/bin/sh'. OS error: No such fil= e or directory 2 > error: in phase 'build': uncaught exception: > %exception #<&invoke-error program: "./bin/nim" arguments: ("c" "koch") e= xit-status: 1 term-signal: #f stop-signal: #f>=20 > phase `build' failed after 96.6 seconds > command "./bin/nim" "c" "koch" failed with status 1 > #+END_SRC >=20 > My current attempt at packaging this looks like this: >=20 > #+BEGIN_SRC scheme > (define-module (gnu packages nim) > #:use-module (guix build-system gnu) > #:use-module (guix gexp) > #:use-module (guix download) > #:use-module ((guix licenses) #:prefix license:) > #:use-module (guix packages) > #:use-module (gnu packages pcre) > #:use-module (gnu packages tls) > #:use-module (gnu packages cmake)) >=20 > (define-public nim > (package > (name "nim") > (version "1.6.6") > (source > (origin > (method url-fetch) > (uri (string-append "https://nim-lang.org/download/" > name "-" version ".tar.xz")) > (sha256 > (base32 "0lm4450ig8k4l3rzxv6kcqji5l1lzicsw76ckwxm0q9qdz713cb7")))) > (build-system gnu-build-system) > (native-inputs (list pcre openssl cmake)) > (arguments > `(#:tests? #f ; No tests. > #:phases > (modify-phases %standard-phases > (delete 'configure) ; no configure script > (add-after 'unpack 'patch-installer > (lambda* (#:key outputs #:allow-other-keys) > (let ((out (assoc-ref outputs "out"))) > (substitute* "install.sh" > (("/usr/") (string-append out "/usr/")) > (("/etc/") (string-append out "/etc/")) > (("/opt/") (string-append out "/opt/"))) > #t))) > (add-after 'patch-source-shebangs 'patch-more-shebangs > (lambda _ > (let ((sh (which "sh"))) > (substitute* '("tests/stdlib/tosprocterminate.nim" > "tests/stdlib/tstrscans.nim" > "lib/pure/osproc.nim") > (("/bin/sh") sh)) > (substitute* (find-files "c_code" "stdlib_osproc.c") try changing this to "stdlib_osproc.nim.c" > (("\"/bin/sh\", 7") (format #f "~s, ~s" sh (string-lengt= h sh))))) > #t)) > (replace 'build > (lambda _ > (setenv "XDG_CACHE_HOME" "./cache-home") > (mkdir-p "./cache-home") > (invoke "sh" "build.sh") > (invoke "./bin/nim" "c" "koch") > (invoke "koch" "boot" "-d:release") > (invoke "koch" "tools") > #t)) > (replace 'install > (lambda* (#:key outputs #:allow-other-keys) > (let ((out (assoc-ref outputs "out"))) > (mkdir-p (string-append out "/usr/bin")) > (invoke "./install.sh" (string-append out "/usr/bin")) > #t)))))) > (home-page "https://nim-lang.org") > (synopsis "Statically-typed, imperative programming language") > (description "Nim (formerly known as Nimrod) is a statically-typed, > imperative programming language that tries to give the programmer ultimat= e power > without compromises on runtime efficiency. This means it focuses on comp= ile-time > mechanisms in all their various forms.") > (license license:expat))) > #+END_SRC >=20 > I have tried: >=20 > 1. Symlinking (without any success) /bin/sh to (which "bash") > 2. Exporting $SHELL to (which "bash") > 3. Attempted (without much luck) to ~alias cc=3Dgcc~ to see if it's not t= he shell that's missing, it's the command "cc", and adding cmake as a separ= ate input > 4. Grokking the Nim source code that I don't perfectly understand to see = how it could somehow decide to call something that isn't on path aside from= a string that's "/bin/sh". > =20 > If someone appreciates packaging this better than can share some wisdom, = it would be appreciated. >=20 > --=20 >=20 > Trev : 0FB7 D06B 4A2A F07E AD5B 1169 183B 6306 8AA1 D206 --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --MQg4Bg7a1Hfb2RQV Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmLYHGMACgkQQarn3Mo9 g1GL9A//e7LuI9M4JagDzyDvKFYtAFing+bMYoPbjBZvMDONLLP8bN3lCQjZlxa2 A3VM+yhgTeTNVh2XDeEV6mJt6i6I6HiLqt/7DOXHB5IQCcWono0xVpU7Wuu3G9yh TbUmantK+efyg+IqELmhN66VTvIw1dMiOk7Gg38jrO5rdlDzClA2Txmw3+lCAGsl Q2tjcKiIgThPNUtH1dhcsJ7fQMVIBosevfWtF24zvwbBeesRg/sE9fB31k2KtIyG ZE8aH6oNQxdi+FugH8TIQlA9wedggV7RyQy9o/O5W4DDuM0xUVwiT90Msl2tn+kS 9l2gtugrRh8fAPlhMKlGSIuMpRH0k2CBAYVw/0/a6jqowi3wEoUpK7cr2dRP9tuz dPvY5aMwunSXzKYUcunqNQXtF9PGMNfJ++StSV4X4PmYW+hchopO5uqT8p8FAth7 5nqgxH/dYvE5IQGgBFV9hgTxtIRCQXrC+qlT/4XfQujmAdLQRcevCtShRp0QUzvh 9zU9cAt6XEYtBiW3Zago/Q7zdXBYgWJL9sg6JDI9xWZ0HeXEgbuWpZvJXJidlLrA 1xuZYoC7rM9Aj93ZBs/oGBwVWLh/YXOtLqsWEJw/Vn93xnu/3Lad+9T0WNC3CHgQ oZ4EX3Vkom0XBgk8EIIg4gZuoFYwKcEoW53O0m7k+KlLH3KymuA= =qrl4 -----END PGP SIGNATURE----- --MQg4Bg7a1Hfb2RQV--