hyperion-rt / hyperion

Hyperion Radiative Transfer Code
http://www.hyperion-rt.org
BSD 2-Clause "Simplified" License
52 stars 26 forks source link

Linux: Fortran make trouble using gfortran (ifort worked) #23

Closed keflavich closed 11 years ago

keflavich commented 12 years ago

On a linux machine, I've successfully installed all of the dependencies as far as I can tell - h5py imports, mpif90 exists and looks healthy.

When I tried to ./configure & make the fortran binaries, I ran into a very long list of errors, leading with:

$ make 
h5fc -Jsrc/modules -Isrc/modules -g -ffree-line-length-none    src/mpi/mpi_core_nompi.f90 fortranlib/src/posix_default.f90 fortranlib/src/base_types.f90 fortranlib/src/lib_messages.f90 fortranlib/src/lib_io
 In file fortranlib/src/posix_default.f90:3

  use iso_c_binding
                  1
Fatal Error: Can't open module file 'iso_c_binding.mod' for reading at (1): No such file or directory

This only happened with the gfortran compiler. When I switched to the ifort compiler (which required re-installing the dependencies with ifort included in my path), there were no errors.

This is a non-urgent bug, but I figured it's worth reporting because of the apparent incompatibility with gfortran. I also wonder if general gfortran incompatibility issues might explain my mac install issues.

astrofrog commented 12 years ago

@keflavich - it looks like the gfortran compiler you are using on the Linux machine is too old. Could you run:

gfortran -dumpversion

and let me know the output?

Regarding the Mac installation, I've pushed a commit (81091590d244b76f8a68655e1ff798d367c4bc3c) that should fix your issue with the HDF5 installation. Could you update to the latest git version and try again?

keflavich commented 12 years ago
GNU Fortran (GCC) 4.1.2 20080704 (Red Hat 4.1.2-52)
Copyright (C) 2007 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING

Re: Mac - yes, I'll give it a shot (tomorrow, probably).

keflavich commented 12 years ago

On my mac, I get the same error.

fortranlib/src/posix_default.f90:3.19:

  use iso_c_binding
                  1
Fatal Error: Can't open module file 'iso_c_binding.mod' for reading at (1): No such file or directory

etc.

gfortran version is:

GNU Fortran (GCC) 4.2.3
Copyright (C) 2007 Free Software Foundation, Inc.
astrofrog commented 12 years ago

Ok - I need to check exactly what version of gfortran is required. If you have MacPorts installed, you can install e.g. gcc46 which gives you gfortran-mp-4.6 - then you just do:

./configure FC=gfortran-mp-4.6
keflavich commented 12 years ago

I assume I need to do that for the deps install, since the compiler used for the make is h5fc? Does the python install.py in fortran/deps respect the FC environmental variable? (it seems like it does not; I installed gfortran-4.6 with no success)

astrofrog commented 12 years ago

Ah yes - sorry - for the dependencies, try:

python install.py --fc-compiler=gfortran-mp-4.6 --cc-compiler=gcc-mp-4.6 -cxx-compiler=g++-mp-4.6 <directory>

Any luck?

keflavich commented 12 years ago

Luck indeed! I used the gfortran compilers hosted here: http://gcc.gnu.org/wiki/GFortranBinaries, specifically the gfortran-maintained mac compilers that install to /usr/local/gfortran/ (which is nice because there's a lot that doesn't play nice with gfortran-4.6)

Here are the commands I ended up using:

python install.py /usr/local/hyperion --fc-compiler=/usr/local/gfortran/bin/gfortran --cc-compiler=/usr/local/gfortran/bin/gcc --cxx-compiler=/usr/local/gfortran/bin/g++ 
FC=/usr/local/gfortran/bin/gfortran CC=/usr/local/gfortran/bin/gcc GCC=/usr/local/gfortran/bin/g++  ./configure --prefix=/usr/local/hyperion
FC=/usr/local/gfortran/bin/gfortran CC=/usr/local/gfortran/bin/gcc GCC=/usr/local/gfortran/bin/g++  make

Now it runs, and I see a bunch of WARNING: photon exceeded maximum number of interactions - killing [do_lucy] but I assume that means it's working and my model is just dumb.

keflavich commented 12 years ago

This solves the mac problem, not the original linux one in the issue header, but I think the answer is: gcc/gfortran >~ 4.5 (?) works.

astrofrog commented 12 years ago

I just checked my notes, and gfortran 4.3 and above should work. I'll try and clarify the docs for all this.

The note about the number of iterations usually indicates your optical depths are too large. If you continue to have problems with that, let me know!

fometeo commented 7 years ago

gfortran test.f90 -o test.exe use modulename 1 Fatal Error: Can't open module file 'modulename.mod' for reading at (1): No such file or directory if file modulename.mod is at /usr/local/include and libraries at /usr/local/lib such error goes away using: gfortran test.f90 -o test.exe -I/usr/local/include -L/usr/local/lib