npm 安装期间 libssh2 中“C 编译器无法创建可执行文件”

2024-03-05

我在 npm install 期间遇到以下错误nodegit http://www.nodegit.org/:

> [email protected] /cdn-cgi/l/email-protection preinstall /home/mhu/nodegit
> node lifecycleScripts/preinstall

[nodegit] Running pre-install script
[nodegit] npm@2 installed, pre-loading required packages
[nodegit] Configuring libssh2.
{ [Error: Command failed: /bin/sh -c /home/mhu/nodegit/vendor/libssh2/configure --with-libssl-prefix=/home/mhu/nodegit/vendor/openssl/openssl
configure: error: in `/home/mhu/nodegit/vendor/libssh2':
configure: error: C compiler cannot create executables
See `config.log' for more details
]
  killed: false,
  code: 77,
  signal: null,
  cmd: '/bin/sh -c /home/mhu/nodegit/vendor/libssh2/configure --with-libssl-prefix=/home/mhu/nodegit/vendor/openssl/openssl' }
configure: error: in `/home/mhu/nodegit/vendor/libssh2':
configure: error: C compiler cannot create executables
See `config.log' for more details

[nodegit] ERROR - Could not finish preinstall
{ [Error: Command failed: /bin/sh -c /home/mhu/nodegit/vendor/libssh2/configure --with-libssl-prefix=/home/mhu/nodegit/vendor/openssl/openssl
configure: error: in `/home/mhu/nodegit/vendor/libssh2':
configure: error: C compiler cannot create executables
See `config.log' for more details
]
  killed: false,
  code: 77,
  signal: null,
  cmd: '/bin/sh -c /home/mhu/nodegit/vendor/libssh2/configure --with-libssl-prefix=/home/mhu/nodegit/vendor/openssl/openssl' }

有人可以帮我弄这个吗?是否是因为权限问题导致 C 编译器无法创建可执行文件?

我的环境:

os: centos-release-6-8.el6.centos.12.3.x86_64

gcc: 4.9.1

开放式SSL:openssl-1.0.1e-48.el6.x86_64

libssh2:libssh2-1.4.2-2.el6_7.1.x86_64

node: v4.4.7

npm: 2.15.8

gcc -v gives:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/packages/encap/gcc-4.9.1/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.9.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.9.1/configure --enable-languages=c,c++,fortran --enable-shared --disable-libstdcxx-pch --enable-lto --enable-libgomp --enable-__cxa_atexit --enable-tls --with-gmp --with-mpfr --with-mpc --with-libelf
Thread model: posix
gcc version 4.9.1 (GCC)

这是 /home/mhu/nodegit/vendor/libssh2 中的 config.log 中给出错误的部分:

configure:3429: $? = 0
configure:3418: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/packages/encap/gcc-4.9.1/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.9.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.9.1/configure --enable-languages=c,c++,fortran --enable-shared --disable-libstdcxx-pch --enable-lto --enable-libgomp --enable-__cxa_atexit --enable-tls --with-gmp --with-mpfr --with-mpc --with-libelf
Thread model: posix
gcc version 4.9.1 (GCC)
configure:3429: $? = 0
configure:3418: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3429: $? = 1
configure:3418: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:3429: $? = 1
configure:3449: checking whether the C compiler works
configure:3471: gcc  -I/home/mhu/nodegit/vendor/openssl/openssl/include  conftest.c  >&5
/usr/bin/ld: unrecognized option '-plugin'
/usr/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status
configure:3475: $? = 1
configure:3513: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "libssh2"
| #define PACKAGE_TARNAME "libssh2"
| #define PACKAGE_VERSION "-"
| #define PACKAGE_STRING "libssh2 -"
| #define PACKAGE_BUGREPORT "[email protected] /cdn-cgi/l/email-protection"
| #define PACKAGE_URL ""
| #define PACKAGE "libssh2"
| #define VERSION "-"
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:3518: error: in `/home/mhu/nodegit/vendor/libssh2':
configure:3520: error: C compiler cannot create executables
See `config.log' for more details

From config.log,你的问题是:

/usr/bin/ld: unrecognized option '-plugin'

这似乎是一个不起眼的错误。 Stack Overflow 上的两个问题对此进行了讨论。最有希望的问题是使用gdc编译D程序时出现“无法识别的选项'-plugin`”如何解决? https://stackoverflow.com/q/27813341.

要在 Autotools 中修复此问题(它会生成config.log和朋友),您需要执行以下操作:

export CPPFLAGS="-fno-use-linker-plugin"
export CFLAGS="-fno-use-linker-plugin"
export CXXFLAGS="-fno-use-linker-plugin"

然后,在 Autotools 世界中,您将:

./configure --with-libssl-prefix=/home/mhu/nodegit/vendor/openssl/openssl ...

有时您可以通过向编译器添加标志来逃脱:

export CC=gcc -fno-use-linker-plugin
export CXX=g++ -fno-use-linker-plugin

不幸的是,我的知识就到此为止了。我不知道你应该做什么npm。这看起来像是要寻求答案的问题:如何将选项传递给依赖包安装? https://stackoverflow.com/q/34822510/608639

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

npm 安装期间 libssh2 中“C 编译器无法创建可执行文件” 的相关文章

