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

building version 1.1.0 fails on Ubuntu 22.04 #250

Open alexmyczko opened 10 months ago

alexmyczko commented 10 months ago
[ 12%] Built target 2dx_avrgamphs
[ 12%] Linking Fortran executable 2dx_boximage.exe
/usr/bin/ld: CMakeFiles/2dx_boximage.dir/2dx_boximage.for.o: in function `MAIN__':
2dx_boximage.for:(.text+0x92): undefined reference to `imopen_'
/usr/bin/ld: 2dx_boximage.for:(.text+0xb7): undefined reference to `imopen_'
/usr/bin/ld: 2dx_boximage.for:(.text+0xfd): undefined reference to `irdhdr_'
/usr/bin/ld: 2dx_boximage.for:(.text+0x110): undefined reference to `irtcel_'
/usr/bin/ld: 2dx_boximage.for:(.text+0x322): undefined reference to `icrhdr_'
/usr/bin/ld: 2dx_boximage.for:(.text+0x331): undefined reference to `itrlab_'
/usr/bin/ld: 2dx_boximage.for:(.text+0xaca): undefined reference to `ialorg_'
/usr/bin/ld: 2dx_boximage.for:(.text+0xae3): undefined reference to `ialsiz_'
/usr/bin/ld: 2dx_boximage.for:(.text+0xbbd): undefined reference to `iwrhdr_'
/usr/bin/ld: 2dx_boximage.for:(.text+0xd4f): undefined reference to `irdpal_'
/usr/bin/ld: 2dx_boximage.for:(.text+0xe26): undefined reference to `irdpal_'
/usr/bin/ld: 2dx_boximage.for:(.text+0xecd): undefined reference to `irdpal_'
/usr/bin/ld: 2dx_boximage.for:(.text+0xf53): undefined reference to `irdpal_'
/usr/bin/ld: 2dx_boximage.for:(.text+0x1730): undefined reference to `ialorg_'
/usr/bin/ld: 2dx_boximage.for:(.text+0x1749): undefined reference to `ialsiz_'
/usr/bin/ld: 2dx_boximage.for:(.text+0x1758): undefined reference to `ialcel_'
/usr/bin/ld: 2dx_boximage.for:(.text+0x1822): undefined reference to `iwrhdr_'
/usr/bin/ld: 2dx_boximage.for:(.text+0x1970): undefined reference to `irdpal_'
/usr/bin/ld: 2dx_boximage.for:(.text+0x19d3): undefined reference to `irdpal_'
/usr/bin/ld: 2dx_boximage.for:(.text+0x1bfa): undefined reference to `irdpal_'
/usr/bin/ld: 2dx_boximage.for:(.text+0x1c6f): undefined reference to `irdpal_'
/usr/bin/ld: 2dx_boximage.for:(.text+0x1e60): undefined reference to `iwrlin_'
/usr/bin/ld: 2dx_boximage.for:(.text+0x1ef1): undefined reference to `irdlin_'
/usr/bin/ld: 2dx_boximage.for:(.text+0x21f6): undefined reference to `iwrlin_'
/usr/bin/ld: 2dx_boximage.for:(.text+0x23b9): undefined reference to `iwrlin_'
/usr/bin/ld: 2dx_boximage.for:(.text+0x24d7): undefined reference to `irdlin_'
/usr/bin/ld: 2dx_boximage.for:(.text+0x26e6): undefined reference to `iwrlin_'
/usr/bin/ld: 2dx_boximage.for:(.text+0x27ae): undefined reference to `iwrlin_'
/usr/bin/ld: 2dx_boximage.for:(.text+0x282a): undefined reference to `iwrhdr_'
/usr/bin/ld: 2dx_boximage.for:(.text+0x29af): undefined reference to `imclose_'
/usr/bin/ld: 2dx_boximage.for:(.text+0x29bb): undefined reference to `imclose_'
/usr/bin/ld: 2dx_boximage.for:(.text+0x2a8b): undefined reference to `iwrlin_'
/usr/bin/ld: 2dx_boximage.for:(.text+0x2af6): undefined reference to `iwrhdr_'
collect2: error: ld returned 1 exit status
make[2]: *** [kernel/mrc/source/CMakeFiles/2dx_boximage.dir/build.make:107: kernel/mrc/source/2dx_boximage.exe] Error 1
make[1]: *** [CMakeFiles/Makefile2:1745: kernel/mrc/source/CMakeFiles/2dx_boximage.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
Build failed for Focus
sthennin commented 10 months ago

You may use the wrong compiler. What system, which software version, which compiler environment is that on? You have to follow the instructions here: https://lbem-focus.epfl.ch/wiki/doku.php?id=1_0:install-source

alexmyczko commented 10 months ago

I did, I have:

dpkg -l cmake gfortran g++ libfftw3-dev qtscript5-dev
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                Version        Architecture Description
+++-===================-==============-============-===========================================================
ii  cmake               3.28.1-1       amd64        cross-platform, open-source make system
ii  g++                 4:13.2.0-4     amd64        GNU C++ compiler
ii  gfortran            4:13.2.0-4     amd64        GNU Fortran 95 compiler
ii  libfftw3-dev:amd64  3.3.10-1       amd64        Library for computing Fast Fourier Transforms - development
ii  qtscript5-dev:amd64 5.15.10+dfsg-2 amd64        Qt 5 script development files

The same on Ubuntu 22.04 as well as Debian GNU/Linux sid.

sthennin commented 10 months ago

Somehow, your compiler doesn't find the libraries in .../focus/kernel/mrc/lib. These should have been compiled first, and the linker then needs to find those. IWRLIN and IMCLOSE etc. are all from those image2000 libraries.

My guess is that this has to do with the version of gcc / g++ used.

alexmyczko commented 10 months ago

Using ./build_all and gcc-12/g++-12 it builds... until 18% (master) Also tried versions 9, and 11. With the same failure. I would like some help here, maybe you can send a full successfull ./build_all output with the detail which Debian or Ubuntu versions of cmake, g++, gfortran, libfftw3-dev, qtscript5-dev you are using?

And maybe a new release tag would be nice too?

hsai1020 commented 1 month ago

Hi, I'm having the same issue. I believe this issue is related to the gfortran since I got errors like the following for the relevant library compilation:

   93 |           CALL ODFFT(ARRAY,NX,NLINES,0)
      |                          2
......
  117 |           CALL ODFFT(CRAY,NY,NUSE,-1)
      |                          1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (COMPLEX(4)/REAL(4)).
/home/cryosparcuser/focus/build/kernel/mrc/lib/bigfilt.f:141:19:

   93 |           CALL ODFFT(ARRAY,NX,NLINES,0)
      |                          2
......
  141 |           CALL ODFFT(CRAY,NY,NUSE,-2)
      |                          1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (COMPLEX(4)/REAL(4)).
/home/cryosparcuser/focus/build/kernel/mrc/lib/bigfilt.f:150:27:

   94 |           CALL QWRITE(ISCR,ARRAY,NSEC)
      |                                2
......
  150 |             CALL QWRITE(ISCR,CLINE,NUSE8)
      |                                  1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (COMPLEX(4)/REAL(4)).
/home/cryosparcuser/focus/build/kernel/mrc/lib/bigfilt.f:165:19:

   93 |           CALL ODFFT(ARRAY,NX,NLINES,0)
      |                          2
......
  165 |           CALL ODFFT(CRAY,NX,NLINES,1)
      |                          1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (COMPLEX(4)/REAL(4)).

before the same error as OP's.

My environment is as follows:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                Version                 Architecture Description
+++-===================-=======================-============-===========================================================
ii  cmake               3.22.1-1ubuntu1.22.04.2 amd64        cross-platform, open-source make system
ii  g++                 4:11.2.0-1ubuntu1       amd64        GNU C++ compiler
ii  gfortran            4:11.2.0-1ubuntu1       amd64        GNU Fortran 95 compiler
ii  libfftw3-dev:amd64  3.3.8-2ubuntu8          amd64        Library for computing Fast Fourier Transforms - development
ii  qtscript5-dev:amd64 5.15.3+dfsg-1           amd64        Qt 5 script development files

The error "Type mismatch" looks like it is due to the newer version of gfortran with mpi. https://github.com/pmodels/mpich/issues/4300 https://stackoverflow.com/questions/69686755/fortran-error-type-mismatch-between-actual-argument-at-1-and-actual-argument

I don't know how to pass the necessary flags for fortran ("-w -fallow-argument-mismatch") in CMake. Any help would be appreciated.

hsai1020 commented 1 month ago

I finished the compilation by modifying the following files:

kernel/mrc/lib/CMakeLists.txt kernel/mrc/source/CMakeLists.txt kernel/mrc/source/ctf/CMakeLists.txt kernel/mrc/source/ctfcor/CMakeLists.txt kernel/mrc/source/MOVIE/CMakeLists.txt kernel/mrc/source/fouriercrop/CMakeLists.txt for each CMakeLists.txt, I edited the fortran environment parameter to append -fallow-argument-mismatch for the fortran compiler used (in my case it was gfortran, so Line 33 in kernel/mrc/source/CMakeLists.txt for example). Additionally, I had to edit line 83 in kernel/mrc/source/CMakeLists.txt to remove -openMP (my guess is it has to be -fopenMP) After this, the compiled software can run normally. No GPU support, but since I'm using it for 2D crystallography it's ok.