Installing GCC from source on Alpine

时光毁灭记忆、已成空白 提交于 2021-02-07 05:28:17

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!