【问题标题】:When building GCC on Alpine without root user, I am getting an error: no acceptable C compiler found in $PATH在没有 root 用户的情况下在 Alpine 上构建 GCC 时出现错误:在 $PATH 中找不到可接受的 C 编译器
【发布时间】:2017-08-28 13:40:24
【问题描述】:

我正在尝试在 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.

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

提前致谢!

【问题讨论】:

  • 我猜你可以调整你的运行环境的PATH变量并添加编译器所在的目录以便配置过程可以找到它。每个用户都可以在他们正在处理的会话上修改 PATH。
  • @Edmundo 我还没有安装 C 编译器来添加到 PATH 变量中。
  • 听起来像是一个陷阱 22。我猜你需要一些其他的 C 编译器,这样你就可以构建 gcc。
  • @Edmundo 你知道在没有 root 或 sudo 用户的情况下安装其他 C 编译器的方法吗?
  • ? Alpine Linux 中的默认“用户”root 不是吗? ...安装工具是apk。请通过apk | less 了解如何安装需要的 gcc 和 g++ 等。(您还需要 mpfr、gmp 来构建额外的 gcc。)en.wikipedia.org/wiki/Alpine_Linux

标签: linux gcc build alpine


【解决方案1】:

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

apk --update add gcc make g++ zlib-dev

【讨论】:

    【解决方案2】:

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

    好吧,然后创建一个用户(可能你已经这样做了),并使用 apk 安装 {gcc, g++, etc. build requirements},然后使用 /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
    

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

    【讨论】:

    • »» 没有使用apk 命令的权限««:好吧,那么我建议在某处设置一个类似的“Alpine Linux”。安装 gcc 构建要求。在 /home/same-name/ 中构建 gcc,并使其成为 .tar 包。然后将 new-gcc.tar 解压缩到您当前的操作系统: /home/same-name/ 。 (注意:Alpine 是一张 78MB 的 live CD。)
    • 是的,这也是我最终得到的唯一选择。正如我通过在整个互联网上搜索所知道的那样,在我们在其上编译/构建任何东西之前,必须在 alpine linux(或任何操作系统)上安装所有构建必需品。如果没有 root 访问权限或 sudo,我们将无法使操作系统成为构建环境。这就是我坚持的地方。谢谢你的支持。如果有任何其他方法可以做到这一点。请告诉我。
    猜你喜欢
    • 1970-01-01
    • 2018-04-06
    • 2012-06-14
    • 1970-01-01
    • 1970-01-01
    • 2018-12-11
    • 2016-06-08
    • 2012-03-08
    • 1970-01-01
    相关资源
    最近更新 更多