Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

build nios2-elf-gcc with fedore4

Hi,

I try to build the compiler tools with fedora4. Binutils compiled and installed well.

Following error on the screen when trying building gcc :

checking whether byte ordering is bigendian... cross-compiling...
unknown
checking to probe for byte ordering... /usr/local/nios2-elf/nios2-elf/bin/ld: crt0.o: No such file: No such file or directory
collect2: ld returned 1 exit status
unknown
configure: error: unknown endianess - sorry
/src/src/gcc/libiberty/configure: line 3289: exit: please: numeric argument required
/src/src/gcc/libiberty/configure: line 3289: exit: please: numeric argument required

I used :

# ../configure --target=nios2-elf --prefix=/usr/local/nios2-elf --with-newlib --enable-languages=c,c++    

and then make.

I'm using gcc32 (not gcc 4.0), and the sources from the linux CDRom from Altera (Nios2 - 5.0).

I first extracted GNUSRC.TGZ from the COMMON directory, and then copied in the sources found in LINUX/GNUBIN.TGZ

Any idea what I do wrong?

Stefaan

15 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Got it !!

    I got it works using src from Nios2 window cd.

    1. binutils , configure --target=nios2-elf, make, make install

    2. gcc in dir pass1, configure --target=nios2-elf --enable-languages=c --with-newlib, make, make install

    3. newlib, configure --target=nios2-elf, make, make install

    4. gcc in dir pass2, configure --target=nios2-elf --enable-languages=c,c++ --with-newlib, make, make install

    The libs are for newlib, and can not be used for uclinux.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hippo,

    just found some time for playing around with it again.

    I tried with the sources from the window cd on the fedora system, but the configure step gives me the following message immediate :

    : bad interpreter: No such file or directory

    Stefaan
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I got there now (thanks to hippo, who showed me the way)

    I did like this now :

    - get the windows sources, zip -r and unzip -a (I've put modified sources in /usr/src/nios2)

    - binutils : like expected :

    cd /usr/src/nios2/binutils
    mkdir build
    cd build 
    ../configure --target=nios2-elf --prefix=/usr/local/nios2-elf
    make
    make install

    - gcc first pass ( = without Clib and C++ support) :

    PATH=/usr/local/nios2-elf:$PATH
    cd /usr/src/nios2/gcc
    mkdir build
    cd build
    ../configure --target=nios2-elf --prefix=/usr/local/nios2-elf --enable_languages=c --without-headers --with-newlib
    make
    make install

    - newlib c library

    cd /usr/src/nios2/newlib
    mkdir build
    cd build
    ../configure --prefix=/usr/local/nios2-elf --target=nios2-elf
    make
    make install

    - gcc second pass :

    cd /usr/src/nios2/gcc/build
    ../configure --target=nios2-elf --prefix=/usr/local/nios2-elf --enable_languages=c,c++  --with-headers --with-newlib
    make
    make install

    The trick seems to be the --without-headers in the first gcc pass (see porting gcc (http://http://www.mega-tokyo.com/osfaq2/index.php/gcc%20cross-compiler))