在没有 root 用户的情况下在 Alpine 上构建 GCC 时,出现错误:在 $PATH 中找不到可接受的 C 编译器

use*_*707 4 linux gcc build alpine-linux

我正在尝试在 Alpine Linux 上构建 GCC。我没有 root 访问权限或启用 sudo 的用户。我正在关注GCC Wiki。我得到了这个输出。

~/objdir $ $PWD/../gcc-5.2.0/configure --prefix=$HOME/gcc-5.2.0 --enable-languages=c,c++,fortran,go
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking for libatomic support... yes
checking for libcilkrts support... yes
checking for libitm support... yes
checking for libsanitizer support... yes
checking for libvtv support... yes
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/home/asgeek/objdir':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
Run Code Online (Sandbox Code Playgroud)

我已经通过互联网搜索了几天,但找不到合适的解决方案。请帮我解决这个问题。

提前致谢!

Sah*_*dhi 14

在 alpine 中安装 python 时我遇到了同样的错误,我用这个修复了它:

apk --update add gcc make g++ zlib-dev
Run Code Online (Sandbox Code Playgroud)


Knu*_*sen 0

但我想要的是创建一个脚本来为非root环境构建GCC

好吧,然后创建一个用户(可能你已经这样做了),并使用 安装 {gcc、g++ 等构建要求} ,并使用apk进行构建/home/[name]/gcc-build/

1) ../gcc-5.4.0/configure --prefix=/home/[name]/gcc54 --program-suffix=54 --enable-languages=c,c++ --disable-multilib
2) make
Run Code Online (Sandbox Code Playgroud)

建议使用 GCC 版本 5 或更低版本。注意:如果例如gcc-4.9.x,配置命令等是不同的。