Dingjun Chen kirjoitti 10.10.2023 klo 20.13:
Hi, Ruoyao,
Could you please tell me how to build cross compiler for Linux of different versions?
I followed the following method, but I failed. I look forward to your help!
How to Build a GCC Cross-Compiler (preshing.com)<https://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/>
This "method" belongs in the group "Linux from scratch", not in
"producing a cross compiler for existing Linux target". The idea in the
latter is "to do same things on another host system as one could do on
the existing Linux target system". What already exists, it is
available and there isn't any reason to "reinvent the wheel". So you
only need to produce GNU binutils and GCC from their sources
to work on another host system and to produce stuff for the target
system there. For the "Linux distros" their install RPMs, '.deb'
packages etc will provide the required "run-time libraries" usually
natively in '/lib' on the target system, the "development libraries"
in '/usr/lib' and "development headers & kernel headers" in
'/usr/include'. These are the basic "sysroot" stuff required during the
GCC build Xi told about.
So please choose your install $prefix for the cross binutils and cross
GCC binaries (the same for both) and $sysroot for the C library
etc coming from / belonging to the target system. Then configure and
build the sources and be happy! It really isn't complicated at
all!