【问题标题】:luarocks 'gcc-plugin.h' build errorluarocks 'gcc-plugin.h' 构建错误
【发布时间】:2016-07-15 23:33:48
【问题描述】:

我正在尝试将 torch 与 hdf5 包一起使用。我正在尝试通过luarocks install hdf5 安装它,但在构建阶段我收到有关 gcc-plugin 标头的错误。 (gcc 依赖 clang 后端)。完整的错误信息是:

luarocks install --local hdf5
Installing https://luarocks.org/hdf5-2.0.0-1.src.rock...
Using https://luarocks.org/hdf5-2.0.0-1.src.rock... switching to 'build' mode
Warning: variable CFLAGS was not passed in build_variables
gcclua-config.h:1:10: fatal error: 'gcc-plugin.h' file not found
#include "gcc-plugin.h"
         ^
1 error generated.
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -c -o gcclua.o -Iplugin/include -fPIC  -O2 -Wall -Wformat-security -I/usr/local/Cellar/lua/5.2.4_3/include gcclua.c
gcclua.c:7:10: fatal error: 'gcc-plugin.h' file not found
#include "gcc-plugin.h"
         ^
1 error generated.
make[2]: *** [gcclua.o] Error 1
make[1]: *** [gcc] Error 2
make: *** [gcc-lua] Error 2

只是为了提供更多信息,我依靠

gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
xcrun: error: couldn't stat toolchain: '/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.11.xctoolchain' (errno=No such file or directory)
Apple LLVM version 7.3.0 (clang-703.0.29)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

是否有人提示如何解决此问题?

非常感谢每一个帮助!!!

【问题讨论】:

    标签: c++ gcc luarocks


    【解决方案1】:

    除了gcc,您还需要标头,在Linux 上您可以使用sudo apt-get install gcc-4.8-plugin-dev 获得这些标头。如果您使用的是不同的操作系统或 gcc 版本,只需替换相应的包管理器/gcc 版本号即可。

    【讨论】:

      【解决方案2】:

      gcc-plugin.h 是 GCC 的一部分,所以我认为你真的需要安装 gcc 来获得它。 Clang 提供了一个gcc 兼容的前端脚本,但它仅仅提供了一个带有兼容标志的命令行驱动程序。

      您应该能够使用 Homebrew 安装 GCC:https://apple.stackexchange.com/a/86588

      【讨论】:

        【解决方案3】:

        我敢打赌,您曾尝试学习 CS287-16 课程:)。我已经联系了这个库的开发人员,他不太容易做一些事情来解决这个问题。显然他没有朋友拥有 Mac PC... 作为一种解决方法,我建议您使用带有 Linux 的 Docker 容器来运行 Lua 脚本。这就是我最终的结果......

        这是我所说的 Docker 映像:https://github.com/aoboturov/cs287-16-lua。你可以自己构建它,然后作为 Docker 容器运行 :)

        【讨论】:

          猜你喜欢
          • 2015-03-06
          • 2021-10-28
          • 2011-08-12
          • 2012-02-26
          • 2016-01-31
          • 2014-07-26
          • 1970-01-01
          • 1970-01-01
          • 2022-08-06
          相关资源
          最近更新 更多