how to build gcc cross complier with –disable-multilib

Anyone can help how to build the gcc cross compiler with multilib support for x86_64 architecture? That is to build it from source code for m32 and m64 lib support.

There is a good article showing how to build a gcc cross compiler:
http://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/
, but it only demonstrates the case with –disable-multilib.

I am trying to build x86_64 gcc cross complier with –enable-multilib option ( for both m32 and m64), instead of –disable-mutlilib.

I follow that except using arch=x86_64*-* and –enable-multilib
The problem I am facing is at step 4. Standard C Library Headers and Startup Files

$ make install-bootstrap-headers=yes install-headers

It comes out the following errors:

/opt/cross/lib/gcc/x86_64-linux/4.9.2/../../../../x86_64-linux/bin/ld: cannot find crtbegin.o: No such file or directory
/opt/cross/lib/gcc/x86_64-linux/4.9.2/../../../../x86_64-linux/bin/ld: cannot find -lgcc
/opt/cross/lib/gcc/x86_64-linux/4.9.2/../../../../x86_64-linux/bin/ld: cannot find -lgcc_s
/opt/cross/lib/gcc/x86_64-linux/4.9.2/../../../../x86_64-linux/bin/ld: cannot find -lgcc
/opt/cross/lib/gcc/x86_64-linux/4.9.2/../../../../x86_64-linux/bin/ld: cannot find -lgcc_s
/opt/cross/lib/gcc/x86_64-linux/4.9.2/../../../../x86_64-linux/bin/ld: cannot find crtend.o: No such file or director

Any idea?

And I have multilib installed as:

james@james-Aspire-E5-472G:/usr$ find -name libgcc*.*
./lib32/libgcc_s.so.1
./lib/ure/lib/libgcc3_uno.so
./lib/x86_64-linux-gnu/libgccpp.so.1.0.3
./lib/x86_64-linux-gnu/libgccpp.so.1
./lib/gcc/x86_64-linux-gnu/4.9/libgcc_s.so
./lib/gcc/x86_64-linux-gnu/4.9/32/libgcc_s.so
./lib/gcc/x86_64-linux-gnu/4.9/32/libgcc_eh.a
./lib/gcc/x86_64-linux-gnu/4.9/32/libgcc.a
./lib/gcc/x86_64-linux-gnu/4.9/libgcc_eh.a
./lib/gcc/x86_64-linux-gnu/4.9/x32/libgcc_s.so
./lib/gcc/x86_64-linux-gnu/4.9/x32/libgcc_eh.a
./lib/gcc/x86_64-linux-gnu/4.9/x32/libgcc.a
./lib/gcc/x86_64-linux-gnu/4.9/libgcc_s_x32.so
./lib/gcc/x86_64-linux-gnu/4.9/libgcc_s_32.so
./lib/gcc/x86_64-linux-gnu/4.9/libgcc.a
./libx32/libgcc_s.so.1
./share/doc/libgcc-4.9-dev

james@james-Aspire-E5-472G:/usr$ find -name crtbegin.o
./lib/gcc/x86_64-linux-gnu/4.9/crtbegin.o
./lib/gcc/x86_64-linux-gnu/4.9/32/crtbegin.o
./lib/gcc/x86_64-linux-gnu/4.9/x32/crtbegin.o


Source: gcc

Leave a Reply