Cygwin: Cross compiler: cc1.exe "cannot execute binary file"
Posted: Sun Apr 10, 2011 1:11 pm
I'm trying to get my cross compiler to work. I've done it before, but I lost my Cygwin installation so I have to do it over.
Some details:
Cygwin
Binutils 2.21
GCC 4.6.0
I'm following the GCC Cross-Compiler wiki page, and everything compiles fine. However, when I execute i586-elf-g++.exe with some arbitrary .c or .cpp file, I get the error:
i586-elf-g++: error: spawn: Exec format error
So, I cd to /usr/local/cross/bin and execute all of the executables without any parameter. Most succeed, except with i586-elf-cpp.exe I get the same 'Exec format error' message. I assume g++.exe executes cpp.exe, but I'm not familiar with GCC internals.
Next, I ran the cpp.exe under gdb, and found that before printing the error, it calls 'pex_run', with argument '/usr/local/cross/libexec/gcc/i586-elf/4.6.0/cc1.exe'
When I try to run this cc1.exe manually, I get 'bash: ./cc1.exe: cannot execute binary file'. I tried to recompiler gcc, but the problem persists.
$ file cc1.exe
cc1.exe: PE32 executable (console) Intel 80386, for MS Windows
Which is exactly the same as any other .exe.
The only other file in '/usr/local/cross/libexec/gcc/i586-elf/4.6.0/' that has the same problem is cc1plus.exe. Other .exe files, like 'collect2.exe' work fine.
I'm not really sure how I can approach this, as most of the gcc binaries seem to work fine, why would cc1.exe be any different?
Right now, I'm re-building gcc again while piping the output to a file so I can see if there are any warnings when compiling cc1, but I thought as I'd ask here already as I don't think it will result in anything.
Thanks in advance for any input
Edit:
I see now that during make all, I also get a 'format Error', this time from 'xgcc'... make just keeps going though, it does not stop with an error.
In command:
/usr/src/build-gcc/./gcc/xgcc -B/usr/src/build-gcc/./gcc/ -E -dM -
Some details:
Cygwin
Binutils 2.21
GCC 4.6.0
I'm following the GCC Cross-Compiler wiki page, and everything compiles fine. However, when I execute i586-elf-g++.exe with some arbitrary .c or .cpp file, I get the error:
i586-elf-g++: error: spawn: Exec format error
So, I cd to /usr/local/cross/bin and execute all of the executables without any parameter. Most succeed, except with i586-elf-cpp.exe I get the same 'Exec format error' message. I assume g++.exe executes cpp.exe, but I'm not familiar with GCC internals.
Next, I ran the cpp.exe under gdb, and found that before printing the error, it calls 'pex_run', with argument '/usr/local/cross/libexec/gcc/i586-elf/4.6.0/cc1.exe'
When I try to run this cc1.exe manually, I get 'bash: ./cc1.exe: cannot execute binary file'. I tried to recompiler gcc, but the problem persists.
$ file cc1.exe
cc1.exe: PE32 executable (console) Intel 80386, for MS Windows
Which is exactly the same as any other .exe.
The only other file in '/usr/local/cross/libexec/gcc/i586-elf/4.6.0/' that has the same problem is cc1plus.exe. Other .exe files, like 'collect2.exe' work fine.
I'm not really sure how I can approach this, as most of the gcc binaries seem to work fine, why would cc1.exe be any different?
Right now, I'm re-building gcc again while piping the output to a file so I can see if there are any warnings when compiling cc1, but I thought as I'd ask here already as I don't think it will result in anything.
Thanks in advance for any input
Edit:
I see now that during make all, I also get a 'format Error', this time from 'xgcc'... make just keeps going though, it does not stop with an error.
In command:
/usr/src/build-gcc/./gcc/xgcc -B/usr/src/build-gcc/./gcc/ -E -dM -