问题
While trying to install GCC 6.4.0 on Alpine, I run into:
checking for the correct version of gmp.h... yes
checking for the correct version of mpfr.h... yes
checking for the correct version of mpc.h... yes
checking for the correct version of the gmp/mpfr/mpc libraries... no
But in /usr/lib
, which seems to be the standard lookup directory, I have:
libgmp.a
libgmp.so
libgmp.so.10
libgmp.so.10.3.2
libmpc.so.3
libmpc.so.3.0.0
libmpfr.so.4
libmpfr.so.4.1.5
What could be wrong?
回答1:
The quickest way to install GCC on Alpine Linux is by issuing the following command:
apk add build-base
source: https://wiki.alpinelinux.org/wiki/GCC
回答2:
The best way to install all necessary libraries to compile gcc
is using ./contrib/download_prerequisites
script in the gcc
source directory. That will download the support libraries and create symlinks, causing them to be built automatically as part of the gcc
build process.
The steps to compile gcc
version 6.4.0
on Alpine linux are:
apk add --no-cache make build-base
wget https://ftp.gnu.org/gnu/gcc/gcc-6.4.0/gcc-6.4.0.tar.gz
tar -xzvf gcc-6.4.0.tar.gz
cd gcc-6.4.0
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
./../gcc-6.4.0/configure --prefix=$HOME/GCC-6.4.0 --disable-multilib
make all-gcc
make all-target-libgcc
make install-gcc
make install-target-libgcc
回答3:
It turns out that in this particular case one needs to install mpc1-dev, gmp-dev or mpfr-dev. I was missing out on mpc1-dev.
sudo apk add mpc1-dev
来源:https://stackoverflow.com/questions/50984864/installing-gcc-from-source-on-alpine