yambo-code / yambo

This is the official GPL repository of the yambo code
http://www.yambo-code.eu/
GNU General Public License v2.0
98 stars 38 forks source link

Build fails: Makefile:89: *** missing separator #11

Open yurivict opened 6 years ago

yurivict commented 6 years ago

It fails to build on FreeBSD 11.2:

>>>[Making slatec]<<<
cp: lib/slatec/.objects and /usr/ports/science/yambo/work/yambo-4.2.3/lib/slatec/.objects are identical (not copied).
<command-line>:0:11: warning: ISO C99 requires whitespace after the macro name
gmake[3]: Entering directory '/usr/ports/science/yambo/work/yambo-4.2.3/lib/slatec'
Makefile:89: *** missing separator (did you mean TAB instead of 8 spaces?).  Stop.
gmake[3]: Leaving directory '/usr/ports/science/yambo/work/yambo-4.2.3/lib/slatec'
gmake[2]: *** [Makefile:171: int-libs] Error 2
klust commented 3 years ago

I've also run into this problem with other libraries used in Yambo (qe_pseudo to name) but it is not yet clear to me what triggers it. When I build by hand from the command line, the Makefile is correctly generated, but when I try to automate the build using EasyBuild for a central installation on our systems, it looks like some code that seems to be taken from hidden .objects files isn't put correctly in the generated Makefile. Instead the backslashed used to mark line continuation are removed.

JBlaschke commented 3 years ago

This also fails for me. I am following these instructions: http://www.yambo-code.org/wiki/index.php?title=Installation (using GNU make v 4.2.1) When I strip the line continuations out of the .objects files I get:

>>>[Making lib/yambo/interface]<<<
cp: '/global/cfs/cdirs/nstaff/blaschke/consulting/INC0166795/yambo/lib/yambo/driver/src/interface/.objects' and 'lib/yambo/driver/src/interface/.objects' are the same file
<command-line>: warning: ISO C99 requires whitespace after the macro name
make[1]: Entering directory '/global/cfs/cdirs/nstaff/blaschke/consulting/INC0166795/yambo/lib/yambo/driver/src/interface'
Makefile:104: *** missing separator.  Stop.
make[1]: Leaving directory '/global/cfs/cdirs/nstaff/blaschke/consulting/INC0166795/yambo/lib/yambo/driver/src/interface'
make: *** [config/mk/actions/compile_yambo.mk:3: yambo] Error 2

I poked around your build scripts, but I can't make sense of them.

JBlaschke commented 3 years ago

