From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id SDoKLYwGdGdrSQEAqHPOHw:P1 (envelope-from ) for ; Tue, 31 Dec 2024 14:58:20 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id SDoKLYwGdGdrSQEAqHPOHw (envelope-from ) for ; Tue, 31 Dec 2024 15:58:20 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=lepiller.eu header.s=dkim header.b="Cg/YfutR"; 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"; dmarc=pass (policy=none) header.from=lepiller.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1735657100; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=qKp5WXbZ92wiCxoL3LKNIoLQ/dsx7Rzk3etW0UTk1to=; b=qY9gc4dOCkaTG7bw5yLmLho4zQNzEMjBV/6xlrad1M1oSL7eNOoIo4j/eb08D3QBtkFpUo +UviIUY2PbttcjM10ognZpYMF7vB4oDzV7r1X7jxuS+7+KSpIyULUtmoBWBMBUI643NLnD 3tulMF3Wmh7epTqTUPhzrXtONA8ovOjq+e7MxPdGu6KvoZnsbXeCl0bpFPN8xR1Z7AWmo5 mXRt6Cc0OfIXnMt64/Q+txoo2ub3iw36OCan39EctwM6htRPXh0znFRVX+4/x4uMvIgpaW uRqCyw3dm7IiEX9maQNrzM56zNvKsEIlG7z+2MCg7BvictKw04kGTnyMJqD84w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=lepiller.eu header.s=dkim header.b="Cg/YfutR"; 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"; dmarc=pass (policy=none) header.from=lepiller.eu ARC-Seal: i=1; s=key1; d=yhetil.org; t=1735657100; a=rsa-sha256; cv=none; b=lexHiwQIlKXtbmNxFBqIguH3ukYJpw5FCXKQwp7mJ7oMs7kaRmBZr/JchOudik1VmmIfBI 9tprT+dtDdpC7FY37/S7pmQ0hsedQSjdsviB48k+AveIK6IAk1hB3ChToudt5sF+Los+84 7hA8Ai2oIt9XJJbxZtUKtx2Zn4J0qQi2J8b3289FqVEPaL1koKK74SQLcwDKYVFAsl1ArO pPPVYVdO7IoCbLOxOuNHImUpT5LnPfH/ay73N21vhAM2165+37CGnrXXSyg4UNqfzPPw7I mJtjjHY09a94tRftUEeUc6Mpu3dquW9yHgH+uNMEdy72BGcbgBF2zWWTW2L4ig== 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 9F4AA86507 for ; Tue, 31 Dec 2024 15:58:20 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tSdh3-0001BT-Kp; Tue, 31 Dec 2024 09:58:01 -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 1tSdh0-00019o-Pn for help-guix@gnu.org; Tue, 31 Dec 2024 09:57:59 -0500 Received: from lepiller.eu ([2a00:5884:8208::1] helo=hermes.lepiller.eu) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tSdgy-0000GK-3o for help-guix@gnu.org; Tue, 31 Dec 2024 09:57:58 -0500 Received: from hermes.lepiller.eu (localhost [127.0.0.1]) by hermes.lepiller.eu (OpenSMTPD) with ESMTP id 200c7a30; Tue, 31 Dec 2024 14:57:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=date:from :to:subject:in-reply-to:references:message-id:mime-version :content-type:content-transfer-encoding; s=dkim; bh=NvsyB/4K8Wy6 Za1DXNyKmywBBbC9s6k834D/prqOvg4=; b=Cg/YfutRN073P16fsfwIvggD2sYv iMheic828MMlmTiFZrRvLlChKSniY8iEPjuZ6GUVv2J+rOfe4GaeaJtEutboiD+0 ByqBPFqklZiwyAgcz5VnaF+b7hPWhiwxTtlSna1y7HlH57HICII+0weE0S4uTNgS +RLAsPy/AMLCU2Gd+0vg8AoJPcQd6nneBUzANzDPMTGGKuXH1w+SmGnBnOfaHvXk NQlmltFMfPeIA0e6DsmIKby0Rv3fNPEMV9QHb8RPgHgtQCLJyrxMtA1HGRBQslDn DBNCQe5tTz65V8cFIZres6BpmOmNkYzYCE4UE/VIzbhbD1PqnRLSh3M13g== Received: by hermes.lepiller.eu (OpenSMTPD) with ESMTPSA id 57754679 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 31 Dec 2024 14:57:50 +0000 (UTC) Date: Tue, 31 Dec 2024 15:57:48 +0100 From: Julien Lepiller To: help-guix@gnu.org, Zelphir Kaltstahl Subject: =?US-ASCII?Q?Re=3A_OCaml_package_=60ocaml-zarith=60_no?= =?US-ASCII?Q?t_working_/_Guix_installed_=60ocamlc=60_?= =?US-ASCII?Q?not_picking_up_installed_libraries_?= =?US-ASCII?Q?=28addendum_3_-_comparison_with_guile=29?= User-Agent: K-9 Mail for Android In-Reply-To: References: <62213a9d-3bab-4f0f-bd7b-9a98b880ae0d@posteo.de> Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:5884:8208::1; envelope-from=julien@lepiller.eu; helo=hermes.lepiller.eu 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -6.58 X-Spam-Score: -6.58 X-Migadu-Queue-Id: 9F4AA86507 X-Migadu-Scanner: mx10.migadu.com X-TUID: Y/eRh8xVoAJr I tried and after adding ocaml-findlib in the shell, I was able to build wi= th: ocamlfind ocamlc -package zarith -linkpkg -o main main=2Eml I don't use ocaml often but it looks like how you need to specify the libr= aries to gcc with -I and -l=2E I don't know how it would work with ocamlc alone=2E Does it work like that= on other distros? Le 31 d=C3=A9cembre 2024 15:06:38 GMT+01:00, Zelphir Kaltstahl a =C3=A9crit=C2=A0: >On 30=2E12=2E24 18:50, Zelphir Kaltstahl wrote: >>=20 >> Hello Guix users, >>=20 >> I am facing a problem trying to use Guix to install Ocaml packages=2E >>=20 >> I was implementing a simple recursive factorial function, as part of le= arning the language, and tested what would happen, if I calculated factoria= l of 100 =2E=2E=2E Result: 0=2E "Ah!" I thought, "all I need to do is get t= hat Zarith package I have been reading about before, and import that in my = code!"=2E So I added it to my manifest=2Escm file, which I use for a `guix = shell`, and expected the Ocaml compiler to naturally pick up packages insta= lled via guix, since the Ocaml compiler ocamlc is also installed using guix= =2E However, it seems this is dysfunctional currently and ocamlc does not r= ealize that the library is in fact installed=2E I am not sure where it is l= ooking for libraries=2E >>=20 >> Here is how to reproduce: >>=20 >> ~~~~guix-env/channels=2Escm~~~~ >> (list (channel >> (name 'guix) >> (url"https://git=2Esavannah=2Egnu=2Eorg/git/guix=2Egit") >> (branch "master") >> (commit >> "4473f8ae902c2192cab6919363a9101ce9861e45") >> (introduction >> (make-channel-introduction >> "9edb3f66fd807b096b48283debdcddccfea34bad" >> (openpgp-fingerprint >> "BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA"))))= ) >> ~~~~ >>=20 >> ~~~~guix-env/manifest=2Escm~~~~ >> (specifications->manifest >> '("ocaml" >> "ocaml-utop" >> "dune" >> ;; "opam" ; using guix to install packages, should not need opam >> "bash" >> "ocaml-zarith")) >> ~~~~ >>=20 >> ~~~~main=2Eml~~~~ >> open Z >>=20 >> let factorial n =3D >> let rec iter n =3D >> if n < (of_int 2) >> then of_int 1 >> else mul n (iter (sub n (of_int 1))) >> in >> iter (of_int n) >>=20 >>=20 >> let _ =3D 5 |> factorial |> to_string |> print_endline >> let _ =3D 100 |> factorial |> to_string |> print_endline >> ~~~~ >>=20 >> ~~~~command~~~~ >> guix time-machine --channels=3Dguix-env/channels=2Escm -- shell --check= --manifest=3Dguix-env/manifest=2Escm -- bash -c 'ocamlc -c main=2Eml -o ma= in=2Ebyte' >>=20 >> guix shell: checking the environment variables visible from shell '/bin= /bash'=2E=2E=2E >> guix shell: All is good! The shell gets correct environment variables= =2E >> File "main=2Eml", line 1, characters 5-6: >> 1 | open Z >> ^ >> Error: Unbound module Z >> ~~~~ >>=20 >> If ocamlc does not check locations, where guix installs ocaml libraries= , then it is completely useless to install Ocaml libraries using Guix=2E Of= course a programming language without any libraries would also be unpleasa= nt to use for many things=2E >>=20 >> How can I make ocamlc realize, that the library is in fact installed, t= hat it just needs to look in the right places? >>=20 >> Is this something that can be properly fixed in some dynamically create= d configuration of ocamlc, so that it automatically will look in the correc= t directories, depending on which guix shell or which guix profile it is in= stalled in? >>=20 >> Is this perhaps even a defect of ocamlc itself, having hardcoded locati= ons where it looks for libraries? >>=20 >> Do I have to tell ocamlc somehow where it is supposed to be looking? (I= n that case I guess it cannot be used with `guix shell`, as the directories= are not predictable, and I would have to use a Guix profile=2E) >>=20 >> Best regards, >> Zelphir >>=20 >I want to draw attention to the following: > >This behavior is different from what we can observe with GNU Guile=2E Whe= n installing libraries for Guile via GNU Guix, Guile picks them up inside g= uix shells and guix profiles without issues=2E I suspect, that the way the = `ocaml` package is installed or the way `ocamlc` itself works or is built, = makes the difference=2E > >Best regards, >Zelphir >