Il giorno lun 1 lug 2024 alle ore 16:43 meator <[email protected]> ha scritto:
> Thank you for your reply! > > On 7/1/24 4:14 PM, Barry Smith wrote: > > We have had well over a decade of debates on this issue. I would > like to see a CFLAGS+=extra_flags option but that has been resisted. > Instead Satish can tell you how to get what you want. > > This is unfortunate. I assume that patching the buildsystem or some > other trickery will be necessary if what you're saying is true. > > I admit it is not so standard, but Satish always opposed this. No need to hack the buildsystem, just use COPTFLAGS, CXXOPTFLAGS and FOPTFLAGS > >> Is there a way to fix the pkg-config file (apart from manually removing > cflags_extra, cxxflags_extra, and fflags_extra from the .pc file)? > > > > These are there so people can see EXACTLY what flags were used when > PETSc was compiled. They are not intended for people using pkg-config to > use PETSc when building their package. What is the harm in having these > extra flags in the pkgconfig file? > I don't think you should use Makefile.user. That is there as a sort of template/placeholder. The extra variables are not included in a standard usage of pkgconfig, so I don't think this issue is "severe" $ pkg-config --cflags PETSc.pc # standard usage -I/Users/szampini/Devel/petsc/arch-debug/include -I/Users/szampini/Devel/petsc/include $ pkg-config --variable=cflags_extra PETSc.pc # non standard -fPIC -Wall -Wwrite-strings -Wno-unknown-pragmas -fstack-protector -fno-stack-check -Qunused-arguments -fvisibility=hidden -g3 -O0 > Here is an excerpt from /usr/share/petsc/Makefile.user (this is a > template Makefile supplied with PETSc for use in custom projects): > > > # Additional libraries that support pkg-config can be added to the > list of PACKAGES below. > > PACKAGES := $(petsc.pc) > > > > CC := $(shell pkg-config --variable=ccompiler $(PACKAGES)) > > CXX := $(shell pkg-config --variable=cxxcompiler $(PACKAGES)) > > FC := $(shell pkg-config --variable=fcompiler $(PACKAGES)) > > CFLAGS_OTHER := $(shell pkg-config --cflags-only-other $(PACKAGES)) > > CFLAGS := $(shell pkg-config --variable=cflags_extra $(PACKAGES)) > $(CFLAGS_OTHER) > > CXXFLAGS := $(shell pkg-config --variable=cxxflags_extra $(PACKAGES)) > $(CFLAGS_OTHER) > > FFLAGS := $(shell pkg-config --variable=fflags_extra $(PACKAGES)) > > CPPFLAGS := $(shell pkg-config --cflags-only-I $(PACKAGES)) > > LDFLAGS := $(shell pkg-config --libs-only-L --libs-only-other > $(PACKAGES)) > > LDFLAGS += $(patsubst -L%, $(shell pkg-config --variable=ldflag_rpath > $(PACKAGES))%, $(shell pkg-config --libs-only-L $(PACKAGES))) > > LDLIBS := $(shell pkg-config --libs-only-l $(PACKAGES)) -lm > > CUDAC := $(shell pkg-config --variable=cudacompiler $(PACKAGES)) > > CUDAC_FLAGS := $(shell pkg-config --variable=cudaflags_extra > $(PACKAGES)) > > CUDA_LIB := $(shell pkg-config --variable=cudalib $(PACKAGES)) > > CUDA_INCLUDE := $(shell pkg-config --variable=cudainclude $(PACKAGES)) > > CFLAGS of user projects get initialized to cflags_extra for people who > use the official recommended Makefile template. This is not tolerable > because the flags used for building PETSc may be incompatible with > unrelated projects that depend on PETSc. The build environment of the > user program may be very different from the one used to build PETSc > itself. Users trying to build their custom programs depending on PETSc > will likely not want flags that were used to build PETSc in a fake > destdir in chrooted system while building the PETSc package. > -- Stefano
