<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    I'm confirming the same type of behavior you are seeing when using
    both the Darshan generated compiler wrapper as well as the MPICH
    profiling hooks. In my MPICH build, I did not set any specific flags
    to enable or disable shared/static libs, so MPICH will prefer
    dynamic libs by default (at least on my laptop).<br>
    <br>
    In the case of using Darshan generated compiler wrappers, they
    actually back out and do not insert any Darshan link flags when
    using dynamic linking, so this is expected behavior.<br>
    <br>
    In the case of the profiling configuration method, the linking is
    again thrown off by the use of dynamic MPICH libs which causes the
    undefined reference errors you are seeing.<br>
    <br>
    As for possible workarounds, you have a couple of options:<br>
    <br>
    1.) Just keep using your current MPICH build, but use the LD_PRELOAD
    method for instrumentation that works with dynamic executables. You
    just need to export LD_PRELOAD to point at your libdarshan.so before
    running your application (which you just compile using MPICH's stock
    mpicc). <br>
    <br>
    2.) As I mentioned in the previous email, you could rebuild MPICH to
    disable shared libs and only build static libs. After that, either
    of the above static linking methods should work.<br>
    <br>
    Thanks,<br>
    --Shane<br>
    <br>
    <div class="moz-cite-prefix">On 10/24/2017 10:06 AM, Shane Snyder
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:8ca3503d-bff0-df5f-2379-b8cf0e61d729@mcs.anl.gov">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      Hi Adnan,<br>
      <br>
      Do you get the same types of errors (undefined reference to
      __wrap_fprintf, etc.) when using the MPI profile configuration
      method (that is, exporting MPICXX_PROFILE)?<br>
      <br>
      Let's troubleshoot that method first since it looks like you are
      getting further along with it. It at least seems to have the link
      line right, at first glance.<br>
      <br>
      FWIW, we typically "encourage" users to configure MPICH libraries
      to be built corresponding to the link method they want to use. So,
      in your case (static linking), it might simplify things to
      configure MPICH to only build its static libraries (using
      '--enable-static --disable-shared' on the configure line). That's
      not to say we can't get the static linking working using default
      configure options, just appears to be more difficult to get right.
      I can try playing around with my local MPICH build and darshan
      builds to see if I can get it working, and will let you know how
      if I do. <br>
      <br>
      Thanks,<br>
      --Shane<br>
      <br>
      <div class="moz-cite-prefix">On 10/18/2017 06:10 PM, Adnan Haider
        wrote:<br>
      </div>
      <blockquote type="cite"
cite="mid:CAM2fH+x1RU7Ka2PAVRK1WARD_2+HDGkuNv+0GeQEOvi49voFtw@mail.gmail.com">
        <div dir="ltr">
          <div>
            <div>
              <div>
                <div>
                  <div>
                    <div>I have been trying the mpicxx
                      -profile=/path/to/mpicxx-cxx.conf option since I
                      have gotten further with this method, but here is
                      the output for both:<br>
                      <br>
                    </div>
                    when using mpicxx.darshan method:<br>
                    <br>
                  </div>
                  g++ -o binary *.o darshan/simple.cc
                  -I/home/adhaider/apps/mpich_install/include
                  -L/home/adhaider/apps/mpich_install/lib -lmpicxx
                  -Wl,-rpath -Wl,/home/adhaider/apps/mpich_install/lib
                  -Wl, --enable-new-dtags -lmpi<br>
                  <br>
                </div>
                * notice the above doesn't even have the darshan libs.<br>
                <br>
              </div>
              Now when using mpicxx -profile=/path/to/conf<br>
              <br>
            </div>
            g++ -o binary *.o darshan/simple.cc
            -I/home/adhaider/apps/mpich_install/include
            -L/home/adhaider/apps/mpich_install/lib -lmpicxx -lmpicxx
            -L/home/adhaider/apps/darshan_install/lib -ldarshan -lz
