public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Toolchain compilation problems
@ 2012-05-28 21:40 David Summers
  2012-05-29 12:04 ` David Summers
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: David Summers @ 2012-05-28 21:40 UTC (permalink / raw)
  To: gcc-help

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.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Toolchain compilation problems
  2012-05-28 21:40 Toolchain compilation problems David Summers
@ 2012-05-29 12:04 ` David Summers
  2012-05-30  9:18 ` David Summers
  2012-05-30  9:52 ` Andrew Haley
  2 siblings, 0 replies; 8+ messages in thread
From: David Summers @ 2012-05-29 12:04 UTC (permalink / raw)
  To: gcc-help

Further information, linking by hand works:

> # /home/arm/bin/armv7-hardfloat-linux-gnueabi-gcc -c dummy.c
> # /home/arm/bin/armv7-hardfloat-linux-gnueabi-ld -o a.out dummy.o /home/arm/usr/lib/crt*.o -lc
> # readelf -A a.out
> 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_ABI_PCS_wchar_t: 4
>   Tag_ABI_FP_denormal: Needed
>   Tag_ABI_FP_exceptions: Needed
>   Tag_ABI_FP_number_model: IEEE 754
>   Tag_ABI_align_needed: 8-byte
>   Tag_ABI_enum_size: int
>   Tag_ABI_HardFP_use: SP and DP
>   Tag_ABI_VFP_args: VFP registers
>   Tag_ABI_optimization_goals: Aggressive Debug
>   Tag_CPU_unaligned_access: v6
>   Tag_DIV_use: Not allowed

The problem seems to be that collect2 has problems finding crt*.o ....

Anyone idea what I'm doing wrong.

Thanks,

David.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Toolchain compilation problems
  2012-05-28 21:40 Toolchain compilation problems David Summers
  2012-05-29 12:04 ` David Summers
@ 2012-05-30  9:18 ` David Summers
  2012-08-03 11:04   ` Manmohan Bishnoi
  2012-05-30  9:52 ` Andrew Haley
  2 siblings, 1 reply; 8+ messages in thread
From: David Summers @ 2012-05-30  9:18 UTC (permalink / raw)
  To: gcc-help

OK - solved the problem.

gcc (collect2 I think) doesn't look in /home/arm/usr/lib - despite that 
it is listed in the ld search directories.

So what needs to be done is to copy (or set up a link) from the various 
crt*.o files to the directory:

..../armv7-hardfloat-linux-gnueabi/lib

Or whatever the triplet name of your gcc is, in your top direcory (for 
me /home/arm).

I'm not sure, but may also need these files in:

.../lib/gcc/armv7-hardfloat-linux-gnueabi/4.7.0

That seemed to help some times - but not when compiling gcc itself (e.g. 
the various libs gcc compiles for itself, e.g. under threading and sharing).

So is this gcc doing something wrong, or is it uClibc installing crt*.o 
in the wrong place?

David.

On 28/05/12 22:33, David Summers wrote:
> I'm trying to compile a tool chain to run on an x86-64 machine, but ...
> # 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Toolchain compilation problems
  2012-05-28 21:40 Toolchain compilation problems David Summers
  2012-05-29 12:04 ` David Summers
  2012-05-30  9:18 ` David Summers
@ 2012-05-30  9:52 ` Andrew Haley
  2012-05-30 13:17   ` David Summers
  2 siblings, 1 reply; 8+ messages in thread
From: Andrew Haley @ 2012-05-30  9:52 UTC (permalink / raw)
  To: gcc-help

On 05/28/2012 10:33 PM, David Summers wrote:
> 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

Did you not set up a sysroot?  Or a prefix?

Andrew.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Toolchain compilation problems
  2012-05-30  9:52 ` Andrew Haley
@ 2012-05-30 13:17   ` David Summers
  2012-05-30 13:52     ` Andrew Haley
  0 siblings, 1 reply; 8+ messages in thread
From: David Summers @ 2012-05-30 13:17 UTC (permalink / raw)
  To: gcc-help

Both! AT different times ....

Am current running with a --prefix=/home/arm

I'll probably try switching back to --sysroot=/home/arm when I get the 
chance - as it seems the better way to go ...

Neither though seemed to have any effect on the problem I was having 
(crt*.o files not being found)

On 30/05/12 10:52, Andrew Haley wrote:
> On 05/28/2012 10:33 PM, David Summers wrote:
>> 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
>
> Did you not set up a sysroot?  Or a prefix?
>
> Andrew.
>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Toolchain compilation problems
  2012-05-30 13:17   ` David Summers
