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

Matthew Knepley knepley at gmail.com
Mon Jan 20 06:30:55 CST 2020


On Mon, Jan 20, 2020 at 7:22 AM Matthew Knepley <knepley at gmail.com> wrote:

> On Mon, Jan 20, 2020 at 7:06 AM Lisandro Dalcin <dalcinl at gmail.com> wrote:
>
>> On Mon, 20 Jan 2020 at 14:14, Matthew Knepley <knepley at gmail.com> wrote:
>>
>>> On Mon, Jan 20, 2020 at 3:06 AM Lisandro Dalcin <dalcinl at gmail.com>
>>> wrote:
>>>
>>>> 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
>>>>
>>>
>>> Why is my GCC 9.1 not doing this?
>>>
>>> master *$:/PETSc3/petsc/petsc-dev$ head -n 3
>>> arch-master-debug/obj/sys/objects/init.d
>>> arch-master-debug/obj/sys/objects/init.o: \
>>>   /PETSc3/petsc/petsc-dev/src/sys/objects/init.c \
>>>   /PETSc3/petsc/petsc-dev/include/petscsys.h \
>>> master *$:/PETSc3/petsc/petsc-dev$ head -n 3
>>> arch-master-gcc-debug/obj/sys/objects/init.d
>>> arch-master-gcc-debug/obj/sys/objects/init.o: \
>>>  /PETSc3/petsc/petsc-dev/src/sys/objects/init.c \
>>>  /PETSc3/petsc/petsc-dev/include/petscsys.h \
>>> master *$:/PETSc3/petsc/petsc-dev$ /PETSc3/petsc/gcc/bin/mpicc -show
>>> /Users/knepley/MacSoftware/bin/ccache /usr/local/gcc-9.1/bin/gcc-9.1
>>> -fstack-protector -g3 -Wl,-flat_namespace -Wl,-commons,use_dy
>>> libs -I/PETSc3/petsc/gcc/include -L/PETSc3/petsc/gcc/lib -lmpi -lpmpi
>>> master *$:/PETSc3/petsc/petsc-dev$ /usr/local/gcc-9.1/bin/gcc-9.1
>>> --version
>>> gcc-9.1 (GCC) 9.1.0
>>> Copyright (C) 2019 Free Software Foundation, Inc.
>>>
>>> This is free software; see the source for copying conditions.  There is
>>> NO
>>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
>>> PURPOSE.
>>>
>>>
>> Maybe this is a regression in GCC 9.2 ? The thing is that the behavior
>> seems consistent with the documentation.
>>
>> $ gcc --version
>> gcc (GCC) 9.2.1 20190827 (Red Hat 9.2.1-1)
>> Copyright (C) 2019 Free Software Foundation, Inc.
>> This is free software; see the source for copying conditions.  There is NO
>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
>> PURPOSE.
>>
>
> That is why I wondered. Could they have changed this between 9.1 and 9.2?
> It seems like a large change.
>

I checked my documentation. It says the same thing as yours. Now I am more
confused and my hatred of compilers is renewed.

   Matt


>    Matt
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
> https://www.cse.buffalo.edu/~knepley/
> <http://www.cse.buffalo.edu/~knepley/>
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20200120/a90e30ef/attachment.html>


More information about the petsc-dev mailing list