Yet Another GCC Build Issue

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
joj
Posts: 3
Joined: Sat Jun 15, 2013 1:22 am

Yet Another GCC Build Issue

Post 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.
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: Yet Another GCC Build Issue

Post 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.
joj
Posts: 3
Joined: Sat Jun 15, 2013 1:22 am

Re: Yet Another GCC Build Issue

Post 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.
Last edited by joj on Sat Jun 15, 2013 7:40 pm, edited 1 time in total.
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: Yet Another GCC Build Issue

Post 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.
joj
Posts: 3
Joined: Sat Jun 15, 2013 1:22 am

Re: Yet Another GCC Build Issue

Post 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.
Mikemk
Member
Member
Posts: 409
Joined: Sat Oct 22, 2011 12:27 pm

Re: Yet Another GCC Build Issue

Post 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.
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
Post Reply