Skip to content
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

1.9.5 fails to install on NixOS #55

Closed
RyanGibb opened this issue Jul 26, 2022 · 3 comments
Closed

1.9.5 fails to install on NixOS #55

RyanGibb opened this issue Jul 26, 2022 · 3 comments

Comments

@RyanGibb
Copy link

RyanGibb commented Jul 26, 2022

While installing ocamlfind 1.9.5 in NixOS 22.05:

$ opam install "ocamlfind=1.9.5"
...
#=== ERROR while installing ocamlfind.1.9.5 ===================================#
# context     2.1.2 | linux/x86_64 | ocaml.4.13.1 | https://opam.ocaml.org#e1c20992
# path        ~/.opam/default/.opam-switch/build/ocamlfind.1.9.5
# command     ~/.opam/opam-init/hooks/sandbox.sh install make install
# exit-code   2
# env-file    ~/.opam/log/ocamlfind-103265-a0c709.env
# output-file ~/.opam/log/ocamlfind-103265-a0c709.out
### output ###
# [...]
# install -d "`dirname \"/home/ryan/.opam/default/lib/findlib.conf\"`"
# test -f "/home/ryan/.opam/default/lib/findlib.conf" || install -c findlib.conf "/home/ryan/.opam/default/lib/findlib.conf"
# make[1]: Leaving directory '/home/ryan/.opam/default/.opam-switch/build/ocamlfind.1.9.5'
# for p in findlib; do ( cd src/$p; make install ); done
# make[1]: Entering directory '/home/ryan/.opam/default/.opam-switch/build/ocamlfind.1.9.5/src/findlib'
# install -d "/home/ryan/.opam/default/lib/findlib"
# install -d "/home/ryan/.opam/default/bin"
# install -d "/nix/store/sx7m5a7xwh76jzb05g07f3nbhl44qw4z-ocaml-4.13.1/lib/ocaml"
# install: cannot change permissions of ‘/nix/store/sx7m5a7xwh76jzb05g07f3nbhl44qw4z-ocaml-4.13.1/lib/ocaml’: Read-only file system
# make[1]: *** [Makefile:126: install] Error 1
# make[1]: Leaving directory '/home/ryan/.opam/default/.opam-switch/build/ocamlfind.1.9.5/src/findlib'
# make: *** [Makefile:24: install] Error 2
...

Note that in nix, /nix/store is read only to ensure reproducibility.

I've found that the last available version on opam, 1.9.3, works fine.

@RyanGibb
Copy link
Author

RyanGibb commented Jul 26, 2022

This happens with the NixOS packaged OCaml.

I've tried install OCaml through opam, but it fails for reasons that elude me even more:

$ opam init
...
[ERROR] The compilation of ocaml-base-compiler.4.14.0 failed at "make -j7".

