[Clfs-support] [Native Compiler] Problem Cross-compiling GMP MPFR and MPC
William Harrington
kb0iic at berzerkula.org
Fri Apr 14 05:35:29 PDT 2017
On Fri, 14 Apr 2017 10:15:36 +0200
Michele Bucca <michele.bucca at gmail.com> wrote:
> Hello Everyone,
>
> I'm trying to cross-compile a native host-x-host compiler with the
> musl-libc library
>
> To do that I have to
>
> 1) compile a cross-compiler. (Done)
> 2) Install GMP, MPFR and MPC on the cross-compiler
> 3) make a host-x-host cross-compile to make a native compiler
>
> Now I'm stuck compiling the GMP, MPFR and MPC...
>
> I had problems with MPFR because when I tried to compile them with the
> following configure switches
>
> ../mpfr-3.1.4/configure --host=i486-linux-musl
> --prefix=/home/michele/tmp/musl-native-toolchain/native/i486-linux-musl/
>
> it produced me x86_64 libraries! (My host is x86_64-linux-gnu)
>
> So I changed the configure switch like that:
>
> ../mpfr-3.1.4/configure --host=i486-linux-musl
> --build=x86_64-linux-gnu
> --prefix=/home/michele/tmp/musl-native-toolchain/native/i486-linux-musl/
>
> and it compiled well..
>
> Now I'm having problems building MPC for the same reason: the
> configure is like this:
>
> ../mpc-1.0.3/configure --host=i486-linux-musl
> --build=x86_64-linux-gnu
> --prefix=/home/michele/tmp/musl-native-toolchain/native/i486-linux-musl/
>
> what am I doing wrong?
>
Hello Michele,
First you need to understand the difference between host, build, and target...
https://www.gnu.org/software/autoconf/manual/autoconf-2.65/html_node/Specifying-Target-Triplets.html
You ended up with 64bit libraries because build defaulted to your host compiler.
build and host can be the same, but build will use the toolchain you need a target when cross-compiling.
In this case, build and host is the same because are most likely using the same machine to create the cross-compiler and use that cross-compiler (example):
--build=x86_64-cross-linux-gnu
--host=x86_64-cross-linux-gnu
--target=i486-linux-musl
After the cross-toolchain is built, then you can use (example):
--host=i486-linux-musl
--build=x86_64-cross-linux-gnu
If there is any confusion, you can look at he main cross-lfs CLFS book as a guide.
Sincerely,
William
More information about the Clfs-support
mailing list