@ 2012-05-30 13:52     ` Andrew Haley
  2012-06-01 20:05       ` David Summers
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Haley @ 2012-05-30 13:52 UTC (permalink / raw)
  To: gcc-help

On 05/30/2012 02:17 PM, David Summers wrote:
> Both! AT different times ....
> 
> Am current running with a --prefix=/home/arm
> 
> I'll probably try switching back to --sysroot=/home/arm when I get the 
> chance - as it seems the better way to go ...
> 
> Neither though seemed to have any effect on the problem I was having 
> (crt*.o files not being found)

Well, if you don't tell us the whole truth we're not going to be
able to help you.  For a cross-compiler you'll need both.

What was your configure line?

Andrew.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Toolchain compilation problems
  2012-05-30 13:52     ` Andrew Haley
@ 2012-06-01 20:05       ` David Summers
  0 siblings, 0 replies; 8+ messages in thread
From: David Summers @ 2012-06-01 20:05 UTC (permalink / raw)
  To: gcc-help

Well it was the truth, but not the full story. Some stories just go ever 
on, so at times you cut to the chase. But you want a longer story.

Well if you'll excuse me skipping over things, I'll skip the first pass 
of binutils, gcc, and uClibc. Going straight to the second pass these 
are the non sysroot configures used:

gcc-4.7.0 configure:

../gcc-4.7.0/configure --prefix=/home/arm --with-local-prefix=/home/arm 
--with-native-system-header-dir=/home/arm/usr/include 
--target=armv7-hardfloat-linux-gnueabi --host=x86_64-pc-linux-gnu 
--build=x86_64-pc-linux-gnu --enable-neon --with-arch=armv7-a 
--with-tune=cortex-a9 --with-fpu=vfpv3-d16 --with-float=hard 
--with-abi=aapcs-linux --enable-languages=c --enable-threads 
--enable-tls --enable-shared --disable-libgomp --disable-nls 
--disable-multilib --disable-libmudflap --disable-libssp 
--disable-libgomp --disable-libquadmath --with-headers=/home/arm/usr/include

binutils-2.22:

../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

maybe tweaked ld with

make -C ld clean
make -C ld LIB_PATH=/home/arm/usr/lib:/home/arm/lib

Am just now retrying a sysroot vesrion, with the binutils in the gcc 
directory, so I do both at the same time. With what else I've learn 
think this should now work with sysroot as well - and as having sysroot 
was my preferred option, I'll now see if I can get it to work.

Thanks for your help,

David.

On 30/05/12 14:38, Andrew Haley wrote:
> On 05/30/2012 02:17 PM, David Summers wrote:
>> Both! AT different times ....
>>
>> Am current running with a --prefix=/home/arm
>>
>> I'll probably try switching back to --sysroot=/home/arm when I get the
>> chance - as it seems the better way to go ...
>>
>> Neither though seemed to have any effect on the problem I was having
>> (crt*.o files not being found)
>
> Well, if you don't tell us the whole truth we're not going to be
> able to help you.  For a cross-compiler you'll need both.
>
> What was your configure line?
>
> Andrew.
>
>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Toolchain compilation problems
  2012-05-30  9:18 ` David Summers
@ 2012-08-03 11:04   ` Manmohan Bishnoi
  0 siblings, 0 replies; 8+ messages in thread
From: Manmohan Bishnoi @ 2012-08-03 11:04 UTC (permalink / raw)
  To: gcc-help

David Summers <gmane <at> summers5913.freeserve.co.uk> writes:

> 
> OK - solved the problem.

Hi David,

I am building cross toolchain using binutils 2.22, gcc 4.7.0 and uclibc 0.9.33.2.
can you send me the configure and build parameters which you have used in your
build.

Thanks

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-08-03 11:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-28 21:40 Toolchain compilation problems David Summers
2012-05-29 12:04 ` David Summers
2012-05-30  9:18 ` David Summers
2012-08-03 11:04   ` Manmohan Bishnoi
2012-05-30  9:52 ` Andrew Haley
2012-05-30 13:17   ` David Summers
2012-05-30 13:52     ` Andrew Haley
2012-06-01 20:05       ` David Summers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).