-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't get karamel nix flake to work #338
Comments
Thanks for the report!
|
With the above running warning: not writing modified lock file of flake 'github:fstarlang/karamel':
• Added input 'flake-utils':
follows 'fstar/flake-utils'
• Added input 'fstar':
'github:fstarlang/fstar/c24591d8371304cc252a0ecbe55f8167c9bf440b' (2023-03-21)
• Added input 'fstar/flake-utils':
'github:numtide/flake-utils/5aed5285a952e0b949eb3ba02c12fa4fcfef535f' (2022-11-02)
• Added input 'fstar/nixpkgs':
'github:NixOS/nixpkgs/2788904d26dda6cfa1921c5abb7a2466ffe3cb8c' (2022-11-22)
• Added input 'nixpkgs':
follows 'fstar/nixpkgs'
[nix-shell:~/krml-test]$ which krml
which: no krml in (/nix/store/mm2mnl0n16gi56dh85xsp2wfbzfkw88w-bash-interactive-5.2-p15/bin:/nix/store/zbr5i1jzfaj29v62g9r9xlibhv8295r6-patchelf-0.15.0/bin:/nix/store/rj91g41smpmp92xvhx6rjxz6878bn2b4-gcc-wrapper-12.2.0/bin:/nix/store/np14qqgvvnyna3vv640hmhi21flymiia-gcc-12.2.0/bin:/nix/store/qrzv77rkn5vf0fbbxl77rhhdd41xs8sk-glibc-2.35-224-bin/bin:/nix/store/z2k31yvarhcnlc98a76wm07q7a6ryla5-coreutils-9.1/bin:/nix/store/q5znq2mx417jj4mp3lmfqaql6k2jjnaz-binutils-wrapper-2.40/bin:/nix/store/nydwzhllkq0a21dny69zdjczh6v275lb-binutils-2.40/bin:/nix/store/z2k31yvarhcnlc98a76wm07q7a6ryla5-coreutils-9.1/bin:/nix/store/5pm0j70fz1b2jj6krvxbaamq3v0p5b69-findutils-4.9.0/bin:/nix/store/rmw415sc407q7wp1pp8qbqy6yg21rmif-diffutils-3.9/bin:/nix/store/sfiyijw1gp063ymv2m4zl58imkrfidsv-gnused-4.9/bin:/nix/store/a1s15jpz7fad571j2cyyczjpnxfnag0k-gnugrep-3.7/bin:/nix/store/45ncc133v5ncn8ivb1lkfv0wzfab9lx2-gawk-5.2.1/bin:/nix/store/6x4vhsssfhsirjxzim2j4c5qsqngd2gx-gnutar-1.34/bin:/nix/store/bm7gnjqqz2xp2gl82j0mvrrxmzgzdbv7-gzip-1.12/bin:/nix/store/plgdgfn64rz3x5ficwl0zp72sz17ycdq-bzip2-1.0.8-bin/bin:/nix/store/9qdfdlnzx4kgk5jqpim1xkrmp31bcraw-gnumake-4.4.1/bin:/nix/store/k32c6vzr9g1nln6v0gypz6ar6lqjb63l-bash-5.2-p15/bin:/nix/store/k1rd97yqvvaxch3nxli1gz7kbna8zxp1-patch-2.7.6/bin:/nix/store/y743qym3d429lkpp2j62jsrh90mziwk6-xz-5.4.1-bin/bin:/nix/store/s96idpb2aygp4jpj7zhnl6vvv9g6q83r-file-5.44/bin:/home/projects/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/home/projects/.emacs.d/bin:/home/projects/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin: [... some more home-dir bin directories ...])
[nix-shell:~/krml-test]$ which fstar.exe
which: no fstar.exe in (/nix/store/mm2mnl0n16gi56dh85xsp2wfbzfkw88w-bash-interactive-5.2-p15/bin:/nix/store/zbr5i1jzfaj29v62g9r9xlibhv8295r6-patchelf-0.15.0/bin:/nix/store/rj91g41smpmp92xvhx6rjxz6878bn2b4-gcc-wrapper-12.2.0/bin:/nix/store/np14qqgvvnyna3vv640hmhi21flymiia-gcc-12.2.0/bin:/nix/store/qrzv77rkn5vf0fbbxl77rhhdd41xs8sk-glibc-2.35-224-bin/bin:/nix/store/z2k31yvarhcnlc98a76wm07q7a6ryla5-coreutils-9.1/bin:/nix/store/q5znq2mx417jj4mp3lmfqaql6k2jjnaz-binutils-wrapper-2.40/bin:/nix/store/nydwzhllkq0a21dny69zdjczh6v275lb-binutils-2.40/bin:/nix/store/z2k31yvarhcnlc98a76wm07q7a6ryla5-coreutils-9.1/bin:/nix/store/5pm0j70fz1b2jj6krvxbaamq3v0p5b69-findutils-4.9.0/bin:/nix/store/rmw415sc407q7wp1pp8qbqy6yg21rmif-diffutils-3.9/bin:/nix/store/sfiyijw1gp063ymv2m4zl58imkrfidsv-gnused-4.9/bin:/nix/store/a1s15jpz7fad571j2cyyczjpnxfnag0k-gnugrep-3.7/bin:/nix/store/45ncc133v5ncn8ivb1lkfv0wzfab9lx2-gawk-5.2.1/bin:/nix/store/6x4vhsssfhsirjxzim2j4c5qsqngd2gx-gnutar-1.34/bin:/nix/store/bm7gnjqqz2xp2gl82j0mvrrxmzgzdbv7-gzip-1.12/bin:/nix/store/plgdgfn64rz3x5ficwl0zp72sz17ycdq-bzip2-1.0.8-bin/bin:/nix/store/9qdfdlnzx4kgk5jqpim1xkrmp31bcraw-gnumake-4.4.1/bin:/nix/store/k32c6vzr9g1nln6v0gypz6ar6lqjb63l-bash-5.2-p15/bin:/nix/store/k1rd97yqvvaxch3nxli1gz7kbna8zxp1-patch-2.7.6/bin:/nix/store/y743qym3d429lkpp2j62jsrh90mziwk6-xz-5.4.1-bin/bin:/nix/store/s96idpb2aygp4jpj7zhnl6vvv9g6q83r-file-5.44/bin:/home/projects/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/home/projects/.emacs.d/bin:/home/projects/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin: [... some more home-dir bin directories ...]) However, they both exist: [nix-shell:~/krml-test]$ find /nix/store -name fstar.exe
/nix/store/3lc816q4fq0fr4164jlw6w462wpyqm6q-ocaml4.14.0-fstar-71facac07710a40cfb2ad1bfe052d0c06d3d2e09/bin/fstar.exe
/nix/store/79r8qsdjv30ayqa5012mp56iayvx43xr-fstar-71facac07710a40cfb2ad1bfe052d0c06d3d2e09/bin/fstar.exe
/nix/store/cspc4pvyqi7vzivdm1h232dx3zw8d4lc-ocaml4.14.0-fstar-c24591d8371304cc252a0ecbe55f8167c9bf440b/bin/fstar.exe
/nix/store/80fjw1wzkxzsqgkqn660zx3l90nyww6n-fstar-c24591d8371304cc252a0ecbe55f8167c9bf440b/bin/fstar.exe Defining [nix-shell:~/krml-test]$ export FSTAR_HOME=/nix/store/79r8qsdjv30ayqa5012mp56iayvx43xr-fstar-71facac07710a40cfb2ad1bfe052d0c06d3d2e09
[nix-shell:~/krml-test]$ /nix/store/62v72mn6vr397j6pqf53naw4hqhd7dkv-karamel-dirty-home/krml -skip-linking -no-prefix Test Test.fst
⚙ KaRaMeL auto-detecting tools. Here's what we found:
readlink is: readlink
KaRaMeL called via: /nix/store/62v72mn6vr397j6pqf53naw4hqhd7dkv-karamel-dirty-home/krml
KaRaMeL home is: /nix/store/62v72mn6vr397j6pqf53naw4hqhd7dkv-karamel-dirty-home
⚙ KaRaMeL will drive F*. Here's what we found:
read FSTAR_HOME via the environment
F* library not found in ulib; falling back to lib/fstar
fstar is: /nix/store/79r8qsdjv30ayqa5012mp56iayvx43xr-fstar-71facac07710a40cfb2ad1bfe052d0c06d3d2e09/bin/fstar.exe /nix/store/62v72mn6vr397j6pqf53naw4hqhd7dkv-karamel-dirty-home/runtime/WasmS
upport.fst /nix/store/79r8qsdjv30ayqa5012mp56iayvx43xr-fstar-71facac07710a40cfb2ad1bfe052d0c06d3d2e09/lib/fstar/FStar.UInt128.fst --trace_error --expose_interfaces --include /nix/store/62v72m
n6vr397j6pqf53naw4hqhd7dkv-karamel-dirty-home/krmllib --include /nix/store/62v72mn6vr397j6pqf53naw4hqhd7dkv-karamel-dirty-home/include
⚡ Calling F* (use -verbose to see the output)
✔ [F*,extract] (use -verbose to see the output)
[...]
✔ [F*] ⏱️ 7s and 264ms
Warning 18: After bundling, two C files are named WasmSupport
✔ [Monomorphization] ⏱️ 36ms
✔ [Inlining] ⏱️ 2ms
✔ [Pattern matches compilation] ⏱️ 3ms
✔ [Structs + Simplify 2] ⏱️ 4ms
✔ [Drop] ⏱️ <1ms
✔ [AstToCStar] ⏱️ 2ms
✔ [CStarToC] ⏱️ <1ms
✔ [PrettyPrinting] ⏱️ <1ms
KaRaMeL: wrote out .c files for Test
KaRaMeL: wrote out .h files for Test
⚙ KaRaMeL will drive the C compiler. Here's what we found:
gcc is: x86_64-w64-mingw32-gcc
x86_64-w64-mingw32-gcc options are: -I /nix/store/62v72mn6vr397j6pqf53naw4hqhd7dkv-karamel-dirty-home/krmllib/dist/minimal -I /nix/store/62v72mn6vr397j6pqf53naw4hqhd7dkv-karamel-dirty-home/kr
mllib -I /nix/store/62v72mn6vr397j6pqf53naw4hqhd7dkv-karamel-dirty-home/include -I . -Wall -Werror -Wno-unused-variable -Wno-unknown-warning-option -Wno-unused-but-set-variable -Wno-unused-fu
nction -g -fwrapv -D_BSD_SOURCE -D_DEFAULT_SOURCE -Wno-parentheses -std=c11
⚡ Generating object files
✔ [CC,./Test.c] (use -verbose to see the output) |
If there's anything else I can do to help resolve this issue please let me know. Thanks for your help so far! |
@pnmadelaine any thoughts? |
I was trying to get the Tutorial from the book to compile. After some tinkering I got the following working nix shell: let
system = "x86_64-linux";
pkgs = import <nixpkgs> { inherit system; };
karamel = builtins.getFlake "github:fstarlang/karamel";
fstar = karamel.inputs.fstar.packages.${system}.fstar;
in pkgs.mkShell {
buildInputs = [ fstar ];
KRML_HOME = karamel.packages.${system}.karamel.home;
FSTAR_HOME = fstar.out;
} I then get [nix-shell:~/Repositories/karamel]$ which fstar.exe
/nix/store/n3flnf5vl2iv63jrlw5nnxndbixwrh7g-fstar-51da68d61444ea33960617dccbb963fde73c3efb/bin/fstar.exe
[nix-shell:~/Repositories/karamel]$ echo $FSTAR_HOME
/nix/store/n3flnf5vl2iv63jrlw5nnxndbixwrh7g-fstar-51da68d61444ea33960617dccbb963fde73c3efb
[nix-shell:~/Repositories/karamel]$ which krml
/nix/store/b25azb9q0j9qzg7yfgsia4fllqjhrgw7-karamel-dirty/bin/krml
[nix-shell:~/Repositories/karamel]$ echo $KRML_HOME
/nix/store/s3s9alkdc4av75c5blvr2bhqiykwapj6-karamel-dirty-home |
I had another look into the karamel and fstar flakes. fstar is an output of the karamel flake. The @pnmadelaine Do have an idea of why this is? |
Maybe @Nadrieril knows -- the karamel flake is being used regularly on CI so I'm not sure what the issue is here (I am not a nix expert) |
You may be interested in eurydice's flake.nix which has a dune package built with the karamel ocaml library. Is what you're trying to do different than what eurydice does (I know very little of karamel)? |
I'm trying to get karamel to run with nix. Maybe I missed a guide somewhere, but here's my documented failures. I would be very grateful for any pointers what I can fix in my setup to get it to run.
I have the following example
Test.fst
:My
~/.config/nix/nix.conf
containsI then ran
I then try:
Since apparently it's insufficient to just add the karamel flake, I ^D out of the shell and run
Since its assuming the karamel home is
/nix/store
I give itexport KRML_HOME=/nix/store/qwq5102fkdv934vv731f1chjn2fln3n7-karamel-dirty/
. Unfortunately this still does not work:From here I'm not sure how to continue, I tried adding
lib/krml
to theKRML_HOME
, but then I get a different error:The text was updated successfully, but these errors were encountered: