Compilation problems on Ubuntu 64-bit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

(I'm posting this one again, because I think I might have been confusing when asking people to ignore my issue - which was for a different problem.)


I'm trying to create a shared object file calling GCC using execvp, but am getting some errors.

I'm forking, setting the env PATH and calling execvp (bin, argv); (twice) where bin is a char* to "gcc" and argv in each case is a pointer to a null-terminated array of char*'s - the options - given below.


First - .o creation, using the following options:

---------------------
-fPIC
-o
/tmp/simpl-so/objs/10.o
-I
/simpl/dev/src
-I
/simpl/dev/src/core
-I
/simpl/dev/src/include
-c
/t/bufout.c
-------------------------

This seems to go ok, then calling with the following options:
-------------------------
-v
-shared
-o
/tmp/simpl-so/objs/10.so
/tmp/simpl-so/objs/10.o
-lsimpl
--------------------------
produces:
============
/usr/bin/ld: /tmp/simpl-so/objs/10.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/tmp/simpl-so/objs/10.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
============
whilst
---------------------------
-fPIC
-v
-shared
-o
/tmp/simpl-so/objs/10.so
/tmp/simpl-so/objs/10.o
-lsimpl
-----------------------------
produces:
============

Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.3-5ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4)
COMPILER_PATH=../lib/gcc/x86_64-linux-gnu/4.3.3/:../lib/gcc/:/usr/lib/gcc/x86_64-linux-gnu/4.3.3/:/usr/lib/gcc/x86_64-linux-gnu/ LIBRARY_PATH=../lib/gcc/x86_64-linux-gnu/4.3.3/:../lib/gcc/:/usr/lib/gcc/x86_64-linux-gnu/4.3.3/:../lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:../lib/gcc/x86_64-linux-gnu/4.3.3/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-v' '-shared' '-o' '/tmp/simpl-so/objs/10.so' '-mtune=generic' ../lib/gcc/x86_64-linux-gnu/4.3.3/collect2 --eh-frame-hdr -m elf_x86_64 --hash-style=both -shared -o /tmp/simpl-so/objs/10.so -z relro ../lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/crti.o ../lib/gcc/x86_64-linux-gnu/4.3.3/crtbeginS.o -L../lib/gcc/x86_64-linux-gnu/4.3.3 -L../lib/gcc -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3 -L../lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L../lib/gcc/x86_64-linux-gnu/4.3.3/../../.. /tmp/simpl-so/objs/10.o -lsimpl -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed ../lib/gcc/x86_64-linux-gnu/4.3.3/crtendS.o ../lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/crtn.o /usr/bin/ld: /tmp/simpl-so/objs/10.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/tmp/simpl-so/objs/10.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
===============

libsimpl is compiled using fPIC too.

I'm using Ubuntu 9.04 64-bit.  It compiled ok on the 32-bit version.

Can anyone give any guidance on how to solve this?

Thanks,

Marcus Clyne.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux