arpack-ng icon indicating copy to clipboard operation
arpack-ng copied to clipboard

Another error when building with LLVM on MacOS

Open cesss opened this issue 5 years ago • 7 comments

I tried to build the 3.7.0 release on MacOS with LLVM and got errors related to headers for complex numbers. Then, after searching, I found this commit, more recent than the 3.7.0 release, so I tried to build the master branch instead.

But it failed with another error later, and also related to complex numbers headers:

In file included from /Users/src/arpack-ng/2020-01-17/PARPACK/TESTS/MPI/icb_parpack_cpp.cpp:14:
/Users/src/arpack-ng/2020-01-17/ICB/parpack.hpp:138:42: error: use of undeclared identifier '_Complex_I'
                      std::real(sigma) + _Complex_I * std::imag(sigma),
                                         ^
/Users/src/arpack-ng/2020-01-17/ICB/parpack.hpp:176:42: error: use of undeclared identifier '_Complex_I'
                      std::real(sigma) + _Complex_I * std::imag(sigma),
                                         ^
2 errors generated.

cesss avatar Jan 17 '20 18:01 cesss

Actually, researching it a bit more, it seems it's not a LLVM/MacOS specific issue, but that parpack.hpp is a C++ header, so it shouldn't use _Complex_I, which is a C complex number (read the StackOverflow accepted answer to this question)

cesss avatar Jan 17 '20 21:01 cesss

I tried doing in parpack.hpp the same modifications as were done to arpack.hpp and the build is successful, but however, when doing make test, the test 10/11 fails, and the test 11/11 seems to be stuck in an endless loop (two processes at 100% CPU, that I had to manually kill).

Curiously, the two tests that fail are the C++ tests:

make test
Running tests...
/Users/cesss/CMake/3.15.5/bin/ctest --force-new-ctest-process 
Test project /Users/cesss/build/arpack-ng/2020-01-17
      Start  1: dnsimp_tst
 1/11 Test  #1: dnsimp_tst .......................   Passed    0.02 sec
      Start  2: bug_1323_tst
 2/11 Test  #2: bug_1323_tst .....................   Passed    0.00 sec
      Start  3: bug_58_double_tst
 3/11 Test  #3: bug_58_double_tst ................   Passed    0.00 sec
      Start  4: bug_79_double_complex_tst
 4/11 Test  #4: bug_79_double_complex_tst ........   Passed    0.00 sec
      Start  5: bug_142_tst
 5/11 Test  #5: bug_142_tst ......................   Passed    0.00 sec
      Start  6: bug_142_gen_tst
 6/11 Test  #6: bug_142_gen_tst ..................   Passed    0.00 sec
      Start  7: issue46_tst
 7/11 Test  #7: issue46_tst ......................   Passed    0.03 sec
      Start  8: icb_arpack_c_tst
 8/11 Test  #8: icb_arpack_c_tst .................   Passed    0.23 sec
      Start  9: icb_arpack_cpp_tst
 9/11 Test  #9: icb_arpack_cpp_tst ...............Child aborted***Exception:   0.00 sec
      Start 10: icb_parpack_c_tst
10/11 Test #10: icb_parpack_c_tst ................   Passed    0.71 sec
      Start 11: icb_parpack_cpp_tst
^Cmake: *** [test] Interrupt: 2

In case it helps, the exception from test 9/11 is:

./TESTS/icb_arpack_cpp 
ERROR: iparam[4] 3, nev 9, info -9999
libc++abi.dylib: terminating with uncaught exception of type std::domain_error: Error inside ARPACK routines
Abort trap: 6

And I don't know how to diagnose test 11/11 because it seems to get into an endless loop.

cesss avatar Jan 17 '20 22:01 cesss

FWIW, another test fails if you build on MacOS without ICB (I tried to build without ICB just to check if everything was fine without it). So, it seems arpack-ng needs further testing and debugging on MacOS. For the moment, because I need to have ARPACK up and running for building a FEM package today, I'm going to revert to the old ARPACK, but I look forward to move to arpack-ng in the mid-term future.

Test results without ICB on MacOS:

make test
Running tests...
/Users/cesss/CMake/3.15.5/bin/ctest --force-new-ctest-process 
Test project /Users/cesss/build/arpack-ng/2020-01-17
    Start 1: dnsimp_tst
1/9 Test #1: dnsimp_tst .......................   Passed    0.03 sec
    Start 2: bug_1315_single_tst
2/9 Test #2: bug_1315_single_tst ..............***Failed    0.00 sec
    Start 3: bug_1315_double_tst
3/9 Test #3: bug_1315_double_tst ..............   Passed    0.02 sec
    Start 4: bug_1323_tst
4/9 Test #4: bug_1323_tst .....................   Passed    0.00 sec
    Start 5: bug_58_double_tst
5/9 Test #5: bug_58_double_tst ................   Passed    0.01 sec
    Start 6: bug_79_double_complex_tst
6/9 Test #6: bug_79_double_complex_tst ........   Passed    0.00 sec
    Start 7: bug_142_tst
7/9 Test #7: bug_142_tst ......................   Passed    0.00 sec
    Start 8: bug_142_gen_tst
8/9 Test #8: bug_142_gen_tst ..................   Passed    0.00 sec
    Start 9: issue46_tst
9/9 Test #9: issue46_tst ......................   Passed    0.06 sec

89% tests passed, 1 tests failed out of 9

Total Test time (real) =   0.15 sec

The following tests FAILED:
	  2 - bug_1315_single_tst (Failed)
Errors while running CTest
make: *** [test] Error 8

cesss avatar Jan 18 '20 10:01 cesss

Could you PR the modifications you had to do to get compilation OK on MacOS to check first if the CI is still OK on other OS (ubuntu, debian, fedora, ...) ?

So, it seems arpack-ng needs further testing and debugging on MacOS

Yes ! I am debian-based. No Mac available. You may try to PR a Mac job in .travis.yml : this may help to reproduce the problem (not used to Mac subtleties - would not be easy for me : already tried to PR a windows job without success !)

Would start with

>> git diff
diff --git a/.travis.yml b/.travis.yml
index c091180..96bc398 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -36,6 +36,7 @@ stages:
   - name: coverage
   - name: interface64
   - name: fedora
+  - name: osx
 
 jobs:
   include:
@@ -261,6 +262,10 @@ jobs:
       sudo docker cp -a ${TRAVIS_BUILD_DIR} mobydick:/tmp                                   \
       &&                                                                                    \
       sudo docker start -a mobydick
+  # osx
+  - stage: osx
+    dist: osx
+    script: mkdir -p build && cd build && cmake -D EXAMPLES=ON            -D ICB=ON  .. && make VERBOSE=1 && make test;
 
 after_failure:
 

But it this build fails... Not idea what to do next : never had a Mac !

fghoussen avatar Jan 18 '20 11:01 fghoussen

The only change I did (for getting a successful compilation with ICB on MacOS) is the parpack.hpp header (applying analogous changes to previous commits to arpack.hpp). I was unable to make the tests pass, though.

I'm in a bit of a hurry just now, so I'm just attaching the file so that you can diff it for yourself and see if what I made makes sense and if it's correct or not.

parpack.hpp.zip

cesss avatar Jan 18 '20 11:01 cesss

@cesss : you mention llvm, but, do you really use [cf]lang or gcc/gfortran compilers ? Look in cmake summary (traces). In #234 : I install llvm but get gcc compilers ?!...

fghoussen avatar Jan 19 '20 18:01 fghoussen

@cess: should be OK now? If so, can you close the issue?

fghoussen avatar Apr 23 '22 20:04 fghoussen