On Mon, Jan 20, 2020 at 3:06 AM Lisandro Dalcin <dalc...@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. Matt > -- > Lisandro Dalcin > ============ > Research Scientist > Extreme Computing Research Center (ECRC) > King Abdullah University of Science and Technology (KAUST) > http://ecrc.kaust.edu.sa/ > -- 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/>