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.
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?
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.
OpenPGP_0x1A14CB3464CBE5BF.asc
Description: OpenPGP public key
OpenPGP_signature.asc
Description: OpenPGP digital signature