0

I am stuck with this error:

mpif90 -o /Users/manfredo/Desktop/ED2/ED/build/ed_2.1-opt edmain.o -L/opt/local/lib/libgcc/ -lstdc++ -I/Users/manfredo/Desktop/ED2/ED/src/include -I/opt/local/include   /Users/manfredo/Desktop/ED2/ED/build/ed_2.1-opt.a -lm -lz -L/opt/local/lib -lhdf5 -lhdf5_fortran
Undefined symbols for architecture x86_64:
  "_calchydrosubsurface_", referenced from:
      _ed_model_ in ed_2.1-opt.a(ed_model.o)
...
other similar errors
...
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[1]: *** [/Users/manfredo/Desktop/ED2/ED/build/ed_2.1-opt] Error 1
make: *** [all] Error 2

I have tried adding -stdlib=libstdc++ or including the libraries lstdc++ or lstc++.6 as suggested here or here and I had already posted a question about the same error but still not able to fix it. The compilation with mpif is needed. Any help will be appreciated.

Community
  • 1
  • 1
Manfredo
  • 1,760
  • 4
  • 25
  • 53
  • `calchydrosubsurface` doesn't sound like a standard library function at all. The problem could be the *order* you add your special libraries. The one using the function ought to be searched before the one implementing it. – Bo Persson Oct 13 '15 at 09:03
  • I am sorry, can you be more specific please. By the way the makefile includes a dependency.mk file where all the dependencies are listed and the package compiles fine on other platforms, for this reason I was thinking that the error might depend on the `stdlib` that my mac (10.9) is using. – Manfredo Oct 13 '15 at 10:00
  • The name `_calchydrosubsurface_` that is missing let suggest that the corresponding function is to be found in some Fortran sources of yours (the tailing _ let suggest it is Fortran object). What does a `grep -ri calchydrosubsurface /Users/manfredo/Desktop/ED2/ED/` give? – Gilles Oct 13 '15 at 10:04
  • `Binary file /Users/manfredo/Desktop/ED2/ED//build/bin/ed_model.o matches Binary file /Users/manfredo/Desktop/ED2/ED//build/bin/lsm_hyd.o matches Binary file /Users/manfredo/Desktop/ED2/ED//build/ed_2.1-opt.a matches` and indeed the f90 file containing the function has been compiled and has produced the corresponding .o file – Manfredo Oct 13 '15 at 10:21
  • Try something like this: `mpif90 -o /Users/manfredo/Desktop/ED2/ED/build/ed_2.1-opt edmain.o -Wl,--whole-archive /Users/manfredo/Desktop/ED2/ED/build/ed_2.1-opt.a -Wl,--no-whole-archive -L/opt/local/lib -lhdf5 -lhdf5_fortran -L/opt/local/lib/libgcc/ -lstdc++ -lz -lm` – Gilles Oct 13 '15 at 10:36
  • I had to use -all_load option, OSX equivalent to --whole-archive (?). But the errors are still there. – Manfredo Oct 13 '15 at 11:38
  • Compiled disabling mpi (using gfortran and gcc) but same errors. No clues? – Manfredo Oct 16 '15 at 09:03

0 Answers0