<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><div><br>On Wed, Sep 7, 2016 at 3:25 PM, Halim Amer <<a href="mailto:aamer@anl.gov">aamer@anl.gov</a>> wrote:<br>><br>> Regrading missing symbols from dynamic libraries when using gdb on Mac OS, I personally never managed to make it work, not just with MPICH, but also with other libraries. I consistently do static builds to avoid this problem. If you are able to see symbols from other libraries, we might want to look into this as well.<br></div><div><br></div>For what it's worth, I've found that lldb works a lot better on Mac, which is not too surprising, since that is what Apple ships.  I recall that I need to compile with "-Wl,-pie" to get the best debugging experience.<br><br>The commands for LLDB are a bit different from GDB but they are intuitive (<a href="http://lldb.llvm.org/tutorial.html">http://lldb.llvm.org/tutorial.html</a>).<br><br>I'm not sure if it helps, but this is what I observed just now...<br><br>I built my code with these options:<br><br>$ make CC=/opt/mpich/dev/gcc/default/bin/mpicc CFLAGS="-g -O2 -Wall -Wl,-pie"<br><br>MPICH is included as a shared library:<br><br>$ otool -L win_fence.x<br>win_fence.x:<br>/opt/mpich/dev/gcc/default/lib/libmpi.0.dylib (compatibility version 1.0.0, current version 1.0.0)<br>/opt/mpich/dev/gcc/default/lib/libpmpi.0.dylib (compatibility version 1.0.0, current version 1.0.0)<br>/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)<br>/usr/local/lib/gcc/6/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)<br><br>MPICH is built with GCC 6.1.0 with standard options (and debug symbols):<br><br>$ /opt/mpich/dev/gcc/default/bin/mpicc -show<br>gcc-6 -g -Wl,-flat_namespace -Wl,-commons,use_dylibs -I/opt/mpich/dev/gcc/default/include -L/opt/mpich/dev/gcc/default/lib -lmpi -lpmpi<br><br>$ /opt/mpich/dev/gcc/default/bin/mpichversion<br>MPICH Version:    3.3a1<br>MPICH Release date: unreleased development copy<br>MPICH Device:    ch3:nemesis<br>MPICH configure: CC=gcc-6 CXX=g++-6 FC=gfortran-6 F77=gfortran-6 --enable-cxx --enable-fortran --enable-threads=runtime --enable-g=dbg --with-pm=hydra --prefix=/opt/mpich/dev/gcc/default --enable-wrapper-rpath --disable-static --enable-shared<br>MPICH CC: gcc-6    -g -O2<br>MPICH CXX: g++-6   -g<br>MPICH F77: gfortran-6   -g<br>MPICH FC: gfortran-6   -g<br>MPICH Custom Information:<br><br>The following shows the debug symbols including line numbers into MPICH source:<br><br>$ lldb ./win_fence.x<br>(lldb) target create "./win_fence.x"<br>Current executable set to './win_fence.x' (x86_64).<br>(lldb) breakpoint set -n MPIR_Barrier_impl<br>Breakpoint 1: where = libpmpi.0.dylib`MPIR_Barrier_impl + 1 at barrier.c:306, address = 0x000000000000af71<br>(lldb) run<br>Process 87575 launched: './win_fence.x' (x86_64)<br>SUCCESS!<br>Process 87575 stopped<br>* thread #1: tid = 0x2c927c, 0x0000000100144f71 libpmpi.0.dylib`MPIR_Barrier_impl(comm_ptr=0x0000000100391c60, errflag=0x00007fff5fbfef5c) + 1 at barrier.c:306, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1<br>    frame #0: 0x0000000100144f71 libpmpi.0.dylib`MPIR_Barrier_impl(comm_ptr=0x0000000100391c60, errflag=0x00007fff5fbfef5c) + 1 at barrier.c:306<br>   303 int MPIR_Barrier_impl(MPIR_Comm *comm_ptr, MPIR_Errflag_t *errflag)<br>   304 {<br>   305     int mpi_errno = MPI_SUCCESS;<br>-> 306     if (comm_ptr->coll_fns != NULL && comm_ptr->coll_fns->Barrier != NULL)<br>   307     {<br>   308 /* --BEGIN USEREXTENSION-- */<br>   309 mpi_errno = comm_ptr->coll_fns->Barrier(comm_ptr, errflag);<br>(lldb) bt<br>* thread #1: tid = 0x2c927c, 0x0000000100144f71 libpmpi.0.dylib`MPIR_Barrier_impl(comm_ptr=0x0000000100391c60, errflag=0x00007fff5fbfef5c) + 1 at barrier.c:306, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1<br>  * frame #0: 0x0000000100144f71 libpmpi.0.dylib`MPIR_Barrier_impl(comm_ptr=0x0000000100391c60, errflag=0x00007fff5fbfef5c) + 1 at barrier.c:306<br>    frame #1: 0x0000000100276788 libpmpi.0.dylib`MPID_Win_free(win_ptr=0x00007fff5fbfef88) + 328 at mpidi_rma.c:181<br>    frame #2: 0x00000001000655f1 libmpi.0.dylib`MPI_Win_free(win=0x00007fff5fbfeff0) + 513 at win_free.c:119<br>    frame #3: 0x0000000100000e20 win_fence.x`main(argc=<unavailable>, argv=<unavailable>) + 336 at win_fence.c:64<br>    frame #4: 0x00007fff8afd45ad libdyld.dylib`start + 1<br><br>Jeff<br><br><br><br>--<br>Jeff Hammond<br><a href="mailto:jeff.science@gmail.com">jeff.science@gmail.com</a><br><a href="http://jeffhammond.github.io/">http://jeffhammond.github.io/</a></div>