Bug 154240 - Can't build auxprogs/libmpiwrap under AMD64_LINUX
Summary: Can't build auxprogs/libmpiwrap under AMD64_LINUX
Status: RESOLVED NOT A BUG
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 3.3.0
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
: 154274 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-12-17 18:07 UTC by Christophe Lyon
Modified: 2009-06-29 09:05 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe Lyon 2007-12-17 18:07:02 UTC
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?
Comment 1 Maurice van der Pot 2007-12-18 15:52:13 UTC
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
Comment 2 Christophe Lyon 2007-12-18 15:59:41 UTC
-fpic is hardcoded in Makefile.in

Following the error message, I changed it to -fPIC by hand, but it changed nothing.
Comment 3 Tom Hughes 2007-12-18 18:00:04 UTC
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.
Comment 4 Nicholas Nethercote 2009-06-29 09:03:38 UTC
*** Bug 154274 has been marked as a duplicate of this bug. ***