Page 1 of 1

Yet Another GCC Build Issue

Posted: Sat Jun 15, 2013 2:36 am
by joj
I am attempting to build a GCC cross-compiler. When I follow the steps listed on the wiki, I get (seemingly) everything but the actual

Code: Select all

$TARGET-gcc
file, making stuff like

Code: Select all

$TARGET-gcc --version
, etc. impossible. I am currently running this on Cygwin, using GCC 4.8.0 and binutils 2.23.2. My next course of action would be to switch to Linux, given the numerous benefits of doing so in this case. I'll probably do this in a VM, but I might just switch one of my computers over entirely anyway.

Steps I have taken in a desperate attempt to not waste your time:
I have built software from its source code on both Windows and Linux before; however, never GCC and never on Cygwin.

Do I need to just RTFM? Or am I missing something else? Just to clarify: I have followed the steps on the wiki exactly.

Re: Yet Another GCC Build Issue

Posted: Sat Jun 15, 2013 5:25 am
by sortie
Hi. You don't mention any error messages. Note that $TARGET-gcc is a metasyntatic variable that expands to something like i586-elf-gcc depending on your desired architecture. Note that must add $PREFIX/bin to your PATH or you won't be able to invoke $TARGET-gcc directly. Is the binary in that directory? Does it when when you run $PREFIX/bin/$TARGET-gcc? Make sure the variables are set, note that the export shell builtin does not set these variables permanently. Have you successfully run make install-gcc? Does make fail? (For instance, if running "echo $?" after make and it gives anything but 0 in return, then it failed. Post the suitable error messages.)

If you are able and willing to use Linux instead (as you say), then I recommend you use it instead of Windows. A lot of osdev-related activies work almost out of the box and it is easier to help you.

Re: Yet Another GCC Build Issue

Posted: Sat Jun 15, 2013 5:58 pm
by joj
Sorry, I was being ambiguous.
Note that $TARGET-gcc is a metasyntatic variable that expands to something like i586-elf-gcc depending on your desired architecture
I'm following the wiki tutorial exactly, so my architecture is in fact i586-elf.

Code: Select all

9102666@FTL9102666 ~
$ cd $PREFIX

9102666@FTL9102666 ~/opt/cross
$ pwd
/home/9102666/opt/cross

9102666@FTL9102666 ~/opt/cross
$ ls
bin  i586-elf  lib  share

9102666@FTL9102666 ~/opt/cross
$ cd bin

9102666@FTL9102666 ~/opt/cross/bin
$ pwd
/home/9102666/opt/cross/bin

9102666@FTL9102666 ~/opt/cross/bin
$ ls
i586-elf-addr2line.exe  i586-elf-ld.bfd.exe   i586-elf-readelf.exe
i586-elf-ar.exe         i586-elf-ld.exe       i586-elf-size.exe
i586-elf-as.exe         i586-elf-nm.exe       i586-elf-strings.exe
i586-elf-c++filt.exe    i586-elf-objcopy.exe  i586-elf-strip.exe
i586-elf-elfedit.exe    i586-elf-objdump.exe 
i586-elf-gprof.exe      i586-elf-ranlib.exe
(Sorry about formatting).

As you can see, there's no i586-elf-gcc.exe in there:

Code: Select all

9102666@FTL9102666 ~/opt/cross/bin
$ cd $PREFIX

9102666@FTL9102666 ~/opt/cross
$ $TARGET-gcc --version
-bash: i586-elf-gcc: command not found
I didn't see any errors during the configure, or make processes. That being said, I didn't do as you said (echo $) directly afterwards; however, I just ran it then:

Code: Select all

9102666@FTL9102666 ~/opt/cross
$ echo $
$
I'm in the same shell session as when I did the wiki tutorial, so I have the same variables set.

Re: Yet Another GCC Build Issue

Posted: Sat Jun 15, 2013 7:25 pm
by sortie
It would look like you forgot to pass --prefix to the gcc build or you forgot to make install. Don't forget you have to build both binutils and gcc.

Re: Yet Another GCC Build Issue

Posted: Sat Jun 15, 2013 9:24 pm
by joj
I re-attempted and it built successfully! Thank you very much, I'm not quite sure what actually happened as I recall passing --prefix to the gcc build.

Ah well, all is well that ends well.

Re: Yet Another GCC Build Issue

Posted: Sat Jun 15, 2013 10:33 pm
by Mikemk
joj wrote:I re-attempted and it built successfully! Thank you very much, I'm not quite sure what actually happened as I recall passing --prefix to the gcc build.

Ah well, all is well that ends well.
Things that magically fix themselves tend to unfix themselves later.