随机推荐

  • 将应用程序日志重定向到 docker 日志

    我的 Docker 容器生成多个应用程序日志 docker logs命令仅显示应用程序启动日志 有没有办法重定向其他日志文件 以便它们显示在docker logs命令 EDIT 我正在使用WebSphere https hub docker
  • Webpack 4 + Babel 在转译代码中保留 const

    我试图让我的代码在 Android 4 1 Webview 上运行 它不支持 ES6 但我收到此错误 未捕获的语法错误 在严格模式下使用 const babelrc 配置 plugins lodash presets babel prese
  • Google Apps 脚本中字符串的最大大小是多少?

    我正在将 csv 文件从 Gmail 附件导入到现有的 Google 电子表格中 我使用 getDataAsString 来保存整个 csv 内容 我已经尝试过不同的大小 最多可达 6000 个字符 该字符串可以包含的最大字符数是否存在 G
  • jquery ajax调用点击事件提交按钮

    我构建了一个 ajax 调用 当用户单击提交按钮时会提交该调用 我已经包含了 jquery 并编写了以下代码 取自 jquery 文档
  • 如何将两个 System.IO.Stream 实例连接成一个?

    假设我想连续向用户传输三个文件 但他不是给我一个Stream对象将字节向下推 我必须给他一个Stream他将从中提取字节的对象 我想带上我的三个FileStream对象 或者甚至更聪明 一个IEnumerable
  • 如何在 Laravel 中显示带有法语符号的验证消息?

    在 Laravel 验证中 制定了验证我的字段的规则 当我收到错误时 它会向我显示此错误 但没有法语符号 Le cin a d u00e9j u00e0 u00e9t u00e9 请注意 而不是显示此消息 Le cin a t d j pr
  • 如何在 Windows 10 上的 Visual Studio 2012 中添加 Edge 作为我的调试浏览器?

    我昨天将笔记本电脑升级到了 Windows 10 我希望在 Visual Studio 2012 中调试代码时能够使用 MS Edge 我找不到浏览器可执行文件 也不知道是否需要任何特殊的命令行参数才能使其正常工作 对此有任何提示或技巧吗
  • 修复 ColdFusion 中的 Unicode 转换问题/漏洞

    我们最近升级了安全扫描仪 它报告了一个新问题 建议的修复方法是什么 我们碰巧在 ACF9 另外 如果您有针对 CF 的漏洞利用示例 我将不胜感激 Unicode transformation issues Severity High Typ
  • ASIHTTPRequest 傻瓜书

    我是 ASIHTTPRequest 中的一个完整的虚拟人 我刚刚下载了该库并将其添加到我的项目中 现在我正在尝试了解使用它的基础知识 我找到了一些很好的例子here http iphone example blogspot com p as
  • 有没有办法发现哪些IP地址连接到数据库?

    我可以通过以下方式确定当前的连接数 db serverStatus connections 但给我的只是当前的连接数 是否有办法确定哪些 ip 已连接以及它们已分配给哪个连接号 从 mongo shell 中 这将打印客户端 IP 端口以及
  • 使用 cat 在闪亮的文本输出中插入换行符

    我正在尝试使用插入一些换行符cat and n使用一些文本输出shiny 这是我的相关部分ui R and server R 假设我想获得 t 检验的结果 并为 t df 和 p 值 单独设置一行 我正在使用闪亮的仪表板布局 样本数据 Gr
  • 如何实现一个非随机的随机数生成器?

    我需要一个随机数生成器来生成 n 和 m 之间的各种数字 但没有相同的概率 我想设置一个介于 n 和 m 之间的值 x 其中可能性最高 有没有一种简单的方法可以使用 Random 类来做到这一点 可能性应该具有二项分布或类似的形式 精确的二
  • SecCertificateRef:如何获取证书信息?

    我有一个证书 SecCertificateRef 我可以检查它是否有效 并且可以使用 SecCertificateCopySubjectSummary 提取 摘要 总结 到底是什么 我不理解术语 包含人类可读的证书内容摘要的字符串 在苹果文
  • 获取绑定到 Entry 小部件的 StringVar

    我正在编写一个简单的 GUI 程序 需要从 ini 文件加载默认值 我已经为 Entry 小部件指定了名称 并且可以通过以下方式获取它nametowidget方法 但是 我找不到访问绑定到条目小部件的 StringVar 并更新其值的方法
  • 右浮动 div 和最小宽度,div 在浏览器调整大小时移动到新行

    抱歉 标题没有很好地解释 但我会尽力在这里解释问题 如果我可以这样称呼它 那么这个特定问题可能有一个非常简单的解决方案 但我只是无法仅使用 css 来解决它 基本上我有一个父级 包装器 div 它设置了最小宽度和2个浮动子级 当我创建动态页
  • Docker-compose 链接与 external_links

    我相信这是一个简单的问题 但我仍然没有从 Docker compose 文档中得到它 链接和外部链接有什么区别 我喜欢 external links 因为我想要核心 docker compose 并且我想在不覆盖核心链接的情况下扩展它 我到
  • MongoParseError:URI 没有主机名、域名和 tld

    当我尝试将我的应用程序 nodejs 连接到 mongodb 时 出现此错误 我真的很感谢你在这里的帮助 MongoParseError URI does not have hostname domain name and tld at p
  • Android 旋转提示

    我有一个问题android prompt对于一个旋转器 我在 XML 文件中使用了以下代码 但它不起作用
  • 保存和加载数据(iphone sdk)

    我想知道在 iPhone 应用程序中保存和加载数据的最佳方法是什么 我正在尝试将字符串保存到文本文件或类似的文件中 然后将它们加载到表视图中 以便文本文件中的第一个条目是表视图中的第一行 依此类推 有人有一个想法我怎么能意识到这一点 提前致
  • npm 安装期间 libssh2 中“C 编译器无法创建可执行文件”

    我在 npm install 期间遇到以下错误nodegit http www nodegit org gt email protected cdn cgi l email protection preinstall home mhu no