On Thu, Feb 28, 2013 at 5:24 PM, Hal Finkel <span dir="ltr"><<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">----- Original Message -----<br>
> From: "Jack Poulson" <<a href="mailto:jack.poulson@gmail.com">jack.poulson@gmail.com</a>><br>
> To: "Hal Finkel" <<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>><br>
> Cc: "Jeff Hammond" <<a href="mailto:jhammond@alcf.anl.gov">jhammond@alcf.anl.gov</a>>, <a href="mailto:llvm-bgq-discuss@lists.alcf.anl.gov">llvm-bgq-discuss@lists.alcf.anl.gov</a><br>
</div><div class="im">> Sent: Thursday, February 28, 2013 6:51:08 PM<br>
> Subject: Re: [Llvm-bgq-discuss] Details behind MPI wrapper for bgclang++<br>
><br>
</div><div class="im">> Thanks Hal, that helps clear things up a bit. I guess I should be a<br>
> little more clear about what exactly I'm doing. Since CMake's<br>
> FindMPI module seems to attempt to link to MPICH incorrectly if I<br>
> directly specify the mpic++11, I have to instead manually specify<br>
> its behaviour (and thankfully Jeff took care of this a month or two<br>
> ago). One of my link commands generated by CMake looks like this:<br>
><br>
><br>
><br>
> /home/projects/llvm/bin/bgclang++ -Wall -std=c++11 -O3 -stdlib=libc++<br>
> -L/bgsys/drivers/ppcfloor/comm/gcc/lib<br>
> -L/bgsys/drivers/ppcfloor/comm/sys/lib<br>
> -L/bgsys/drivers/ppcfloor/spi/lib<br>
> CMakeFiles/HypRadon-2d.dir/test/transform/HypRadon-2d.cpp.o -o<br>
> bin/transform/HypRadon-2d -rdynamic libcmake-dummy-lib.a<br>
> -L/soft/libraries/alcf/current/gcc/LAPACK/lib -llapack<br>
> -L/soft/libraries/essl/current/essl/5.1/lib64 -lesslbg<br>
> -L/soft/compilers/ibmcmp-nov2012/xlf/bg/14.1/bglib64 -lxlf90_r<br>
> -L/soft/compilers/ibmcmp-nov2012/xlsmp/bg/3.1/bglib64 -lxlomp_ser<br>
> -L/soft/compilers/ibmcmp-nov2012/xlmass/bg/7.3/bglib64 -lmassv<br>
> -lmass -lxlopt -lxlfmath -lxl -lgfortran -lm -lpthread -ldl<br>
> -Wl,--allow-multiple-definition -lcxxmpich -lmpich -lopa -lmpl -ldl<br>
> -lpami -lSPI -lSPI_cnk -lpthread -lrt -lstdc++<br>
><br>
><br>
> Upon typing this, I noticed that both libc++ and libstdc++ are both<br>
> being used (which I assume is bad).<br>
<br>
</div>Actually, this is okay (although this is not obvious). When you specify -stdlib=libc++ the clang driver automatically rewrites -lstdc++ to some system-specific set of libraries necessary to link with libc++. In our case, this is -lc++ (and -lrt -lpthread -lstdc++ when statically linking). As a result, using -lstdc++ is fine here. You can verify this by passing -v and examining the linking command line.<br>
<br>
I should also note that we have a *special* libc++ install which is partially based on libstdc++ so that we can link statically with PAMI without symbol definition conflicts. Everything *should* work, but I've only done some limited testing.<br>
<br>
So using the command-line above succeeds but produces an executable that crashes?<br><div class="HOEnZb"><div class="h5"><br></div></div></blockquote><div><br></div><div>Hi Hal,</div><div><br></div><div>Thanks, that makes a lot of sense! The executable Backproj-2d in /home/poulson/dist-butterfly/build/clang/bin/transform produced core.{0,6,8,10,11}. Please let me know if you do not have access for some reason, and thank you again for your help.</div>
<div><br></div><div>Jack</div></div>