This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: building gcc for mipsel


22.8.2016, 17:46, Peter Münster kirjoitti:
On Mon, Aug 22 2016, Kai Ruottu wrote:

One Linux-based system for this board is the OpenWRT one :
https://wiki.openwrt.org/toh/asus/wl500gp
This is, what I've installed.


Of course OpenWRT provides these things.
Yes, but building gcc fails: https://dev.openwrt.org/ticket/23325

That's why I try to build it from scratch, only by using the gcc source code.

Ok, here are the normal steps for a crosstoolchain :

1. copy the target C library into the chosen SYSROOT on the host system :
     $sysroot/lib
     $sysroot/usr/include
     $sysroot/usr/lib
The target system provides them already built and hopefully well tested

2. build the GNU binutils for the target, configuring them using '--with-sysroot=$sysroot'
     so that the linker will know where the target libs are

3. build the GNU compiler sources for the target, configuring them using '--with-sysroot=$sysroot'
     so that the compilers will know where the target libs are

The step 1 will probably be the hardest because all the native stuff is usually prepared for native installation and may for instance have absolute symlinks to '/lib' instead of relative '../../lib' which a self-made glibc installation would have. Furthermore collecting the kernel headers in some 'mipsel-linux-gnu' case could be hard when one hasn't thought what the target board could be, just wants a "generic" toolchain just for a fun. Some like Fedora then seem to follow the standards so just unpacking the glibc and kernel headers RPMS will put
everything in place.

I would expect the OpenWRT target in this case being easier and at least providing the libs in the standard '/lib' and '/usr/lib' places in the native case. Just like the prebuilt crosstools using the standard method, the SYSROOT, for the target C libraries. Not some mess in the '$prefix/$target' which is aimed for the stuff for the cross-host ('bin' and 'lib' for the libs made
during the GCC build).

About your problem elsewhere :

> mipsel-openwrt-linux-musl-gcc -g -Os -O2 -g -Os -DIN_GCC -W -Wall -Wno-narrowing > -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition > -isystem ./include -fPIC -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector
> -fPIC -I. -I. -I../../host-mipsel-openwrt-linux-musl/gcc -I../.././libgcc
> -I../.././libgcc/. -I../.././libgcc/../gcc -I../.././libgcc/../include -DHAVE_CC_TLS > -o _m16addsf3_s.o -MT _m16addsf3_s.o -MD -MP -MF _m16addsf3_s.dep -DSHARED -DL_m16addsf3
> -xassembler-with-cpp -c ../.././libgcc/config/mips/mips16.S

The use of stuff for 'mips16' could come from the '-elf' choice, Linux not using these 16-bit opcodes
at all...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]