Toolchain compilation problems

David Summers gmane@summers5913.freeserve.co.uk
Mon May 28 21:40:00 GMT 2012


I'm trying to compile a tool chain to run on an x86-64 machine, but 
produce code for an arm, so options to most things:

--target=armv7-hardfloat-linux-gnueabi --host=x86_64-pc-linux-gnu 
--build=x86_64-pc-linux-gnu

Software that I'm compiling is:

gcc-4.7.0
binutils-2.22
uClibc-0.9.33.2

First pass of all compiles fine, as long as threads and shared are 
disabled in gcc.

Second pass though fails, and can see the problem with this:

# echo 'main(){}' > dummy.c
# /home/arm/bin/armv7-hardfloat-linux-gnueabi-gcc dummy.c
/home/arm/lib/gcc/armv7-hardfloat-linux-gnueabi/4.7.0/../../../../armv7-hardfloat-linux-gnueabi/bin/ld: 
cannot find crt1.o: No such file or directory
/home/arm/lib/gcc/armv7-hardfloat-linux-gnueabi/4.7.0/../../../../armv7-hardfloat-linux-gnueabi/bin/ld: 
cannot find crti.o: No such file or directory
collect2: error: ld returned 1 exit status
# 
/home/arm/lib/gcc/armv7-hardfloat-linux-gnueabi/4.7.0/../../../../armv7-hardfloat-linux-gnueabi/bin/ld 
--verbose | grep SEARCH
SEARCH_DIR("/home/arm/armv7-hardfloat-linux-gnueabi/lib"); 
SEARCH_DIR("/home/arm/lib"); SEARCH_DIR("/home/arm/usr/lib");
# ls /home/arm/usr/lib/crt*.o
/home/arm/usr/lib/crt1.o  /home/arm/usr/lib/crti.o  /home/arm/usr/lib/crtn.o
#/home/arm/bin/armv7-hardfloat-linux-gnueabi-gcc dummy.c 
/home/arm/usr/lib/crt1.o /home/arm/usr/lib/crti.o
/home/arm/lib/gcc/armv7-hardfloat-linux-gnueabi/4.7.0/../../../../armv7-hardfloat-linux-gnueabi/bin/ld: 
cannot find crt1.o: No such file or directory
/home/arm/lib/gcc/armv7-hardfloat-linux-gnueabi/4.7.0/../../../../armv7-hardfloat-linux-gnueabi/bin/ld: 
cannot find crti.o: No such file or directory
collect2: error: ld returned 1 exit status
# readelf -A -h /home/arm/usr/lib/crti.o
ELF Header:
   Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
   Class:                             ELF32
   Data:                              2's complement, little endian
   Version:                           1 (current)
   OS/ABI:                            UNIX - System V
   ABI Version:                       0
   Type:                              REL (Relocatable file)
   Machine:                           ARM
   Version:                           0x1
   Entry point address:               0x0
   Start of program headers:          0 (bytes into file)
   Start of section headers:          256 (bytes into file)
   Flags:                             0x5000000, Version5 EABI
   Size of this header:               52 (bytes)
   Size of program headers:           0 (bytes)
   Number of program headers:         0
   Size of section headers:           40 (bytes)
   Number of section headers:         12
   Section header string table index: 9
Attribute Section: aeabi
File Attributes
   Tag_CPU_name: "7-A"
   Tag_CPU_arch: v7
   Tag_CPU_arch_profile: Application
   Tag_ARM_ISA_use: Yes
   Tag_THUMB_ISA_use: Thumb-2
   Tag_FP_arch: VFPv3-D16
   Tag_DIV_use: Not allowed

So the problem seems to be that the linker isn't working, this was 
compiled via:

../binutils-2.22/configure --target=armv7-hardfloat-linux-gnueabi 
--host=x86_64-linux-gnu --build=x86_64-linux-gnu --prefix=/home/arm 
--with-lib-path=/home/arm/lib:/home/arm/usr/lib --enable-shared 
--disable-nls --with-libliberty

Now I've tried compiling both binutils and gcc with --with-sysroot, but 
this doesn't help.

Anyone any ideas? Is this a gcc problem, a binutils problem, or a uClibc 
problem ? Any ideas how to solve

Thanks in advance,

David.




More information about the Gcc-help mailing list