This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
statically linking standard libraries
- From: JJ <alchemistmba at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Fri, 16 Oct 2009 12:22:44 -0700
- Subject: statically linking standard libraries
Hi,
I'm having some issues trying to compile a standalone library.
I first create my object files without linking:
cross-g++ -c -o abc.o -fno-use-cxa-atexit abc.cc
cross-g++ -c -o cppfunc.o -fno-use-cxa-atexit cppfunc.cc
cross-g++ -c -o assemble.o -fno-use-cxa-atexit assemble.cc
I'm unable to link them together. When I run:
cross-ld -T test.ld assemble.o cppfunc.o abc.o -o standalone_program
The linker throws errors:
: undefined reference to `printf'
: undefined reference to `free'
: undefined reference to `strcpy'
..
I'm trying to cross compile the code. I'm compiling on an x86 machine
but the binary has to run on a different architecture. The "cross-g++"
and "cross-ld" binaries compile code for the different architecture.
I want to build a standalone binary. I tried passing a couple of
options to the g++ and ld:
-Bstatic
-L/path to libstdc++.a
but that did not help.
Could someone help me out.
thanks
Jerin