[petsc-users] How do I supply the compiler PIC flag via CFLAGS, CXXXFLAGS, and FCFLAGS

Jed Brown jed at jedbrown.org
Tue May 28 10:19:29 CDT 2019


Lisandro Dalcin via petsc-users <petsc-users at mcs.anl.gov> writes:

> On Tue, 28 May 2019 at 17:31, Balay, Satish via petsc-users <
> petsc-users at mcs.anl.gov> wrote:
>
>> Configure.log shows '--with-pic=1' - hence this error.
>>
>> Remove '--with-pic=1' and retry.
>>
>>
> Nonsense. Why this behavior? Building a static library with PIC code is a
> perfectly valid use case.

And that's what will happen because Inge passed -fPIC in CFLAGS et al.

Do you know how we could confirm that PIC code is generated without
attempting to use shared libraries?

    if self.argDB['with-pic'] and not useSharedLibraries:
      # this is a flaw in configure; it is a legitimate use case where PETSc is built with PIC flags but not shared libraries
      # to fix it the capability to build shared libraries must be enabled in configure if --with-pic=true even if shared libraries are off and this
      # test must use that capability instead of using the default shared library build in that case which is static libraries
      raise RuntimeError("Cannot determine compiler PIC flags if shared libraries is turned off\nEither run using --with-shared-libraries or --with-pic=0 and supply the compiler PIC flag via CFLAGS, CXXXFLAGS, and FCFLAGS\n")


More information about the petsc-users mailing list