dpo / homebrew-openblas

Homebrew formulae for an openblas-based toolchain
BSD 2-Clause "Simplified" License
12 stars 1 forks source link

ipopt installation fails #75

Closed kfiz closed 6 years ago

kfiz commented 6 years ago

Hi, ipopt installation fails during make test. My guess: the tests have some open-mpi dependency, that is not satisfied.

Running unitTests...

Testing AMPL Solver Executable...
./run_unitTests: line 55: 28065 Abort trap: 6           ../src/Apps/AmplSolver/ipopt mytoy.nl > tmpfile 2>&1

 ---- 8< ---- Start of test program output ---- 8< ----
dyld: lazy symbol binding failed: Symbol not found: _omp_get_max_threads_
  Referenced from: /usr/local/opt/mumps/lib/libdmumps.dylib
  Expected in: flat namespace

dyld: Symbol not found: _omp_get_max_threads_
  Referenced from: /usr/local/opt/mumps/lib/libdmumps.dylib
  Expected in: flat namespace

 ---- 8< ----  End of test program output  ---- 8< ----

    ******** Test FAILED! ********
Output of the test program is above.
Testing C++ Example...
./run_unitTests: line 59: 28082 Abort trap: 6           ./hs071_cpp > tmpfile 2>&1

 ---- 8< ---- Start of test program output ---- 8< ----
dyld: lazy symbol binding failed: Symbol not found: _omp_get_max_threads_
  Referenced from: /usr/local/opt/mumps/lib/libdmumps.dylib
  Expected in: flat namespace

dyld: Symbol not found: _omp_get_max_threads_
  Referenced from: /usr/local/opt/mumps/lib/libdmumps.dylib
  Expected in: flat namespace

 ---- 8< ----  End of test program output  ---- 8< ----

    ******** Test FAILED! ********
Output of the test program is above.
Testing C Example...
./run_unitTests: line 77: 28099 Abort trap: 6           ./hs071_c > tmpfile 2>&1

 ---- 8< ---- Start of test program output ---- 8< ----
dyld: lazy symbol binding failed: Symbol not found: _omp_get_max_threads_
  Referenced from: /usr/local/opt/mumps/lib/libdmumps.dylib
  Expected in: flat namespace

dyld: Symbol not found: _omp_get_max_threads_
  Referenced from: /usr/local/opt/mumps/lib/libdmumps.dylib
  Expected in: flat namespace

 ---- 8< ----  End of test program output  ---- 8< ----

    ******** Test FAILED! ********
Output of the test program is above.
Testing Fortran Example...
./run_unitTests: line 114: 28116 Abort trap: 6           ./hs071_f > tmpfile 2>&1

 ---- 8< ---- Start of test program output ---- 8< ----
dyld: lazy symbol binding failed: Symbol not found: _omp_get_max_threads_
  Referenced from: /usr/local/opt/mumps/lib/libdmumps.dylib
  Expected in: flat namespace

dyld: Symbol not found: _omp_get_max_threads_
  Referenced from: /usr/local/opt/mumps/lib/libdmumps.dylib
  Expected in: flat namespace

Program received signal SIGABRT: Process abort signal.

Backtrace for this error:
#0  0x10641f1ac
#1  0x10641e553
#2  0x7fff61d1ef59
 ---- 8< ----  End of test program output  ---- 8< ----

    ******** Test FAILED! ********

Best

Doro

dpo commented 6 years ago

Thanks for the report. IPOPT depends on serial MUMPS, which doesn't depend on MPI. The error messages suggest something having to do with OpenMP. Could you post the output of brew gist-logs ipopt? Thanks.

kfiz commented 6 years ago

https://gist.github.com/821c3c3297ae7694d55d1f3351b3a13e

dpo commented 6 years ago

I don't see any clues in there. It's possible something else got updated and out of sync. Could you try brew uninstall $(brew deps -r ipopt) followed by brew install ipopt?

kfiz commented 6 years ago

Tried that, but it didn't work. Same result.

