Page 1 of 3
Making The GCC Cross-Compiler
Posted: Tue Apr 02, 2013 9:52 pm
by abraker95
I'm trying to build the GCC Cross-Compiler, following the wiki. I got as far as
../binutils-2.23.2/configure --target=$TARGET --prefix=$PREFIX --disable-nls
Running this with Cygwin, it gave me this error:
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot open output file confest.exe: Permission denied
*** The command 'gcc -o confest -g -O2 confest.c' failed.
*** You must set the environment variable CC to a working compiler.
rm: cannot remove 'conftest.exe': Permission Denied
rm: cannot remove 'a.exe': Permission Denied
I did some research and learned that it has to do something with Win7's file sharing, but I still failed to find a solution. Do not suggest Ubuntu, I don't have an available machine to install it right now.
Re: Making The GCC Cross-Compiler
Posted: Tue Apr 02, 2013 9:54 pm
by Opcode
Run it as administrator.
Re: Making The GCC Cross-Compiler
Posted: Tue Apr 02, 2013 10:15 pm
by abraker95
I did and it gave me:
checking whether the C compiler works... configure: error in '/usr/src/build-binutils':
configure: error: cannot run C compiled programs.
If you ment to cross compile, use '--host'
For some reason it now gives me the error regardless of whether I'm running it as Admin or not.
Re: Making The GCC Cross-Compiler
Posted: Wed Apr 03, 2013 12:18 am
by iansjack
What does the config.log file have to say about the failure? It sounds like your PATH isn't correctly set or your C compiler isn't properly installed.
Re: Making The GCC Cross-Compiler
Posted: Wed Apr 03, 2013 7:55 am
by abraker95
I tried it on a different computer and it gave me this error.
$ ../binutils-2.23.2/configure --target=$TARGET --prefix=$PREFIX --disable-nls
checking build system type... i686-pc-cygwin
checking host system type... i686-pc-cygwin
checking target system type... i586-pc-elf
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... no, using cp
checking whether ln -s works... yes
checking for a sed that does not truncate output... /usr/bin/sed
checking for gawk... gawk
checking to see if cat works as expected... yes
checking for gcc... gcc
checking for C compiler default output file name... a.exe
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... .exe
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for objdir... .libs
checking for PWL_handle_timeout in -lpwl... no
checking for version 0.11 (revision 0 or later) of PPL... no
checking for default BUILD_CONFIG...
checking for bison... bison -y
checking for bison... bison
checking for gm4... no
checking for gnum4... no
checking for m4... m4
checking for flex... flex
checking for flex... flex
checking for makeinfo... makeinfo
checking for expect... no
checking for runtest... no
checking for ar... ar
checking for as... as
checking for dlltool... dlltool
checking for ld... (cached) /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld.exe
checking for lipo... no
checking for nm... nm
checking for ranlib... ranlib
checking for strip... strip
checking for windres... windres
checking for windmc... windmc
checking for objcopy... objcopy
checking for objdump... objdump
checking for readelf... readelf
checking for i586-elf-cc... no
checking for i586-elf-gcc... no
checking for i586-elf-c++... no
checking for i586-elf-g++... no
checking for i586-elf-cxx... no
checking for i586-elf-gxx... no
checking for i586-elf-gcc... no
checking for i586-elf-gcj... no
checking for i586-elf-gfortran... no
checking for i586-elf-gccgo... no
checking for i586-elf-ar... no
checking for i586-elf-as... no
checking for i586-elf-dlltool... no
checking for i586-elf-ld... no
checking for i586-elf-lipo... no
checking for i586-elf-nm... no
checking for i586-elf-objdump... no
checking for i586-elf-ranlib... no
checking for i586-elf-readelf... no
checking for i586-elf-strip... no
checking for i586-elf-windres... no
checking for i586-elf-windmc... no
checking where to find the target ar... just compiled
checking where to find the target as... just compiled
checking where to find the target cc... pre-installed
checking where to find the target c++... pre-installed
checking where to find the target c++ for libstdc++... pre-installed
checking where to find the target dlltool... just compiled
checking where to find the target gcc... pre-installed
checking where to find the target gcj... pre-installed
checking where to find the target gfortran... pre-installed
checking where to find the target gccgo... pre-installed
checking where to find the target ld... just compiled
checking where to find the target lipo... pre-installed
checking where to find the target nm... just compiled
checking where to find the target objdump... just compiled
checking where to find the target ranlib... just compiled
checking where to find the target readelf... just compiled
checking where to find the target strip... just compiled
checking where to find the target windres... just compiled
checking where to find the target windmc... just compiled
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether -fkeep-inline-functions is supported... yes
1 [main] sh 3764 child_info::sync: wait failed, pid 4080, Win32 error 183
1 [main] sh 4080 E:\cygwin\bin\sh.exe: *** fatal error in forked process - WFSO timed out after longjmp
117 [main] sh 3764 fork: child 4080 - died waiting for dll loading, errno 11
Stack trace:
Frame Function Args
00229268 6102F9AB (00229268, 00000000, 00000000, 7C9101BB)
00229558 6102F9AB (6119FE20, 00008000, 00000000, 611A1C4F)
0022A588 6100665C (611DC60C, 0022A5B4, 7C802542, 0000066C)
0022A5A8 61006698 (611DC60C, 611DC6BD, 00000000, 00000000)
0022A5E8 61076CB0 (61203020, 00000000, 00000000, 00000000)
0022A628 61076E47 (0022A650, 0022A630, 00010000, 000000C3)
0022A7B8 61077FB9 (000000FF, 0022A7E8, 0022A7E4, 004444CD)
0022A7F8 610D6745 (20072870, 00000000, 0022A848, 20072818)
0022A878 0041622E (00000000, 20076438, 2006F258, 20056308)
0022A938 00412DCF (20071868, 00000000, FFFFFFFF, FFFFFFFF)
0022A968 00413D7D (20071868, 2006FE38, 2006E930, 00000000)
0022A988 00414C7B (00000000, 00000003, 2006D7F8, 20071690)
0022AA48 00413138 (20076420, 00000000, FFFFFFFF, FFFFFFFF)
0022AA78 00413D7D (20076420, 00000000, 0048A554, 00401EF9)
0022AAA8 00403858 (00000001, 2003CD10, 00000000, 200101D0)
0022AC78 004034E6 (61230049, 611A1EB6, 00000000, 6100763A)
End of stack trace (more stack frames may be present)
../binutils-2.23.2/configure: fork: retry: Resource temporarily unavailable
1037684 [main] sh 3764 fork: child -1 - forked process 3900 died unexpectedly, retry 0, exit code -1073741819, errno 11
Re: Making The GCC Cross-Compiler
Posted: Wed Apr 03, 2013 8:00 am
by iansjack
Try disabling any anti-virus programs. And try Googling the error message.
Re: Making The GCC Cross-Compiler
Posted: Wed Apr 03, 2013 10:22 am
by abraker95
With the antivirus disabled on WinXP it builds beautifully.
Re: Making The GCC Cross-Compiler
Posted: Mon Apr 08, 2013 3:19 pm
by abraker95
Following the Bare Bones, I tried to compile kernel.c and got this:
$ $CROSS/$TARGET-gcc -o $PROJECT/kernel.o -c $PROJECT/kernel.c -Wall -Wextra -Werror -nostdlib -nostartfiles -nodefaultlibs
/usr/local/cross/bin/i586-elf-gcc.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory
I'm using "CROSS" because the person this thread said that the problem disappeared when adding the cygwin bin directory to the PATH environment variable. That didn't work in my case.
http://forum.osdev.org/viewtopic.php?f= ... 85&start=5
Re: Making The GCC Cross-Compiler
Posted: Tue Apr 09, 2013 12:17 am
by Combuster
And he also explained what the problem was and why that solution worked, and you ignored that all-important part.
Re: Making The GCC Cross-Compiler
Posted: Tue Apr 09, 2013 10:50 am
by abraker95
I added the cygwin bin directory to PATH and it still shows me the error.
When it says "cannot open shared object file: No such file or directory", what directory is it looking in by default?
Re: Making The GCC Cross-Compiler
Posted: Tue Apr 09, 2013 11:02 am
by iansjack
Personally, I would stop messing arond with cygwin on Windows and use Linux as your development environment. But that's just because I'm lazy and like to do things the easy way.
Re: Making The GCC Cross-Compiler
Posted: Tue Apr 09, 2013 12:06 pm
by Mikemk
I was unable to make the cross compiler with cygwin, but it worked with MinGW.
Re: Making The GCC Cross-Compiler
Posted: Thu Apr 11, 2013 1:36 am
by dozniak
abraker95 wrote:I added the cygwin bin directory to PATH and it still shows me the error.
When it says "cannot open shared object file: No such file or directory", what directory is it looking in by default?
couldn't find cygwin1.dll
After adding the cygwin bin directory to my PATH the error went away
Re: Making The GCC Cross-Compiler
Posted: Thu Apr 11, 2013 7:20 am
by abraker95
Well unless I'm setting the PATH wrong, that method didn't work. I went as far as setting the PATH for Cygwin and Windows environment variables.
use Linux as your development environment.
Do not suggest Ubuntu, I don't have an available machine to install it right now.
Re: Making The GCC Cross-Compiler
Posted: Thu Apr 11, 2013 7:36 am
by iansjack
You can install Linux in a Virtual Machine on your Windows computer and get on with development. Or you can mess about with cygwin. Either way is fine by me.