#=== ERROR while compiling ocaml-base-compiler.4.14.0 =========================#
# context     2.1.2 | linux/x86_64 |  | https://opam.ocaml.org#42e749bd
# path        ~/.opam/default/.opam-switch/build/ocaml-base-compiler.4.14.0
# command     ~/.opam/opam-init/hooks/sandbox.sh build make -j7
# exit-code   2
# env-file    /tmp/opam-ryan-127226/ocaml-base-compiler-127226-316a5f.env
# output-file /tmp/opam-ryan-127226/ocaml-base-compiler-127226-316a5f.out
### output ###
# [...]
# gcc -c -O2 -fno-strict-aliasing -fwrapv -pthread -Wall -Wdeclaration-after-statement -fno-common -fexcess-precision=standard -fno-tree-vrp -ffunction-sections -g -fPIC  -D_FILE_OFFSET_BITS=64 -DCAML_NAME_SPACE  -DCAMLDLLIMPORT=  -o codefrag.bpic.o codefrag.c
# gcc -c -O2 -fno-strict-aliasing -fwrapv -pthread -Wall -Wdeclaration-after-statement -fno-common -fexcess-precision=standard -fno-tree-vrp -ffunction-sections -g  -D_FILE_OFFSET_BITS=64 -DCAML_NAME_SPACE  -DCAMLDLLIMPORT=  \
#   -o prims.o prims.c
# rm -f libcamlrun.a && false rc libcamlrun.a  interp.b.o misc.b.o stacks.b.o fix_code.b.o startup_aux.b.o startup_byt.b.o freelist.b.o major_gc.b.o minor_gc.b.o memory.b.o alloc.b.o roots_byt.b.o globroots.b.o fail_byt.b.o signals.b.o signals_byt.b.o printexc.b.o backtrace_byt.b.o backtrace.b.o compare.b.o ints.b.o eventlog.b.o floats.b.o str.b.o array.b.o io.b.o extern.b.o intern.b.o hash.b.o[...]
# rm -f libcamlrund.a && false rc libcamlrund.a  interp.bd.o misc.bd.o stacks.bd.o fix_code.bd.o startup_aux.bd.o startup_byt.bd.o freelist.bd.o major_gc.bd.o minor_gc.bd.o memory.bd.o alloc.bd.o roots_byt.bd.o globroots.bd.o fail_byt.bd.o signals.bd.o signals_byt.bd.o printexc.bd.o backtrace_byt.bd.o backtrace.bd.o compare.bd.o ints.bd.o eventlog.bd.o floats.bd.o str.bd.o array.bd.o io.bd.o ex[...]
# make[2]: *** [Makefile:274: libcamlrun.a] Error 1
# make[2]: *** Waiting for unfinished jobs....
# make[2]: *** [Makefile:283: libcamlrund.a] Error 1
# make[2]: Leaving directory '/home/ryan/.opam/default/.opam-switch/build/ocaml-base-compiler.4.14.0/runtime'
# make[1]: *** [Makefile:163: coldstart] Error 2
# make[1]: Leaving directory '/home/ryan/.opam/default/.opam-switch/build/ocaml-base-compiler.4.14.0'
# make: *** [Makefile:311: world.opt] Error 2



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build ocaml-base-compiler 4.14.0
└─
┌─ The following changes have been performed (the rest was aborted)
│ ∗ install base-bigarray         base
│ ∗ install base-threads          base
│ ∗ install base-unix             base
│ ∗ install ocaml-options-vanilla 1
└─

<><> ocaml-base-compiler.4.14.0 troubleshooting <><><><><><><><><><><><><><><><>
=> A failure in the middle of the build may be caused by build parallelism
      (enabled by default).
      Please file a bug report at
   https://github.com/ocaml/opam-repository/issues
=> You can try installing again including --jobs=1
      to force a sequential build instead

And using opam init --jobs=1:

[ERROR] The compilation of ocaml-base-compiler.4.14.0 failed at "make -j1".

