【问题标题】:configure: error: no acceptable C compiler found in $PATH配置:错误:在 $PATH 中找不到可接受的 C 编译器
【发布时间】:2016-11-22 23:25:48
【问题描述】:

我正在尝试构建和安装 Apache Thrift 编译器和库

我必须键入此命令,说明中显示 ./configure && make 但我得到这个错误:

checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/PATH/TO/thrift-0.9.3':
configure: error: no acceptable C compiler found in $PATH

当我输入命令提示符时 gcc --version我明白了

gcc (GCC) 5.3.0 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

它会找到 gcc 编译器。但是,当我从 msys2 Shell 运行它时

bash: gcc: command not found

环境变量中的路径是正确的。 C:\MinGW\bin

却找不到gcc

提前致谢!

【问题讨论】:

  • 你是在cygwin 环境中运行./configure && make 还是类似window 的linux 子系统?如果是,则需要cygwin 或Window 的Linux 子系统自带的gcc。
  • 我使用的是 Win10 操作系统
  • 确实是。但是bash 不是 Windows 10 原生的,所以你必须运行 Window 的 linux 子系统。尝试从bash 中安装 gcc。
  • @alvits 我做到了。我使用这个命令pacman -S mingw-w64-x86_64-gcc 来安装 gcc 包,还有其他建议吗?
  • 当你在bash里面时,$PATH的值是多少?更新路径以添加 gcc 和其他 binutils 的位置。您将需要它们。

标签: linux gcc gnu thrift msys


【解决方案1】:

gcc 编译器的路径不在PATH 中。

您可以在运行 make 之前添加它。

export PATH=${PATH}:/c/MinGW/bin
./configure && make

祝你好运。

【讨论】:

  • 对于从MSYS2安装的MinGW-w64:export PATH=$PATH:/mingw64/bin
【解决方案2】:

我在 Win10 操作系统上

有一个Visual Studio project file for the compiler。要么使用那个,要么download the compiler binary for Windows directly from the website

【讨论】:

  • 刚得到一个赞成票,所以我重新阅读了这个帖子,确实拥有 Visual Studio 让生活更轻松。必须安装 dlib 包并与此线程有相同的问题,在安装 Visual Studio 15 后解决
【解决方案3】:

如果是centos/redhat机器安装全套开发包

​​>
$ sudo yum groups install "Development Tools"

它包括 gcc,g++,make Id。安装后重试

【讨论】:

    【解决方案4】:

    这个踏板很旧,但是,它通过在启动脚本中启用“set MSYS2_PATH_TYPE=inherit”对我有用。在 MSYS2 的根目录下运行 mingw64.exe 也可以。

    【讨论】:

      【解决方案5】:

      未来:如果在 Windows 10 和 MSYS2 上。我取消了该行的注释

      set MSYS2_PATH_TYPE=inherit
      

      在 msys2_shell.cmd 上,所以它只是继承了您在 windows 上放置所有内容的路径。

      我很惊讶这不是默认设置!

      【讨论】:

        猜你喜欢
        • 2012-03-08
        • 2012-06-14
        • 1970-01-01
        • 2016-06-08
        • 1970-01-01
        • 2011-01-14
        • 2013-11-17
        • 2018-12-11
        • 1970-01-01
        相关资源
        最近更新 更多