<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 28 May 2019 at 18:19, Jed Brown <<a href="mailto:jed@jedbrown.org">jed@jedbrown.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Lisandro Dalcin via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> writes:<br>
<br>
> On Tue, 28 May 2019 at 17:31, Balay, Satish via petsc-users <<br>
> <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br>
><br>
>> Configure.log shows '--with-pic=1' - hence this error.<br>
>><br>
>> Remove '--with-pic=1' and retry.<br>
>><br>
>><br>
> Nonsense. Why this behavior? Building a static library with PIC code is a<br>
> perfectly valid use case.<br>
<br>
And that's what will happen because Inge passed -fPIC in CFLAGS et al.<br>
<br>
Do you know how we could confirm that PIC code is generated without<br>
attempting to use shared libraries?<br>
<br></blockquote><div><br></div><div>I know how to do it with the `readelf` command for ELF objects. I even know how to do it compile-time for GCC and clang. Maybe Intel also works this way. I do not know about a general solution, though.</div><div><br></div>$ cat check-pic.c <br>#ifndef __PIC__<br>#error "no-PIC"<br><div>#endif</div><div><br></div><div>$ gcc -c check-pic.c -fPIC<br></div><div><br></div><div>$ clang -c check-pic.c -fPIC<br><br></div><div>$ gcc -c check-pic.c<br>check-pic.c:2:2: error: #error "no-PIC"<br> 2 | #error "no-PIC"<br> | ^~~~~<br><br></div><div>$ clang -c check-pic.c<br>check-pic.c:2:2: error: "no-PIC"<br>#error "no-PIC"<br> ^<br>1 error generated.<br></div><div> </div></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Lisandro Dalcin<br>============<br>Research Scientist<br>Extreme Computing Research Center (ECRC)<br>King Abdullah University of Science and Technology (KAUST)<br><a href="http://ecrc.kaust.edu.sa/" target="_blank">http://ecrc.kaust.edu.sa/</a><br></div></div></div></div>