LBEM-CH / focus

High Throughput Electron Microscopy Image Processing Software
http://www.focus-em.org
GNU General Public License v2.0
36 stars 14 forks source link

`gfortran` segementation fault on compilation #188

Open robbmcleod opened 7 years ago

robbmcleod commented 7 years ago

Installing Focus on Ubuntu 16.04 results in some segmentation fault in building the CCP-EM Fortran backend. I suspect it is a version issue as I don't remember having similar problems in the past with 2dx in older Ubuntu versions. From 14.04 to 16.04, the default compiler went from gcc 4.8 to 5. so perhaps there is some problems with the newer gfortran that comes with it?

* sudo apt-get install gfortran-5 gfortran-5-multilib

[  9%] Built target 2dx_stack_processor
[ 10%] Built target add_noise
[ 10%] Built target fsplit
[ 10%] Generating miscsubs.for
e02daf.f
e02daz.f
e02dbf.f
e02zaf.f
e02zaz.f
ea06c.f
ea08c.f
ea09c.f
fa01as.f
Segmentation fault (core dumped)
kernel/mrc/lib/CMakeFiles/misc.dir/build.make:73: recipe for target 'kernel/mrc/lib/miscsubs.for' failed
make[2]: *** [kernel/mrc/lib/miscsubs.for] Error 139
CMakeFiles/Makefile2:874: recipe for target 'kernel/mrc/lib/CMakeFiles/misc.dir/all' failed
make[1]: *** [kernel/mrc/lib/CMakeFiles/misc.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2
Build failed for Focus

$ gfortran --version
GNU Fortran (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

Attempting direct compilation of the offending file gives the following errors:

gfortran -std=legacy kernel/mrc/lib/miscsubs.for 
kernel/mrc/lib/miscsubs.for:1907:11:

      *  ' =',I6)
           1
Error: Unexpected element ‘=’ in format string at (1)
kernel/mrc/lib/miscsubs.for:1907:6:

      *  ' =',I6)
      1
Error: Bad continuation line at (1)
kernel/mrc/lib/miscsubs.for:1907:9:

      *  ' =',I6)
         1
Error: Invalid character in name at (1)
kernel/mrc/lib/miscsubs.for:940:8:

 10    W(2)=A(2,2)
        1

Error: FORMAT label 99999 at (1) not defined
kernel/mrc/lib/miscsubs.for:2664:8:

       W(7)=0.D0
rdrighetto commented 7 years ago

Hi Robb,

I was not able to reproduce this issue on a machine with the same Ubuntu/gfortran versions:

$ gfortran --version GNU Fortran (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 2016060

It compiled just fine when using the build_all script. When I try to compile only the offending file like you did, I get the same error, but perhaps we are not providing the same flags that are actually used during the build. Can you confirm that the gfortran being used for build is the system default one? e.g. in the beginning of build the following lines are reported:

-- The Fortran compiler identification is GNU -- Check for working Fortran compiler: /usr/bin/gfortran -- Check for working Fortran compiler: /usr/bin/gfortran -- works -- Detecting Fortran compiler ABI info -- Detecting Fortran compiler ABI info - done -- Checking whether /usr/bin/gfortran supports Fortran 90 -- Checking whether /usr/bin/gfortran supports Fortran 90 -- yes -- adding gfortran specific flags

Thank you.