[parsec-users] Compiling blackscholes-tbb with -static

Vivek Rane vrane at seas.upenn.edu
Mon Apr 19 18:46:06 EDT 2010


Date: Fri, 16 Apr 2010 17:25:34 -0400
From: Vivek Rane <vrane at seas.upenn.edu>
To: parsec-users at lists.cs.princeton.edu
Reply-To: PARSEC Users <parsec-users at lists.cs.princeton.edu>
Subject: [parsec-users] Compiling blackscholes-tbb with -static

Since our simulator in its current state only accepts static binaries,  
I'm trying to compile blackscholes-tbb statically  
(blackscholes-pthreads compiles successfully, but we're trying to  
study the behavior of tbb). I get the following error:

g++  -fPIC -o libtbbmalloc_debug.so.2 tbbmalloc.o  tbb_misc_malloc.o  
MemoryAllocator.o  -ldl -lpthread -lrt  -shared  
-Wl,-soname=libtbbmalloc_debug.so.2 -m64 -L/usr/lib64 -L/usr/lib  
-lpthread -static  
-L/mnt/eclipse/acg/projects/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.gcc-tbb/lib -fPIC -fPIC  
-Wl,--version-script,tbbmalloc.def
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld:  
/usr/lib64/gcc/x86_64-suse-linux/4.3/crtbeginT.o: relocation  
R_X86_64_32 against `__DTOR_END__' can not be used when making a  
shared object; recompile with -fPIC
/usr/lib64/gcc/x86_64-suse-linux/4.3/crtbeginT.o: could not read  
symbols: Bad value
collect2: ld returned 1 exit status

Since I'm already using -fPIC for the compilation, does this mean that  
I need to recompile crtbeginT.o with -fPIC? In that case, is there a  
workaround (I do not have permissions to crtbeginT.o)?

Thanks for your help.

-- 
- Vivek

---------------------------------------------------------------------------------------
Date: Fri, 16 Apr 2010 17:51:00 -0400
From: Christian Bienia <cbienia at CS.Princeton.EDU>
To: 'PARSEC Users' <parsec-users at lists.cs.princeton.edu>
Reply-To: PARSEC Users <parsec-users at lists.cs.princeton.edu>
Subject: Re: [parsec-users] Compiling blackscholes-tbb with -static
	3.2.1 	unnamed 	2.02 KB
Vivek,

It's surprisingly difficult to convince gcc to create static binaries. I had
to compile my own version of gcc with shared libraries completely disabled.
You might also have to make the shared versions of some libraries
unavailable. Then rebuild everything and gcc will have no choice other than
creating a static version.

Best,
Chris

---------------------------------------------------------------------------------------

Chris,

When I switch the -shared flag to -static, I actually get the warning:
src/tbb/tbb_misc.cpp:128: warning: Using 'dlopen' in statically linked  
applications requires at runtime the shared libraries from the glibc  
version used for linking

Followed by "undefined reference to `main'". How did you get around  
those issues when building statically?

On a different note, we only need a static linux build of blackscholes  
for a class project. If you have such a version built already, would  
it be possible to share it with us?

Thanks for your time,
Vivek


More information about the parsec-users mailing list