-Wl,@/home/adhaider/apps/darshan_install/share/ld-opts/darshan-base-ld-opts
            -Wl,-rpath -Wl,/home/adhaider/apps/mpich_install/lib
            -Wl,--enable-new-dtags -lmpi
            -L/home/adhaider/apps/darshan_install/lib -Wl,--start-group
            -ldarshan -ldarshan-stubs -Wl,--end-group -lz -lrt -lpthread<br>
            <br>
          </div>
          Thanks in advance! <br>
        </div>
        <div class="gmail_extra"><br clear="all">
          <div>
            <div class="gmail_signature"
              data-smartmail="gmail_signature">
              <div dir="ltr">
                <div>
                  <div dir="ltr">Thanks, Adnan Haider</div>
                  <div dir="ltr">
                    <div>B.S Candidate, Computer Science</div>
                    <div>Illinois Institute of Technology </div>
                    <div><a href="http://www.adnanhaider.com"
                        target="_blank" moz-do-not-send="true">www.adnanhaider.com</a><br>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <br>
          <div class="gmail_quote">On Wed, Oct 18, 2017 at 6:19 PM,
            Harms, Kevin <span dir="ltr"><<a
                href="mailto:harms@alcf.anl.gov" target="_blank"
                moz-do-not-send="true">harms@alcf.anl.gov</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
                Can you provide the output of the linking stage with the
              generated mpicc. So if you named your mpicc,
              mpicc.darshan:<br>
              <br>
                mpicc.darshan -show -o binary *.o<br>
              <br>
                The previous post you mentioned has some type of error
              in the generated script where one of the compiler
              arguments was not being added properly.<br>
              <br>
              kevin<br>
              ______________________________<wbr>__________<br>
              From: Darshan-users <<a
                href="mailto:darshan-users-bounces@lists.mcs.anl.gov"
                moz-do-not-send="true">darshan-users-bounces@lists.<wbr>mcs.anl.gov</a>>
              on behalf of Adnan Haider <<a
                href="mailto:ahaider3@hawk.iit.edu"
                moz-do-not-send="true">ahaider3@hawk.iit.edu</a>><br>
              Sent: Wednesday, October 18, 2017 4:28:23 PM<br>
              To: <a href="mailto:darshan-users@lists.mcs.anl.gov"
                moz-do-not-send="true">darshan-users@lists.mcs.anl.<wbr>gov</a><br>
              Subject: [Darshan-users] Darshan undefined compilation
              error<br>
              <div class="HOEnZb">
                <div class="h5"><br>
                  Hi,<br>
                  <br>
                  I am trying to statically instrument my application
                  with darshan. I am using mpich 3.2 and darshan 3.1.4.
                  I have also tried 3.1.3 and 3.0.0 all which give the
                  same errors as this post:  <a
href="https://lists.mcs.anl.gov/mailman/htdig/darshan-users/2017-July/000448.html"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">https://lists.mcs.anl.gov/<wbr>mailman/htdig/darshan-users/<wbr>2017-July/000448.html</a><br>
                  <br>
                  Maybe I am not compiling mpich with the correct flags?
                  ( I am not changing the defaults).<br>
                  <br>
                  I get these errors for the example IO_simple.c as well
                  as a very simple piece of MPI code.<br>
                  <br>
                  Also nm libdarshan.a does show the functions that are
                  coming up as undefined, same as the post I linked to.<br>
                  <br>
                  Any help would be greatly appreciated.<br>
                  <br>
                </div>
              </div>
            </blockquote>
          </div>
          <br>
        </div>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <br>
        <pre wrap="">_______________________________________________
Darshan-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Darshan-users@lists.mcs.anl.gov" moz-do-not-send="true">Darshan-users@lists.mcs.anl.gov</a>
<a class="moz-txt-link-freetext" href="https://lists.mcs.anl.gov/mailman/listinfo/darshan-users" moz-do-not-send="true">https://lists.mcs.anl.gov/mailman/listinfo/darshan-users</a>
</pre>
      </blockquote>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Darshan-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Darshan-users@lists.mcs.anl.gov">Darshan-users@lists.mcs.anl.gov</a>
<a class="moz-txt-link-freetext" href="https://lists.mcs.anl.gov/mailman/listinfo/darshan-users">https://lists.mcs.anl.gov/mailman/listinfo/darshan-users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>