[Tinyos-help] BUG: tinyos-2 libtoscomm.so needs -fPIC flag (w/patch)

Daniel Goertzen daniel.goertzen at norscan.com
Wed Jan 10 07:07:25 PST 2007


Using -fpic instead of -fPIC does seem to work for me.  I used -fPIC because
that is what gcc suggested (see gcc output below).

Regards,
Dan. 


g++ -O2 -shared "-I/opt/sun-jdk-1.5.0.08/include"
"-I/opt/sun-jdk-1.5.0.08/include/linux" \
          -o libtoscomm.so NativeSerial_linux.cpp
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/../../../../x86_64-pc-linux-gnu/bin/l
d: /tmp/ccLkTNMT.o: relocation R_X86_64_32 against `a local symbol' can not
be used when making a shared object; recompile with -fPIC
/tmp/ccLkTNMT.o: could not read symbols: Bad value
collect2: ld returned 1 exit status





-----Original Message-----
From: David Gay [mailto:dgay42 at gmail.com] 
Sent: Tuesday, January 09, 2007 5:48 PM
To: Daniel Goertzen
Cc: tinyos-help at millennium.berkeley.edu
Subject: Re: [Tinyos-help] BUG: tinyos-2 libtoscomm.so needs -fPIC flag
(w/patch)

On 1/9/07, Daniel Goertzen <daniel.goertzen at norscan.com> wrote:
> libtoscomm.so is a shared library but is not built with the -fPIC 
> flag.  I assume that some systems are forgiving of this, but gentoo 
> x86_64 with
> gcc-4.1.1 is not.

Added. Given that a quick google (and gcc documentation perusal) doesn't
answer this question, maybe you know the answer:
- the current env JNI lib uses -fpic
- you suggested -fPIC for the serial one

Do both work? Only -fPIC? Etc, etc, expand at will ;-)

David Gay



More information about the Tinyos-help mailing list