Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12596 Discussions

build nios2-elf-gcc with fedore4

Altera_Forum
Honored Contributor II
1,571 Views

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
0 Kudos
15 Replies
Altera_Forum
Honored Contributor II
501 Views

You need the crt0.o from newlib. 

I try the build with the source from Nios2 window cd. 

I built binutils,gcc with c only, newlib, and gcc with c,c++. 

And it stopped at the last step for libstdc++, 

 

checking for extra compiler flags for building... configure: WARNING: No native atomic operations are provided for this platform. configure: WARNING: They cannot be faked when thread support is disabled. configure: WARNING: Thread-safety of certain classes is not guaranteed. configure: error: No support for this host/target combination. make: *** Error 1 

 

I try with buildroot, and it stopped at the same message. 

Still finding...
0 Kudos
Altera_Forum
Honored Contributor II
501 Views

hippo, 

 

I had the same message in my first tests, but then I was still using gcc4.0 instead of the older gcc32.  

 

Someone from Altera can tell me how to build the tools?? 

 

Stefaan
0 Kudos
Altera_Forum
Honored Contributor II
501 Views

I am trying with gcc32 and buildroot to gcc3.4.5. 

The error message was from an improper def in the config.sub in gcc source, 

I fix it to 

Index: package/gnuconfig/config.sub =================================================================== --- package/gnuconfig/config.sub        (revision 13473) +++ package/gnuconfig/config.sub        (working copy) @@ -299,8 +299,8 @@                basic_machine=mt-unknown               ;;        nios2 | nios2-* | nios2 | nios2-*) -               basic_machine=nios2-altera -               os=-none +              basic_machine=nios2-uclibc +#              os=-none               ;;       # We use `pc' rather than `unknown' 

 

Then it can compile some libstdc++, but stopped at 

 

from /home/jack/buildroot/toolchain_build_nios2/gcc-3.4.5/libstdc++-v3/src/allocator.cc:35: /home/jack/buildroot/toolchain_build_nios2/gcc-3.4.5-final/nios2-linux-uclibc/mno-hw-mul/libstdc++-v3/include/nios2-linux-uclibc/bits/c++locale.h: In function `int std::__convert_from_v(char*, int, const char*, _Tv, int* const&, int)': /home/jack/buildroot/toolchain_build_nios2/gcc-3.4.5-final/nios2-linux-uclibc/mno-hw-mul/libstdc++-v3/include/nios2-linux-uclibc/bits/c++locale.h:103: error: `snprintf' is not a member of `std' 

 

I will try other gcc 3.4.x.
0 Kudos
Altera_Forum
Honored Contributor II
501 Views

Hippo, 

 

Thanks for the time you put in this. I'll try the same you did so far. 

 

 

If it is so difficult, I just can not understand how the tools get build at Altera Corporation. 

 

Stefaan
0 Kudos
Altera_Forum
Honored Contributor II
501 Views

I checked the altera's config by "strings nios2-elf-c++.exe". 

There is no problem in your config. 

But they didn't have libstdc++ ... 

Do you use libstdc++ ? 

 

I am still checking... 

http://gcc.gnu.org/install/ (http://gcc.gnu.org/install/)
0 Kudos
Altera_Forum
Honored Contributor II
501 Views

Using the source from Nios2 window cd, 

I try remove the dir libstc++-v3 from gcc source tree, and it build nios2-elf-c++ http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif
0 Kudos
Altera_Forum
Honored Contributor II
501 Views

Hippo, 

 

Yes, I need the stdc++ library, otherwise I can not use classes in a proper way. 

 

I don&#39;t need the C++ exception handling. 

 

Stefaan
0 Kudos
Altera_Forum
Honored Contributor II
501 Views

We can try to enable more features in uclibc config using buildroot.

0 Kudos
Altera_Forum
Honored Contributor II
501 Views

hippo, 

 

Sorry that I can not support you very much, I&#39;m not a linux/gnu... specialist, but I&#39;m learning, ...
0 Kudos
Altera_Forum
Honored Contributor II
501 Views

Thank you anyways. 

It doesn&#39;t matter to me. I am not a c++ user. I just want to find out the problem. 

I think the configure does not work well. I will let you know if I have progess.
0 Kudos
Altera_Forum
Honored Contributor II
501 Views

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.
0 Kudos
Altera_Forum
Honored Contributor II
501 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
501 Views

Use "zip -r" and "unzip -a" to convert the source. 

It is similar to "dos2unix", but easier to use. 

 

You can find some details from earlier post, 

http://forum.niosforum.com/forum/index.php?showtopic=3040 (http://forum.niosforum.com/forum/index.php?showtopic=3040

post# 1 and post# 5.
0 Kudos
Altera_Forum
Honored Contributor II
501 Views

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&#39;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))
0 Kudos
Altera_Forum
Honored Contributor II
501 Views

I have updated buildroot to compile c++ and libstdc++ for used with uClibc/uClinux. 

Try out post#1 in 

http://forum.niosforum.com/forum/index.php?showtopic=3174 (http://forum.niosforum.com/forum/index.php?showtopic=3174)
0 Kudos
Reply