简体   繁体   English

在Alpine上从源安装GCC

[英]Installing GCC from source on Alpine

While trying to install GCC 6.4.0 on Alpine, I run into: 在尝试在Alpine上安装GCC 6.4.0时,我遇到:

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: 但在/usr/lib ,它似乎是标准的查找目录,我有:

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? 可能有什么不对?

The best way to install all necessary libraries to compile gcc is using ./contrib/download_prerequisites script in the gcc source directory. 安装编译gcc所需的所有库的最佳方法是在gcc源目录中使用./contrib/download_prerequisites脚本。 That will download the support libraries and create symlinks, causing them to be built automatically as part of the gcc build process. 这将下载支持库并创建符号链接,使它们作为gcc构建过程的一部分自动构建。

The steps to compile gcc version 6.4.0 on Alpine linux are: 在Alpine linux上编译gcc版本6.4.0的步骤是:

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

The quickest way to install GCC on Alpine Linux is by issuing the following command: 在Alpine Linux上安装GCC的最快方法是发出以下命令:

apk add build-base

source: https://wiki.alpinelinux.org/wiki/GCC 来源: https//wiki.alpinelinux.org/wiki/GCC

It turns out that in this particular case one needs to install mpc1-dev, gmp-dev or mpfr-dev. 事实证明,在这种特殊情况下,需要安装mpc1-dev,gmp-dev或mpfr-dev。 I was missing out on mpc1-dev. 我错过了mpc1-dev。

sudo apk add mpc1-dev

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM