Bug 274078 - improved configure logic for mpicc
Summary: improved configure logic for mpicc
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 3.7 SVN
Platform: Compiled Sources All
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-25 00:51 UTC by Dave Goodell
Modified: 2012-05-17 15:33 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
mpicc detection patch against valgrind@11778 (4.57 KB, patch)
2011-05-25 00:51 UTC, Dave Goodell
Details
rebased against V @r11844 (3.94 KB, patch)
2011-06-28 21:20 UTC, Dave Goodell
Details
rebased against Valgrind @r12230 (3.99 KB, patch)
2011-10-25 18:13 UTC, Dave Goodell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Goodell 2011-05-25 00:51:11 UTC
Created attachment 60289 [details]
mpicc detection patch against valgrind@11778

Version:           3.7 SVN
OS:                All

Attached is a patch that improves the mpicc detection logic used at configure time in Valgrind.  It isn't pretty, but IMO it's no uglier than the existing code and it is a more accurate check.

Without this test error messages to the following effect would be obtained at make-time when the MPI implementation does not support shared libraries (MPICH2's default configuration):

----8<----
/usr/bin/ld: /homes/goodell/fusion/mpich2-installed/lib/libmpich.a(type_get_envelope.o): relocation R_X86_64_32S against `MPID_Datatype_builtin' can not be used when making a shared object; recompile with -fPIC
/homes/goodell/fusion/mpich2-installed/lib/libmpich.a: could not read symbols: Bad value
----8<----

With the attached patch the configure step determines that such a link attempt will not succeed and disabled the MPI wrapper layer (akin to passing "--without-mpicc").

I've tested the patch on Linux/x86_64, Darwin/x86_64, and Darwin/i386.  The Darwin linker doesn't seem to care about linking "-dynamic" code (or creating "-dynamiclib" shared libraries that link) against static libraries.  But it does correctly cover the case where Darwin is being built bi-arch and the MPI library is i386- or x86_64-only.

This code will get every so slightly less ugly once the AIX code is deleted (which I vaguely recall from the 3.7.0 release planning).

The patch also fixes a couple of lines in the MPI test program in order to be a valid MPI program.  It didn't really matter that much, since this code was never run (only linked), but it bugged me and I was already touching that code.

Reproducible: Always
Comment 1 Dave Goodell 2011-06-28 21:20:52 UTC
Created attachment 61426 [details]
rebased against V @r11844

The AIX deletion made this patch slightly cleaner, but it did cause a few rebase conflicts that I had to resolve by hand.  I only quickly retested this version on Darwin.
Comment 2 Dave Goodell 2011-10-25 18:13:58 UTC
Created attachment 64867 [details]
rebased against Valgrind @r12230

updating in order to make it easy to include this fix in the 3.7.0 release
Comment 3 Philippe Waroquiers 2012-05-17 15:33:40 UTC
Committed revision 12567.
Thanks for the patch.