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

Lisandro Dalcin dalcinl at gmail.com
Wed May 29 04:02:05 CDT 2019


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.

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/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190529/63d8b55f/attachment.html>


More information about the petsc-users mailing list