#=== ERROR while compiling ocaml-base-compiler.4.14.0 =========================#
# context     2.1.2 | linux/x86_64 |  | https://opam.ocaml.org#42e749bd
# path        ~/.opam/default/.opam-switch/build/ocaml-base-compiler.4.14.0
# command     ~/.opam/opam-init/hooks/sandbox.sh build make -j1
# exit-code   2
# env-file    /tmp/opam-ryan-137563/ocaml-base-compiler-137563-669216.env
# output-file /tmp/opam-ryan-137563/ocaml-base-compiler-137563-669216.out
### output ###
# [...]
# gcc -c -O2 -fno-strict-aliasing -fwrapv -pthread -Wall -Wdeclaration-after-statement -fno-common -fexcess-precision=standard -fno-tree-vrp -ffunction-sections -g  -D_FILE_OFFSET_BITS=64 -DCAML_NAME_SPACE  -DCAMLDLLIMPORT=  -o bigarray.b.o bigarray.c
# gcc -c -O2 -fno-strict-aliasing -fwrapv -pthread -Wall -Wdeclaration-after-statement -fno-common -fexcess-precision=standard -fno-tree-vrp -ffunction-sections -g  -D_FILE_OFFSET_BITS=64 -DCAML_NAME_SPACE  -DCAMLDLLIMPORT=  -o main.b.o main.c
# gcc -c -O2 -fno-strict-aliasing -fwrapv -pthread -Wall -Wdeclaration-after-statement -fno-common -fexcess-precision=standard -fno-tree-vrp -ffunction-sections -g  -D_FILE_OFFSET_BITS=64 -DCAML_NAME_SPACE  -DCAMLDLLIMPORT=  -o memprof.b.o memprof.c
# gcc -c -O2 -fno-strict-aliasing -fwrapv -pthread -Wall -Wdeclaration-after-statement -fno-common -fexcess-precision=standard -fno-tree-vrp -ffunction-sections -g  -D_FILE_OFFSET_BITS=64 -DCAML_NAME_SPACE  -DCAMLDLLIMPORT=  -o domain.b.o domain.c
# gcc -c -O2 -fno-strict-aliasing -fwrapv -pthread -Wall -Wdeclaration-after-statement -fno-common -fexcess-precision=standard -fno-tree-vrp -ffunction-sections -g  -D_FILE_OFFSET_BITS=64 -DCAML_NAME_SPACE  -DCAMLDLLIMPORT=  -o skiplist.b.o skiplist.c
# gcc -c -O2 -fno-strict-aliasing -fwrapv -pthread -Wall -Wdeclaration-after-statement -fno-common -fexcess-precision=standard -fno-tree-vrp -ffunction-sections -g  -D_FILE_OFFSET_BITS=64 -DCAML_NAME_SPACE  -DCAMLDLLIMPORT=  -o codefrag.b.o codefrag.c
# rm -f libcamlrun.a && false rc libcamlrun.a  interp.b.o misc.b.o stacks.b.o fix_code.b.o startup_aux.b.o startup_byt.b.o freelist.b.o major_gc.b.o minor_gc.b.o memory.b.o alloc.b.o roots_byt.b.o globroots.b.o fail_byt.b.o signals.b.o signals_byt.b.o printexc.b.o backtrace_byt.b.o backtrace.b.o compare.b.o ints.b.o eventlog.b.o floats.b.o str.b.o array.b.o io.b.o extern.b.o intern.b.o hash.b.o[...]
# make[2]: *** [Makefile:274: libcamlrun.a] Error 1
# make[2]: Leaving directory '/home/ryan/.opam/default/.opam-switch/build/ocaml-base-compiler.4.14.0/runtime'
# make[1]: *** [Makefile:163: coldstart] Error 2
# make[1]: Leaving directory '/home/ryan/.opam/default/.opam-switch/build/ocaml-base-compiler.4.14.0'
# make: *** [Makefile:311: world.opt] Error 2

@dra27
Copy link
Member

dra27 commented Jul 26, 2022

I think the original error may be fixed by #54 - I think you can test that by running opam pin add ocamlfind git+https://github.com/AltGr/ocamlfind.git#fix-install-syscomp

For the other error, binutils doesn't appear to be properly available - the false rc is a result of failing to find the ar command. Can @timbertson help with that?

@RyanGibb
Copy link
Author

I think the original error may be fixed by #54 - I think you can test that by running opam pin add ocamlfind git+https://github.com/AltGr/ocamlfind.git#fix-install-syscomp

Yep, that fixed it! Strangely this occurs when I appear to be using the coreutils install though.

For the other error, binutils doesn't appear to be properly available - the false rc is a result of failing to find the ar command. Can @timbertson help with that?

Ah yes, I think this is due to opam not handling external dependencies for NixOS (related to ocaml/opam#5124). Installing bintools-unwrapped (and using jobs=1) fixes this.

Thanks, @dra27!\

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants