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

Jed Brown jed at jedbrown.org
Wed May 29 13:59:35 CDT 2019


Lisandro Dalcin <dalcinl at gmail.com> writes:

> On Tue, 28 May 2019 at 22:05, Jed Brown <jed at jedbrown.org> wrote:
>
>>
>> Note that all of these compilers (including Sun C, which doesn't define
>> the macro) recognize -fPIC.  (Blue Gene xlc requires -qpic.)  Do we
>> still need to test the other alternatives?
>>
>>
> Well, worst case, if the configure test always fails with and without all
> the possible variants of  the PIC flag (-fPIC, -kPIC, -qpic, etc.) because
> they do not define the __PIC__ macro, then you are free to abort configure
> and ask users to pass the pic flag in CFLAGS and remove --with-pic=1 from
> the configure line, as we do today for all compilers.

Yeah, this would also need to apply to shared libraries, where need for
PIC is implied and we should proceed to confirm that linking works
(i.e., the old test) using user-provided CFLAGS.

> BTW, my trick seems to works with the Cray compiler.
>
> $ cc
> CC-2107 craycc: ERROR in command line
>   No valid filenames are specified on the command line.
>
> $ cc -c check-pic.c -fPIC
>
> $ cc -c check-pic.c
> CC-35 craycc: ERROR File = check-pic.c, Line = 2
>   #error directive: "no-PIC"
>   #error "no-PIC"
>    ^
>
>
> -- 
> Lisandro Dalcin
> ============
> Research Scientist
> Extreme Computing Research Center (ECRC)
> King Abdullah University of Science and Technology (KAUST)
> http://ecrc.kaust.edu.sa/


More information about the petsc-users mailing list