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

Opam Package Fails to Build #34

Open
llee454 opened this issue Dec 17, 2021 · 1 comment
Open

Opam Package Fails to Build #34

llee454 opened this issue Dec 17, 2021 · 1 comment

Comments

@llee454
Copy link

llee454 commented Dec 17, 2021

I ran opam install eigen on a laptop running Ubuntu. Opam failed with the following error message:

<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[eigen.0.3.0] found in cache
[owl.0.8.0] found in cache

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] The compilation of eigen failed at "/home/larry/.opam/opam-init/hooks/sandbox.sh build dune build -p eigen -j 15".

#=== ERROR while compiling eigen.0.3.0 ========================================#
# context     2.0.5 | linux/x86_64 | ocaml-system.4.08.1 | https://opam.ocaml.org#5bb6b8b7
# path        ~/.opam/default/.opam-switch/build/eigen.0.3.0
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p eigen -j 15
# exit-code   1
# env-file    ~/.opam/log/eigen-75083-d0f245.env
# output-file ~/.opam/log/eigen-75083-d0f245.out
### output ###
# [...]
# x86_64-linux-gnu-gcc eigen_cpp/eigen_spmat.o (exit 1)
# (cd _build/default/eigen_cpp && /usr/bin/x86_64-linux-gnu-gcc -O2 -fno-strict-aliasing -fwrapv -fPIC -fPIC -ansi -pedantic -O3 -std=c++11 -w -Wno-invalid-partial-specialization -Ofast -march=native -funroll-loops -ffast-math -g -I /usr/lib/ocaml -I /home/larry/.opam/default/lib/bytes -I /home/larry/.opam/default/lib/ctypes -I /home/larry/.opam/default/lib/integers -I lib -I lib/unsupported -o[...]
# cc1plus: error: bad value (‘tigerlake’) for ‘-march=’ switch
...

The problem appears to be that opam is using x86_64-linux-gnu-gcc to compile the Eigen library. Also, this issue with the march value appears to be fixed in gcc-10 and g++-10 (https://stackoverflow.com/questions/64493692/cc1plus-error-bad-value-tigerlake-for-march-switch-compilation-error). I have both installed (/usr/bin/x86_64-linux-gnu-gcc-10) but opam clearly isn't using this.

Is there any way to instruct opam to use a different compiler, march flag, etc?

@mseri
Copy link
Member

mseri commented Dec 17, 2021

There is a way to use a different gcc, I can remember which flag you need to set, but it would require you to recompile everything- including ocaml-if I recall correctly.

you can, however, customise all the flags for owl and eigen. For eigen itself, you can read here: https://github.com/owlbarn/eigen#optional-configuration

there is a similar section on the readme for owl, if you need to also change it

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