<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 10, 2021 at 12:05 PM Barry Smith <<a href="mailto:bsmith@petsc.dev">bsmith@petsc.dev</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"><div style="overflow-wrap: break-word;"><div> Fande,</div><div><br></div><div> Please add in config/BuildSystem/config/framework.py line 528 two new lines</div><div><br></div><div><div> # pgi dumps filename on stderr - but returns 0 errorcode'</div><div> lines = [s for s in lines if lines != 'conftest.c:']</div></div><div> # in case -pie is always being passed to linker</div><div> lines = [s for s in lines if s.find('-pie being ignored. It is only used when linking a main executable') < 0]</div><div><br></div><div> Barry</div><div><br></div><div> You have (another of Conda's "take over the world my way" approach)</div><div><br></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><div><br></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></div><div>ld: warning: -pie being ignored. It is only used when linking a main executable</div><div><br></div><div>This is the correct link command for the Mac but it is being rejected due to the warning message.</div></div></div></blockquote><div><br></div><div>Could we somehow skip warning messages? <br><br><br><br></div><div>Fande<br></div><div> </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;"><div><div><br></div><div><br></div><blockquote type="cite"><div>On Mar 10, 2021, at 10:11 AM, Fande Kong <<a href="mailto:fdkong.jd@gmail.com" target="_blank">fdkong.jd@gmail.com</a>> wrote:</div><br><div><div dir="ltr"><div><div><div>Thanks, Barry,<br><br></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><br></div>We still need to make it work with conda because we deliver our package via conda for users.<br><br><br></div><div>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></div><div><br></div><div>Thanks,</div><div><br></div><div>Fande<br></div><br>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>Successful compile:<br>Source:<br>#include "confdefs.h"<br>#include "conffix.h"<br>#include <stdio.h><br>int (*fprintf_ptr)(FILE*,const char*,...) = fprintf;<br>void foo(void){<br> fprintf_ptr(stdout,"hello");<br> return;<br>}<br>void bar(void){foo();}<br>Running Executable WITHOUT threads to time it out<br>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>Possible ERROR while running linker: exit code 1<br>stderr:<br>Undefined symbols for architecture x86_64:<br> "_main", referenced from:<br> implicit entry/start for main executable<br>ld: symbol(s) not found for architecture x86_64<br>clang-11: error: linker command failed with exit code 1 (use -v to see invocation)<br> Rejected C compiler flag -fPIC because it was not compatible with shared linker mpicc using flags ['-dynamic']<div><br></div></div><br><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" target="_blank">bsmith@petsc.dev</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"><div><div><br></div> Fande,<div><br></div><div> 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><br></div><div> Can you trying the same build without CONDA environment? </div><div><br></div><div> Barry</div><div><br><div><br><blockquote type="cite"><div>On Mar 8, 2021, at 7:31 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:</div><br><div><div dir="ltr"><div dir="ltr">On Mon, Mar 8, 2021 at 8:23 PM Fande Kong <<a href="mailto:fdkong.jd@gmail.com" target="_blank">fdkong.jd@gmail.com</a>> wrote:<br></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"><div><div>Thanks Matthew,<br><br></div>Hmm, we still have the same issue after shutting off all unknown flags.<br></div></div></blockquote><div><br></div><div>Oh, I was misinterpreting the error message:</div><div><br></div><div> ld: can't link with a main executable file '/var/folders/tv/ljnkj46x3nq45cp9tbkc000c0000gn/T/petsc-6v1w4q4u/config.setCompilers/libconftest.dylib'<br></div><div><br></div><div>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><br></div><div>Satish, do we test with clang-11?</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div><br></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"><div></div><div>Thanks,</div><div><br></div><div>Fande<br></div></div><br><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">knepley@gmail.com</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"><div dir="ltr"><div dir="ltr">On Mon, Mar 8, 2021 at 7:55 PM Fande Kong <<a href="mailto:fdkong.jd@gmail.com" target="_blank">fdkong.jd@gmail.com</a>> wrote:<br></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"><div><div>Hi All,<br><br></div>mpicc rejected "-fPIC". Anyone has a clue how to work around this issue?<br></div></div></blockquote><div><br></div><div>The failure is at the last step</div><div><br></div><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"><span style="font-variant-ligatures:no-common-ligatures">Executing: mpicc<span> </span>-o /var/folders/tv/ljnkj46x3nq45cp9tbkc000c0000gn/T/petsc-6v1w4q4u/config.setCompilers/conftest<span> </span>-fPIC /var/folders/tv/ljnkj46x3nq45cp9tbkc000c0000gn/T/petsc-6v1w4q4u/config.setCompilers/conftest.o<span> </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"><span style="font-variant-ligatures:no-common-ligatures">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"><span style="font-variant-ligatures:no-common-ligatures">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"><span style="font-variant-ligatures:no-common-ligatures">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"><span style="font-variant-ligatures:no-common-ligatures">clang-11: error: linker command failed with exit code 1 (use -v to see invocation)</span></div></div><div><br></div><div>but you have some flags stuck in which may or may not affect this. I would try shutting them off:</div><div><br></div><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"><span style="font-variant-ligatures:no-common-ligatures">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><br></div><div>I cannot tell exactly why clang is failing because it does not report a specific error.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div><br></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"><div></div><div>The log was attached.<br></div><div><br></div><div>Thanks so much,</div><div><br></div><div>Fande<br></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>
</div></blockquote></div><br></div></div></blockquote></div>
<span id="gmail-m_5020833133178305099cid:f_km3n35ra0"><configure.log></span></div></blockquote></div><br></div></blockquote></div></div>