@klust how do I build yambo "by hand" (I don't mind editing Makefiles ;) )

sangallidavide commented 3 years ago

If you set in the configure

CPP="gcc -E -P"
FPP="gfortran -E -P -cpp"

does it help for this issue ?

yurivict commented 3 years ago

CPP="gcc -E -P"

With this it fails: configure: error: C compiler cannot create executables

yurivict commented 3 years ago

did you mean TAB instead of 8 spaces?

Do you auto-generate this Makefile? It looks like this file is missing backslashes in the lines in question (PP_objects assignment).

sangallidavide commented 3 years ago

With this it fails: configure: error: C compiler cannot create executables

So the issue now is not the pre-compiler, but the compiler?

CPP="gcc -E -P" \
FPP="gfortran -E -P -cpp" \
CC="gcc" \
FC="gfortran" \
MPICC="mpicc" \
MPIFC="mpifort"
yurivict commented 3 years ago

No, I think the original issue is:

Makefile:89: *** missing separator (did you mean TAB instead of 8 spaces?). Stop.

The makefile is broken at this line because it lacks trailing backslashes.

sangallidavide commented 3 years ago

No, I think the original issue is:

Makefile:89: *** missing separator (did you mean TAB instead of 8 spaces?). Stop.

The makefile is broken at this line because it lacks trailing backslashes.

In my experience, this issue happens when there are problems with the precompiler. A couple of user reported it, and setting the precompilers as suggested fixed the issue. See for example here: https://github.com/yambo-code/yambo/issues/34

Instead you report a compiler error when setting the pre-compiler (which I do not understand ... ).

klust commented 3 years ago

I received e-mails about this issue as I reacted to it once.

The key line in the error message in my experience is: warning: ISO C99 requires whitespace after the macro name.

The file sbin/make_makefile.sh (generated by configure from make_makefile.sh.in) relies on pre-C99 behaviour of the preprocessor. So on systems where the default behaviour of cpp is C99, the fourth code line of make_makefile.sh should read cppflags="-traditional". In my case, it turned out that I had to make sure that CPPFLAGS was not set as otherwise the option "-traditional" was not set by the configure script.

If cpp is not run in pre-C99 mode, lines in .object files in the libraries subdirectories that end with a backslash are not processed correctly and result in an illegal Makefile which then results in the missing separator error messages.

sangallidavide commented 3 years ago

The file sbin/make_makefile.sh (generated by configure from make_makefile.sh.in) relies on pre-C99 behaviour of the preprocessor. So on systems where the default behaviour of cpp is C99, the fourth code line of make_makefile.sh should read cppflags="-traditional". In my case, it turned out that I had to make sure that CPPFLAGS was not set as otherwise the option "-traditional" was not set by the configure script.

Thanks @klust. I understand a proper fix would be to upgrade make_makefile.sh.in, or switch to a more standard solution. Any suggestion ?

yurivict commented 3 years ago

With these settings:

CPP="gcc -E -P"
FPP="gfortran10 -E -P -cpp"

it fails with:

OS: FreeBSD 12.2

sangallidavide commented 3 years ago

This is the report from your log

/configure --prefix=/usr/local --localstatedir=/var --mandir=/usr/local/man --infodir=/usr/local/share/info/ --build=amd64-portbld-freebsd12.2
# [ CPP ] cpp10 -fno-omit-frame-pointer -D_HDF5_LIB -D_HDF5_IO  -D_FFTW       -D_TIMING     -D_P2Y_QEXSD_HDF5
# [ FPP ] cpp -E -P -ansi -D_HDF5_LIB -D_HDF5_IO  -D_FFTW       -D_TIMING    

It seems to me CPP and FPP was not set at configure time. What I mean is to run ./configure CPP="gcc -E -P" FPP="gfortran10 -E -P -cpp"

klust commented 3 years ago

@sangallidavide I checked back my notes and the lines that ultimately cause trouble in make_makefile.sh are

cp $cdir/$ofile $cdir/$ofile.c
$cpp $cppflags $dopts -D_$os -D_$target $cdir/$ofile.c >> $cdir/Makefile
rm -f $cdir/$ofile.c

The problem is I don't see how to get rid of cpp as some of the .objects files do contain preprocessor directives.

I've installed a lot of software for users of our cluster - that used to be a big part of my job until this year and will become a big part again in a few months but then on one of the pre-exascale systems - but I am not an expert in setting up autotools or CMake-based build processes so I don't know what the best advice would be.

I haven't tried the build process of 5.0 yet, the last version I tried to install for one of our users was 4.5.3. It did bother me there that it is not a standard autotools build process. For one thing, --prefix is not correctly supported and there is no make install. the package doesn't seem to be designed for a central install, though that is what many less experienced users like... I wonder if there are people in one of the Centres of Excellence that could offer the expertise to set up a proper autotools- or CMake-based build process or give some advice?

yurivict commented 3 years ago

This

./configure CPP="gcc -E -P" FPP="gfortran10 -E -P -cpp"

helped and now it passes this place. Now it fails:

read_upf_v2.f90:20:13:

   20 |         USE iotk_module
      |             1
Fatal Error: Cannot open module file 'iotk_module.mod' for reading at (1): No such file or directory
sangallidavide commented 3 years ago


   20 |         USE iotk_module
      |             1
Fatal Error: Cannot open module file 'iotk_module.mod' for reading at (1): No such file or directory```

This is likely because the compilation of the libraries failed at some previous step. It should be visible in the log.