Some people don't want RPATH.  It was discussed here.

https://mid.mail-archive.com/CAEymZafiQtwKDxh0myQ1LD_uByGKv5JyQ9PGzK3ZTmFPcOR=k...@mail.gmail.com

The RPATH flag is stored in a variable ldflag_rpath in PETSc.pc so you
can add it to PETSc paths, as done in this sample makefile.

PETSc.pc := $(PETSC_DIR)/$(PETSC_ARCH)/lib/pkgconfig/PETSc.pc

CC := $(shell pkg-config --variable=ccompiler $(PETSc.pc))
CXX := $(shell pkg-config --variable=cxxcompiler $(PETSc.pc))
FC := $(shell pkg-config --variable=fcompiler $(PETSc.pc))
CFLAGS := $(shell pkg-config --variable=cflags_extra $(PETSc.pc)) $(shell 
pkg-config --cflags-only-other $(PETSc.pc))
FFLAGS := $(shell pkg-config --variable=fflags_extra $(PETSc.pc))
CPPFLAGS := $(shell pkg-config --cflags-only-I $(PETSc.pc))
LDFLAGS := $(shell pkg-config --libs-only-L --libs-only-other $(PETSc.pc))
LDFLAGS += $(patsubst -L%, $(shell pkg-config --variable=ldflag_rpath 
$(PETSc.pc))%, $(shell pkg-config --libs-only-L $(PETSc.pc)))
LDLIBS := $(shell pkg-config --libs-only-l $(PETSc.pc)) -lm

print:
        @echo CC=$(CC)
        @echo CFLAGS=$(CFLAGS)
        @echo CPPFLAGS=$(CPPFLAGS)
        @echo LDFLAGS=$(LDFLAGS)
        @echo LDLIBS=$(LDLIBS)

Franck Houssen <[email protected]> writes:

> I believe -rpath is missing in PETSc.pc: is this intented ? Or forgotten ? If 
> so, can someone add this to the PETSc.pc and push that in master/maint ? 
> As PETSc is a lib to be used from user-defined applications, rpath is really 
> critical !.. 
>
> Franck 
>
>>> grep "Libs:" petsc/local/lib/pkgconfig/PETSc.pc 
>>> slepc/local/lib/pkgconfig/SLEPc.pc 
> petsc/local/lib/pkgconfig/PETSc.pc:16:Libs: -L${libdir} -lpetsc 
> slepc/local/lib/pkgconfig/SLEPc.pc:11:Libs: -Wl,-rpath,${libdir} -L${libdir} 
> -lslepc 

Reply via email to