kfiz commented 6 years ago

FWIW I installed the package without tests, since I will not use ipopt from c or c++.

dpo commented 6 years ago

Ok, I hope it works out for you until I figure out what went wrong.

dpo commented 6 years ago

Actually, could you post the output of brew gist-logs mumps? Thanks.

kfiz commented 6 years ago

https://gist.github.com/9b0130316ad0ba96132096ebcd1fb4b6

dpo commented 6 years ago

I'm not sure why we don't see the MUMPS tests in the logs. Do those pass?

kfiz commented 6 years ago

Should there be tests when compiling MUMPS from your formula? I'don't think they are executed.

dpo commented 6 years ago

Actually you're right. I'll see if there are tests that can be run at build time. Does brew test mumps succeed?

EDIT: brew test mumps runs the same tests that could be run at build time, so that should be sufficient.

kfiz commented 6 years ago

brew test mumps succeeds.

kfiz commented 6 years ago

So when running the ipopt tests obviously clang is looking for omp.h and can't find it. So I checked whether libomp is installed on my system, which it is. So my guess would be that clang is looking at the wrong places. omp.h is symlinked to /usr/local/include and libomp.dylib is symlinked to /usr/local/lib, so nothing out of the ordinary here. I haven't found a way yet to tell ipopt where to look for headers. Any suggestions?

dpo commented 6 years ago

The only way OpenMP comes into play is via METIS. Are you sure you have d86f1fbc152ccad632ba02be40ab251f8ca1ee31? If not, brew update. Let's also see if #77 succeeds on the test bots.

kfiz commented 6 years ago

Are you sure you have d86f1fb?

Yes, definitely.

Let's also see if #77 succeeds on the test bots.

ok

dpo commented 6 years ago

77 fails with the same error message. That gives me something to work with.

dpo commented 6 years ago

It turns out that -fopenmp should be added to the compile flags because either MUMPS or METIS always depends on it. Somehow, the linker needs the flag again. Could you try brew update and brew install ipopt again?

kfiz commented 6 years ago

Done, but clang weirdly doesn't seem to like -fopenmp on my machine... https://gist.github.com/275d9f6817f632542ae99b9e8c722a32

dpo commented 6 years ago

Something's wrong because ipopt says depends_on "gcc", so it shouldn't be using clang at all. If you brew edit ipopt and add the line

fails_with :clang

just before def install, does it work? For some reason, I don't need to do that, and neither does the build bot...

kfiz commented 6 years ago

That helped, which leads to a partial success, since now all tests, except for the Fortran Test succeed. https://gist.github.com/208cc078bfbbd463f5ab3a6e806f19f0

kfiz commented 6 years ago

The problem seems to be, that fopenmp is not passed to gfortran.

kfiz commented 6 years ago

So I adjusted FCFLAGS in ipopt.rb and now it works. Here's the patch of all the changes. ipopt.patch.txt

dpo commented 6 years ago

Would this work?

diff --git a/ipopt.rb b/ipopt.rb
index 617ee6c..b9b121a 100644
--- a/ipopt.rb
+++ b/ipopt.rb
@@ -14,6 +14,8 @@ class Ipopt < Formula
   depends_on "openblas"
   depends_on "pkg-config" => :build

+  fails_with :clang # because of OpenMP
+
   def install
     mumps_libs = %w[-ldmumps -lmumps_common -lpord -lmpiseq]
     mumps_libs << "-lmetis" if Tab.for_name("mumps").with?("metis")
@@ -35,6 +37,7 @@ class Ipopt < Formula
             "--with-asl-lib=-L#{Formula["ampl-mp"].opt_lib} -lasl"]

     ENV.append_to_cflags "-fopenmp" # for MUMPS and/or METIS
+    ENV.append "FFLAGS", "-fopenmp"
     system "./configure", *args
     system "make"
     ENV.deparallelize # Needs a serialized install
kfiz commented 6 years ago

That works for me.

dpo commented 6 years ago

Ok, thank you. #78 should do it then.