Link to home
Start Free TrialLog in
Avatar of demeler
demeler

asked on

Cross compiling

I am trying to setup a cross compiler on a linux based cluster. So far I can get it to compile for a different architecture but it won't link the libraries. Here is what I did:

1. downloaded and compiled binutils for my architecture (./configure --target=sparc-linux)
2. downloaded glibc and glibc-devel RPMs for sparc (2.2.3-16) and extracted them into a seperate directory
3. copied the includes, kernel headers and libraries to /usr/local/sparc-linux
4. Relinked the libraries for their new location
5. downloaded and configured gcc-2.95.3 for my target architecture, and did make LANGUAGES="c"

After this it would compile the GNU hello world test C program, but would fail when linking with this message:

sparc-linux-gcc  -o hello hello.o version.o getopt.o getopt1.o  -L/usr/local/sparc-linux/lib/
/lib/libc.so.6: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [hello] Error 1

Thank you in advance.

Avatar of ahoffmann
ahoffmann
Flag of Germany image

gcc call ld for linking, so you need a cross-linker too
Avatar of demeler
demeler

ASKER

And how would I do that?
You should note that your linker tried to reference library in /lib, not in /usr/local/sparc-linux. Did you try to modify your LIBPATH? Also, can you specify which platform you're compiling on? You compiling on linux for sparc???
ASKER CERTIFIED SOLUTION
Avatar of ahoffmann
ahoffmann
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
demeler:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.