Cannot create x86_64 cross compiler!

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
zhiayang
Member
Member
Posts: 368
Joined: Tue Dec 27, 2011 7:57 am
Libera.chat IRC: zhiayang

Cannot create x86_64 cross compiler!

Post by zhiayang »

Help. The title says it all…

I've been trying all day to build a cross compiler for 64-bit, to see how things are over on the other side of the bit-fence.

No luck. I downloaded

Code: Select all

binutils-2.22.tar.bz2
(and GCC too, but I haven't got to that) and tried to build, with

Code: Select all

export TARGET=x86_64-elf
export PREFIX=~/Desktop/cross

export CC=/dst/usr/bin/gcc-4.2
export CXX=/dst/usr/bin/g++-4.2
export CPP=/dst/usr/bin/cpp-4.2
export LD=/dst/usr/gcc-4.2

(Or, since there are also the i686-apple-darwin11-gcc-4.2.1 compilers… them also.)

And:

Code: Select all

../bu/configure --target=$TARGET --prefix=$PREFIX --disable-nls
(Yes, bu is actually a folder. I was lazy.)

What comes out (from config.log):

Code: Select all

configure:2230: checking build system type
configure:2244: result: i386-apple-darwin12.0.0
configure:2291: checking host system type
configure:2304: result: i386-apple-darwin12.0.0
configure:2324: checking target system type
configure:2337: result: i586-pc-elf
configure:2391: checking for a BSD-compatible install
configure:2459: result: /usr/bin/install -c
configure:2470: checking whether ln works
configure:2492: result: yes
configure:2496: checking whether ln -s works
configure:2500: result: yes
configure:2507: checking for a sed that does not truncate output
configure:2571: result: /usr/bin/sed
configure:2580: checking for gawk
configure:2610: result: no
configure:2580: checking for mawk
configure:2610: result: no
configure:2580: checking for nawk
configure:2610: result: no
configure:2580: checking for awk
configure:2596: found /usr/bin/awk
configure:2607: result: awk
configure:3742: checking for gcc
configure:3769: result: /dst/usr/bin/i686-apple-darwin11-gcc-4.2.1
configure:3998: checking for C compiler version
configure:4007: /dst/usr/bin/i686-apple-darwin11-gcc-4.2.1 --version >&5
i686-apple-darwin11-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:4018: $? = 0
configure:4007: /dst/usr/bin/i686-apple-darwin11-gcc-4.2.1 -v >&5
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /Users/zhiayang/tmp/gcc-5666.3/build/obj/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)
configure:4018: $? = 0
configure:4007: /dst/usr/bin/i686-apple-darwin11-gcc-4.2.1 -V >&5
i686-apple-darwin11-gcc-4.2.1: '-V' option must have argument
configure:4018: $? = 1
configure:4007: /dst/usr/bin/i686-apple-darwin11-gcc-4.2.1 -qversion >&5
i686-apple-darwin11-gcc-4.2.1: no input files
configure:4018: $? = 1
configure:4038: checking for C compiler default output file name
configure:4060: /dst/usr/bin/i686-apple-darwin11-gcc-4.2.1    conftest.c  >&5
i686-apple-darwin11-gcc-4.2.1: error trying to exec 'as': execvp: No such file or directory
configure:4064: $? = 1
configure:4101: result: 
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:4107: error: in `/Users/zhiayang/Desktop/bb':
configure:4111: error: C compiler cannot create executables
See `config.log' for more details.
With these:

Code: Select all

configure:4060: /dst/usr/bin/i686-apple-darwin11-gcc-4.2.1    conftest.c  >&5
i686-apple-darwin11-gcc-4.2.1: error trying to exec 'as': execvp: No such file or directory
configure:4064: $? = 1
As the possible faulting lines. What's going on?

I'm on OS X 10.8 (yea…) but the files in question (gcc-4.2 and the i686 darwin crap in /dst/usr/bin) were built *before* i upgraded, in 10.7.3, based on http://caiustheory.com/install-gcc-421- ... h-xcode-42, suggested by someone in my "GRUB Error 25" thread.
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: Cannot create x86_64 cross compiler!

Post by bluemoon »

i686-apple-darwin11-gcc-4.2.1: error trying to exec 'as': execvp: No such file or directory
Check the path settings, see if you can call it directly, and lookup i686-apple-darwin11-* to see if it actually wanted i686-apple-darwin11-as instead.

BTW I see no problem building a cross compiler with xcode 4.4 (there was a problem in older version).
User avatar
zhiayang
Member
Member
Posts: 368
Joined: Tue Dec 27, 2011 7:57 am
Libera.chat IRC: zhiayang

Re: Cannot create x86_64 cross compiler!

Post by zhiayang »

bluemoon wrote:
i686-apple-darwin11-gcc-4.2.1: error trying to exec 'as': execvp: No such file or directory
Check the path settings, see if you can call it directly, and lookup i686-apple-darwin11-* to see if it actually wanted i686-apple-darwin11-as instead.

BTW I see no problem building a cross compiler with xcode 4.4 (there was a problem in older version).
Ha, that's what I thought with 4.3's Xcode. It 'worked' but had quite a few unexplainable bugs (As detailed in my help topic)… I dunno about using this. I'm currently using 'find' to look for any i686-apple-darwin11 files, no luck yet.

So far, I can't find anything related to AS, which I assume is the GAS assembler, that comes with binutils… Which happens to be what I'm trying to install. GENIUS.

Either way… If I were to use the compiler from Xcode, which one? There's

Code: Select all

/Applications/Xcode.app/Contents/Developer/usr/bin/i686-apple-darwin11-llvm-gcc-4.2
/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/bin/i686-apple-darwin11-llvm-gcc-4.2
Both seem to be llvm, so the first or the second?
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: Cannot create x86_64 cross compiler!

Post by bluemoon »

requimrar wrote:If I were to use the compiler from Xcode, which one?
gcc should be a symbolic link to the preferred compiler upon xcode installation.
User avatar
zhiayang
Member
Member
Posts: 368
Joined: Tue Dec 27, 2011 7:57 am
Libera.chat IRC: zhiayang

Re: Cannot create x86_64 cross compiler!

Post by zhiayang »

bluemoon wrote:
requimrar wrote:If I were to use the compiler from Xcode, which one?
gcc should be a symbolic link to the preferred compiler upon xcode installation.
Hmm… The ones in Xcode point to Developer/usr/llvm-gcc/bin/i686-apple-darwin-*, so I guess you're right… *however*, there is *no*, I repeat *no*, alias, file or anything with gcc or llvm in its name in /usr/bin. Nothing.

Also, I used the compilers from Xcode, however I got this:

Code: Select all

ld: library not found for -lcrt1.10.6.o

EDIT: I went back to using the compilers I build previously, but instead copied the 'as' folder from 'Xcode.app/Contents/Developer/usr/libexec/as' to '/dst/usr/libexec', which appeared to solve that problem… but now I'm back to that error with LD.

EDIT 2: Splendid. It appears my system is now completely devoid of any binutils, because there is no make, there is no gnumake, nothing.

EDIT 3: I give up. Using the make from Xcode just gives me another 'C Compiler cannot create executables' error when trying to rebuild gcc from opensource.apple.com.


FINAL EDIT: I reinstalled the OS, used Time Machine to manually copy my files over, reinstalled Xcode and the CLT, and *bam*, it works. I tell you, those people need to make things work better.
Post Reply