This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Strange build error on PPC OS X 10.4


Hello.

On 20080520 23:18:18, Kai Ruottu wrote:
> xorquewasp@googlemail.com wrote:
>
>> I'm encountering a very strange error trying to build GCC 4.2.3 as
>> a cross compiler on OS X 10.4 PPC:
>>
>> make GCC_FOR_TARGET="/dev-share/src/build-gcc/./gcc/xgcc
> > -B/dev-share/src/build-gcc/./gcc/
> > -B/usr/local/gcc-4.2.3-x-i386/i386-apple-darwin/bin/
> > -B/usr/local/gcc-4.2.3-x-i386/i386-apple-darwin/lib/
> > -isystem /usr/local/gcc-4.2.3-x-i386/i386-apple-darwin/include
> > -isystem /usr/local/gcc-4.2.3-x-i386/i386-apple-darwin/sys-include" \
>
> The 4 last options are trying to point to the target binutils,
> including 'as' and 'ld' in 'bin', and to the target C library,
> in 'lib' and '*include'...

Right.

>
>> /dev-share/src/build-gcc/./gcc/as: line 2: exec: i386: not found
>
> In '/usr/local/gcc-4.2.3-x-i386/i386-apple-darwin/bin' you should
> have the bare name 'as' and 'ld' plus some other binutils for the
> Darwin/i386 target. And in '/usr/local/gcc-4.2.3-x-i386/bin' you
> should have those 'i386-apple-darwin-as' and 'i386-apple-darwin-ld'
> and other binutils for the human users, including configure scripts.

Ok. Is the list of needed binutils documented anywhere? It takes around
an hour of compilation so I'd rather prepare everything correctly first
time.

>
>> I'm not sure if I'm supposed to do something before the build of
>> gcc on OS X, but I'm pretty certain that $objdir/gcc/as isn't supposed
>> to look like this:
>>
>> $ cat gcc/as #!/bin/sh
>> exec  "$@"
>>
>> The other temporary 'binutils' look the same:
>>
>> $ cat gcc/nm #!/bin/sh
>> exec  "$@"
>>
>> What could be causing these files to be incorrectly generated?
>
> The obvious reason is that you haven't the target binutils... Where
> are they?  Just as well you should have the Darwin/i386 C libraries
> preinstalled before starting to configure and build GCC !

Well, the target binutils are the host's binutils; The standard
preinstalled as can handle ppc, ppc64, i386 and x86_64 code if told
to with -arch.

The Darwin/i386 C libraries, I'm not entirely sure about. In order
to compile plain C code, I would normally do:

  cc -o prog prog.c -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk

So I assume I need to tell the GCC configure script to look at
/Developer/SDKs/MacOSX10.4u.sdk.

(In case you're wondering why I'm compiling GCC when I already apparently
have a working cross compiler: I need a cross compiler with Ada support).

> In a native GCC build these target things are already there, in
> '/usr/bin', '/usr/lib' and '/usr/include', but in a cross GCC
> build the $tooldir should have those 'bin', 'lib' and '*include'
> directories filled with the target stuff before the build... Or
> they should be in the '$sysroot/usr' if one prefers the
> '--with-sysroot=$sysroot'. But in Darwin case the Apple's 'ld'
> probably cannot understand this search scheme...

I'm not entirely sure what you're suggesting here. Can I perhaps
do:

  --with-sysroot=/Developer/SDKs/MacOSX10.4u.sdk

Thanks for the help so far. I'm determined to get something useful
working.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]