【问题标题】:What is this error `make.exe": no_c_compiler: Command not found`这是什么错误`make.exe": no_c_compiler: Command not found`
【发布时间】:2016-10-17 06:28:14
【问题描述】:

我正在尝试在 Windows 2012 Server 版本上从源代码构建 grpc。我从 Python 网站下载并安装了 Python 3.5,并安装了整个 MinGW 包以及 git 和 git bash。按照从源代码构建的说明:

 $ git clone https://github.com/grpc/grpc.git
 $ cd grpc
 $ git submodule update --init
 $ make
 $ [sudo] make install

执行 make 后出现上述错误。这是 shell 输出供您阅读。

PS C:\Users\thunderboltsid\grpc> make
[MAKE]    Generating /c/Users/thunderboltsid/grpc/libs/opt/pkgconfig/grpc.pc
[MAKE]    Generating /c/Users/thunderboltsid/grpc/libs/opt/pkgconfig/grpc_unsecure.pc
[MAKE]    Generating cache.mk
[C]       Compiling third_party/zlib/adler32.c
make.exe": no_c_compiler: Command not found
make.exe": *** [/c/Users/thunderboltsid/grpc/objs/opt/third_party/zlib/adler32.o] Error 127

我真的不明白这个错误应该是什么。尝试谷歌搜索,但没有帮助。任何意见将不胜感激。

【问题讨论】:

  • 通过Makefile,看起来which gccwhich ccwhich clang都是空的,你安装的是哪个版本的mingw?
  • @user657267 那将是 v4.9.3-1。您对所有哪些命令都是空的是正确的。当我尝试运行 which 时,shell 会抛出一个错误,指出它不是可识别的 cmdlet、函数或脚本文件。
  • 搜索MinGW安装,在C:\MinGW\msys\1.0\bin下找到一个文件类型为which的文件
  • 如果您安装了 mingw,我建议您将其删除并使用 MSYS2 安装 mingw-w64,我不确定它为什么找不到 which,可能是 PATH 变量未设置正确吗?您也可以通过运行 make DEFAULT_CC=gcc DEFAULT_CXX=g++ 来解决此问题。
  • 你能从你的msys执行env吗?我猜有些环境变量没有正确设置。

标签: windows makefile mingw zlib


【解决方案1】:

你可能需要运行apt-get install which

【讨论】:

  • 请详细解答
  • 这实际上是正确的答案。为什么有人反对它?我在 Docker 映像中编译 grpc 时遇到了类似的问题。错误消息很神秘,原来which 没有安装在映像中。
【解决方案2】:

在您的系统中安装 build-base,例如:

apt-get install build-base

【讨论】:

    【解决方案3】:

    您可能根本没有安装 C 编译器,甚至没有安装 gcc。如果这是原因,那么安装 gcc 即可解决问题:

    apt get install gcc
    

    【讨论】:

    • no_c_compiler: Command not found 并不意味着没有 c 编译器,它的字面意思是缺少命令 no_c_compiler。安装which 确实解决了这个问题,因为no_c_compiler 依赖它。
    猜你喜欢
    • 2018-04-07
    • 2020-09-26
    • 2023-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多