<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""> Fande,</div><div class=""><br class=""></div><div class="">   Please add in config/BuildSystem/config/framework.py line 528 two new lines</div><div class=""><br class=""></div><div class=""><div class="">      # pgi dumps filename on stderr - but returns 0 errorcode'</div><div class="">      lines = [s for s in lines if lines != 'conftest.c:']</div></div><div class="">      # in case -pie is always being passed to linker</div><div class="">      lines = [s for s in lines if s.find('-pie being ignored. It is only used when linking a main executable') < 0]</div><div class=""><br class=""></div><div class="">   Barry</div><div class=""><br class=""></div><div class="">   You have (another of Conda's "take over the world my way" approach)</div><div class=""><br class=""></div>   LDFLAGS_LD=-pie -headerpad_max_install_names -dead_strip_dylibs -rpath /Users/kongf/miniconda3/envs/testpetsc/lib -L/Users/kongf/miniconda3/envs/testpetsc/lib<br class=""><div><br class=""></div><div><div>Executing: mpicc  -o /var/folders/tv/ljnkj46x3nq45cp9tbkc000c0000gn/T/petsc-pkset22y/config.setCompilers/conftest  -dynamiclib -single_module   /var/folders/tv/ljnkj46x3nq45cp9tbkc000c0000gn/T/petsc-pkset22y/config.setCompilers/conftest.o </div><div>Possible ERROR while running linker:</div><div>stderr:</div><div>ld: warning: -pie being ignored. It is only used when linking a main executable</div><div>            Rejecting C linker flag -dynamiclib -single_module due to </div><div><br class=""></div><div>ld: warning: -pie being ignored. It is only used when linking a main executable</div><div class=""><br class=""></div><div class="">This is the correct link command for the Mac but it is being rejected due to the warning message.</div><div class=""><br class=""></div><div class=""><br class=""></div><blockquote type="cite" class=""><div class="">On Mar 10, 2021, at 10:11 AM, Fande Kong <<a href="mailto:fdkong.jd@gmail.com" class="">fdkong.jd@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><div class=""><div class="">Thanks, Barry,<br class=""><br class=""></div>It seems PETSc works fine with manually built compilers. We are pretty much sure that the issue is related to conda. Conda might introduce extra flags.<br class=""><br class=""></div>We still need to make it work with conda because we deliver our package via conda for users.<br class=""><br class=""><br class=""></div><div class="">I unset all flags from conda, and got slightly different results this time.  The log was attached. Anyone could  explain the motivation that we try to build executable without a main function? <br class=""></div><div class=""><br class=""></div><div class="">Thanks,</div><div class=""><br class=""></div><div class="">Fande<br class=""></div><br class="">Executing: mpicc -c -o /var/folders/tv/ljnkj46x3nq45cp9tbkc000c0000gn/T/petsc-pkset22y/config.setCompilers/conftest.o -I/var/folders/tv/ljnkj46x3nq45cp9tbkc000c0000gn/T/petsc-pkset22y/config.setCompilers  -fPIC  /var/folders/tv/ljnkj46x3nq45cp9tbkc000c0000gn/T/petsc-pkset22y/config.setCompilers/conftest.c <br class="">Successful compile:<br class="">Source:<br class="">#include "confdefs.h"<br class="">#include "conffix.h"<br class="">#include <stdio.h><br class="">int (*fprintf_ptr)(FILE*,const char*,...) = fprintf;<br class="">void  foo(void){<br class="">  fprintf_ptr(stdout,"hello");<br class="">  return;<br class="">}<br class="">void bar(void){foo();}<br class="">Running Executable WITHOUT threads to time it out<br class="">Executing: mpicc  -o /var/folders/tv/ljnkj46x3nq45cp9tbkc000c0000gn/T/petsc-pkset22y/config.setCompilers/libconftest.so  -dynamic  -fPIC /var/folders/tv/ljnkj46x3nq45cp9tbkc000c0000gn/T/petsc-pkset22y/config.setCompilers/conftest.o <br class="">Possible ERROR while running linker: exit code 1<br class="">stderr:<br class="">Undefined symbols for architecture x86_64:<br class="">  "_main", referenced from:<br class="">     implicit entry/start for main executable<br class="">ld: symbol(s) not found for architecture x86_64<br class="">clang-11: error: linker command failed with exit code 1 (use -v to see invocation)<br class="">          Rejected C compiler flag -fPIC because it was not compatible with shared linker mpicc using flags ['-dynamic']<div class=""><br class=""></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 8, 2021 at 7:28 PM Barry Smith <<a href="mailto:bsmith@petsc.dev" class="">bsmith@petsc.dev</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;" class=""><div class=""><br class=""></div>  Fande,<div class=""><br class=""></div><div class="">     I see you are using CONDA, this can cause issues since it sticks all kinds of things into the environment. PETSc tries to remove some of them but perhaps not enough. If you run printenv you will see all the mess it is dumping in. </div><div class=""><br class=""></div><div class="">    Can you trying the same build without CONDA environment? </div><div class=""><br class=""></div><div class="">  Barry</div><div class=""><br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Mar 8, 2021, at 7:31 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank" class="">knepley@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class=""><div dir="ltr" class="">On Mon, Mar 8, 2021 at 8:23 PM Fande Kong <<a href="mailto:fdkong.jd@gmail.com" target="_blank" class="">fdkong.jd@gmail.com</a>> wrote:<br class=""></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class=""><div class=""><div class="">Thanks Matthew,<br class=""><br class=""></div>Hmm, we still have the same issue after shutting off all unknown flags.<br class=""></div></div></blockquote><div class=""><br class=""></div><div class="">Oh, I was misinterpreting the error message:</div><div class=""><br class=""></div><div class="">  ld: can't link with a main executable file '/var/folders/tv/ljnkj46x3nq45cp9tbkc000c0000gn/T/petsc-6v1w4q4u/config.setCompilers/libconftest.dylib'<br class=""></div><div class=""><br class=""></div><div class="">So clang did not _actually_ make a shared library, it made an executable. Did clang-11 change the options it uses to build a shared library?</div><div class=""><br class=""></div><div class="">Satish, do we test with clang-11?</div><div class=""><br class=""></div><div class="">  Thanks,</div><div class=""><br class=""></div><div class="">      Matt</div><div class=""><br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class=""><div class=""></div><div class="">Thanks,</div><div class=""><br class=""></div><div class="">Fande<br class=""></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 8, 2021 at 6:07 PM Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank" class="">knepley@gmail.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class=""><div dir="ltr" class="">On Mon, Mar 8, 2021 at 7:55 PM Fande Kong <<a href="mailto:fdkong.jd@gmail.com" target="_blank" class="">fdkong.jd@gmail.com</a>> wrote:<br class=""></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class=""><div class=""><div class="">Hi All,<br class=""><br class=""></div>mpicc rejected "-fPIC". Anyone has a clue how to work around this issue?<br class=""></div></div></blockquote><div class=""><br class=""></div><div class="">The failure is at the last step</div><div class=""><br class=""></div><div class=""><div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">Executing: mpicc<span class="">  </span>-o /var/folders/tv/ljnkj46x3nq45cp9tbkc000c0000gn/T/petsc-6v1w4q4u/config.setCompilers/conftest<span class="">    </span>-fPIC /var/folders/tv/ljnkj46x3nq45cp9tbkc000c0000gn/T/petsc-6v1w4q4u/config.setCompilers/conftest.o<span class="">  </span>-L/var/folders/tv/ljnkj46x3nq45cp9tbkc000c0000gn/T/petsc-6v1w4q4u/config.setCompilers -lconftest</span></div><div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">Possible ERROR while running linker: exit code 1</span></div><div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">stderr:</span></div><div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">ld: can't link with a main executable file '/var/folders/tv/ljnkj46x3nq45cp9tbkc000c0000gn/T/petsc-6v1w4q4u/config.setCompilers/libconftest.dylib' for architecture x86_64</span></div><div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">clang-11: error: linker command failed with exit code 1 (use -v to see invocation)</span></div></div><div class=""><br class=""></div><div class="">but you have some flags stuck in which may or may not affect this. I would try shutting them off:</div><div class=""><br class=""></div><div class=""><div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">LDFLAGS_LD=-pie -headerpad_max_install_names -dead_strip_dylibs -rpath /Users/kongf/miniconda3/envs/moose/lib -L/Users/kongf/miniconda3/envs/moose/lib</span></div></div><div class=""><br class=""></div><div class="">I cannot tell exactly why clang is failing because it does not report a specific error.</div><div class=""><br class=""></div><div class="">  Thanks,</div><div class=""><br class=""></div><div class="">     Matt</div><div class=""><br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class=""><div class=""></div><div class="">The log was attached.<br class=""></div><div class=""><br class=""></div><div class="">Thanks so much,</div><div class=""><br class=""></div><div class="">Fande<br class=""></div></div>
</blockquote></div><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">-- Norbert Wiener</div><div class=""><br class=""></div><div class=""><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank" class="">https://www.cse.buffalo.edu/~knepley/</a><br class=""></div></div></div></div></div></div></div></div>
</blockquote></div>
</blockquote></div><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">-- Norbert Wiener</div><div class=""><br class=""></div><div class=""><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank" class="">https://www.cse.buffalo.edu/~knepley/</a><br class=""></div></div></div></div></div></div></div></div>
</div></blockquote></div><br class=""></div></div></blockquote></div>
<span id="cid:f_km3n35ra0"><configure.log></span></div></blockquote></div><br class=""></body></html>