When building the whole valgrind-3.3.0 from sources under x86_64 linux (Red Hat RHEL-3), I get a failure when creating libmpiwrap-AMD64_LINUX.so: ld: /usr/lib/gcc-lib/x86_64-redhat-linux/3.2.3/../../../../lib64/libmpi.a(laminit.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC /usr/lib/gcc-lib/x86_64-redhat-linux/3.2.3/../../../../lib64/libmpi.a: could not read symbols: Bad value Even though I compile with: mpicc -g -O -fno-omit-frame-pointer -Wall -fPIC -shared -m64 \ -I../include \ -o libmpiwrap-AMD64_LINUX.so libmpiwrap.c Maybe I could just disable building in auxprogs? In addition, note that I compile the rest of valgrind with a hand-installed GCC-4.2.2 (ie more recent than the machine's default - 3.3.3), could this cause further problems?
Confirmed, same error on Gentoo. Two differences with the info above: 1) -fpic instead of -fPIC (no idea where that comes from). 2) the reporter has 3.2.3 in the output where the Gentoo user has 4.2.2, which matches his compiler version. See http://bugs.gentoo.org/show_bug.cgi?id=202684
-fpic is hardcoded in Makefile.in Following the error message, I changed it to -fPIC by hand, but it changed nothing.
The problem is not that you need to change valgrind to compile it's code with -fpic or -fPIC but that the system libmpi.a it is trying to link the wrapper against does not contain PIC code so cannot be linked into a shared library. Either install a PIC version of libmpi (most likely a shared version rather than a static one) or configure valgrind not to build the mpi wrapper, which you quite likely don't need anyway.
*** Bug 154274 has been marked as a duplicate of this bug. ***