[petsc-dev] Issue with dependency generation in GCC 9

Lisandro Dalcin dalcinl at gmail.com
Mon Jan 20 02:05:36 CST 2020


I'm using GCC 9 from Fedora 31. A few things have changed regarding
dependency generation, and things are now broken for PETSc. I do not have a
clean solution to propose.

The problem is the way targets are emitted :

$ head -n 3 arch-linux2-c-debug/obj/sys/objects/init.d
init.o: /home/devel/petsc/dev/src/sys/objects/init.c \
 /home/devel/petsc/dev/include/petscsys.h \
 /home/devel/petsc/dev/arch-linux2-c-debug/include/petscconf.h \

GCC now generates a bare "init.o" target. Using GCC 8 in a Manjaro box I
get instead:

$ head -n 3 arch-linux2-c-debug/obj/sys/objects/init.d
arch-linux2-c-debug/obj/sys/objects/init.o: \
 /home/devel/petsc/src/sys/objects/init.c \
 /home/devel/petsc/include/petscsys.h \

These differences totally break our use of dependencies:

$ touch include/petscsys.h
$ make
...
gmake[2]: Nothing to be done for 'all'.
...


My quick workaround so far has been to add this in makefiles:

C_DEPFLAGS   += -MT $@
CXX_DEPFLAGS += -MT $@
FC_DEPFLAGS  += -MT $@

>From the GCC info page

'-MT TARGET'

     Change the target of the rule emitted by dependency generation.  By
     default CPP takes the name of the main input file, deletes any
     directory components and any file suffix such as '.c', and appends
     the platform's usual object suffix.  The result is the target.

     An '-MT' option sets the target to be exactly the string you
     specify.  If you want multiple targets, you can specify them as a
     single argument to '-MT', or use multiple '-MT' options.

     For example, '-MT '$(objpfx)foo.o'' might give

          $(objpfx)foo.o: foo.c

-- 
Lisandro Dalcin
============
Research Scientist
Extreme Computing Research Center (ECRC)
King Abdullah University of Science and Technology (KAUST)
http://ecrc.kaust.edu.sa/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20200120/c7ac38ec/attachment.html>


More information about the petsc-dev mailing list