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

Eigen-related opam install error #56

Closed
mars0i opened this issue Jul 4, 2017 · 4 comments
Closed

Eigen-related opam install error #56

mars0i opened this issue Jul 4, 2017 · 4 comments

Comments

@mars0i
Copy link
Contributor

mars0i commented Jul 4, 2017

As I reported on another issue, I was able to build Owl from source successfully after I installed openBLAS on one of my machines ("2011"). Now I’m having trouble on the other machine ("2015"). Both run MacOS 10.11.6. I can’t build Owl from source on the 2015 machine—that was the first problem after I installed gcc 7 and openBLAS. (There's been fuss lately about a bug with Sandy Bridge vs. Ivy Bridge CPUs. I believe I have Ivy Bridge.)

Then I found out that I can’t install Owl via opam either, so I don’t think the problem is with compiling from raw source or with openBLAS. At this point, I don’t have owl installed on the 2015 machine because I’d gotten it uninstalled when trying to build Owl from source.

All or nearly all of the error messages mention eigen-related files. That's true when I try to build Owl from source, too, but there are more error messages.

I’m only including the error report from opam, since the problem doesn’t seem to be specific to building from raw source. Let me know if you want more, though.

No need to reply quickly. I can keep working on the 2011 machine. (It's slower, but in the end it's the one that really matters at present.)

If you get a moment, I'm wonding if any diagnosis or suggestions jump out at you from the error messages below. I’ve tried changing to a new switch, recompiling openBLAS, opam uninstalling eigen, ctypes, etc. and reinstalling. Hopefully I didn't do something silly and obvious that I'm overlooking.

Thanks!

~$ opam install owl
The following actions will be performed:
  ∗  install owl 0.2.6

=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=  🐫
[owl] Archive in cache

=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=  🐫
[ERROR] The compilation of owl failed at "ocaml setup.ml -build".
Processing  1/1: [owl: ocaml]
#=== ERROR while installing owl.0.2.6 =========================================#
# opam-version 1.2.2
# os           darwin
# command      ocaml setup.ml -build
# path         /Users/mabrams/.opam/4.04.2/build/owl.0.2.6
# compiler     4.04.2
# exit-code    1
# env-file     /Users/mabrams/.opam/4.04.2/build/owl.0.2.6/owl-98640-6d07ae.env
# stdout-file  /Users/mabrams/.opam/4.04.2/build/owl.0.2.6/owl-98640-6d07ae.out
# stderr-file  /Users/mabrams/.opam/4.04.2/build/owl.0.2.6/owl-98640-6d07ae.err
### stdout ###
# Undefined symbols for architecture x86_64:
# [...]
#       construction vtable for std::__1::basic_iostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libeigen.a(eigen_tensor.o)
#   "virtual thunk to std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:
#       construction vtable for std::__1::basic_iostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libeigen.a(eigen_dsmat.o)
#       construction vtable for std::__1::basic_iostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libeigen.a(eigen_tensor.o)
# ld: symbol(s) not found for architecture x86_64
# collect2: error: ld returned 1 exit status
# File "caml_startup", line 1:
# Error: Error during linking
# Command exited with code 2.
### stderr ###
# E: Failure("Command ''/Users/mabrams/.opam/4.04.2/bin/ocamlbuild' lib/libowl_stubs.a lib/dllowl_stubs.so lib/owl.cma lib/owl.cmxa lib/owl.a lib/owl.cmxs lib/neural/owl_neural.cma lib/neural/owl_neural.cmxa lib/neural/owl_neural.a lib/neural/owl_neural.cmxs perftest/perf_common.cma perftest/perf_common.cmxa perftest/perf_common.a perftest/perf_common.cmxs perftest/perf_dense_real.native perftest/perf_sparse_real.native perftest/perf_sparse_complex.native perftest/perf_dense_ndarray.native perftest/perf_dense_matrix.native perftest/perf_sparse_ndarray.native perftest/perf_sparse_matrix.native perftest/perf_specific_fun.native examples/test_neural.native -use-ocamlfind -tag debug' terminated with error code 10")



=-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=  🐫
The following actions failed
  ∗  install owl 0.2.6
No changes have been performed
@ryanrhymes
Copy link
Member

It looks like Eigen didn't link to the correct c++ library. Have you tried to build Eigen by yourself? https://github.com/ryanrhymes/eigen

With Eigen, it first tries to build a lib linking to C++ using https://github.com/ryanrhymes/eigen/blob/master/lib/Makefile

Then Eigen will use oasis to build OCaml interface, you can see the -lstdc++ in oasis file. I suspect something went wrong in one of these two steps. I don't know if this relates to this issue or not: owlbarn/eigen#1

What is the model of your machine?

@mars0i
Copy link
Contributor Author

mars0i commented Jul 4, 2017

Eigen builds without problem, and seems to report that it's installed itself, but opam doesn't know about it. From the end of the output of make install:

...
Installed /Users/mabrams/.opam/4.04.2/lib/stublibs/dlleigen_stubs.so.owner
ocamlfind: [WARNING] You have installed DLLs but the directory /Users/mabrams/.opam/4.04.2/lib/stublibs is not mentioned in ld.conf
Installed /Users/mabrams/.opam/4.04.2/lib/eigen/META
~/docs/src/ml/eigen[master]*$ opam list | grep -i eigen
~/docs/src/ml/eigen[master]*$

When I try opam install owl, it wants to install Eigen first, which I didn't want to try--I don't want a confused configuration. When I try to build Owl on my own, I get similar eigen linking errors.

You've given me enough to investigate further, though. Thanks very much-

@mars0i
Copy link
Contributor Author

mars0i commented Jul 4, 2017

The problem was that when I installed gcc 7 using brew upgrade gcc, it named the links in /usr/local/bin "gcc-7", "g++-7", etc. So even though I have /usr/local/bin before /usr/bin in my PATH, I was getting the clang version of g++ in /usr/bin. (I had made a link from gcc to gcc-7, but foolishly didn't do the same for any of the other gcc-based executable links.)

It was your comments led me to this problem--thanks again. I think you can close this.

I'm not sure why this wasn't a problem on the other computer.

@ryanrhymes
Copy link
Member

Great, happy to know that you sorted out. Thanks for sharing this, it is also extremely useful others who might run into the same issue. I will improve the building and installation whenever I have time. Hopefully the future version will be better :)

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