【问题标题】:Failed to build gem native extension on macOS无法在 macOS 上构建 gem 原生扩展
【发布时间】:2021-08-30 23:54:11
【问题描述】:

我想运行这个名为 TarSynFlow (https://github.com/seoanezonjic/TarSynFlow) 的工作流。它有一些我正在尝试安装的要求,但遇到了一些问题,特别是安装 scbi_distributed_blast。 TarSynFlow github 页面和原始源 (https://github.com/dariogf/scbi_distributed_blast) 用于输入:

gem install scbi_distributed_blast

试过了,但得到以下结果:

Building native extensions. This could take a while...
ERROR:  Error installing scbi_distributed_blast:
ERROR: Failed to build gem native extension.
current directory: /Users/user_name/.rvm/gems/ruby-3.0.0/gems/eventmachine-1.2.7/ext
/Users/ginamchaput/.rvm/rubies/ruby-3.0.0/bin/ruby -I
/Users/ginamchaput/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0 -r ./siteconf20210830-52462-idkyvy.rb extconf.rb
checking for -lcrypto... yes
checking for -lssl... yes
checking for openssl/ssl.h... yes
checking for openssl/err.h... yes
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_fd_select()... yes
checking for rb_fdset_t in ruby/intern.h... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_enable_interrupt()... no
checking for rb_time_new()... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... yes
checking for pipe2() in unistd.h... no
checking for accept4() in sys/socket.h... no
checking for SOCK_CLOEXEC in sys/socket.h... no
checking for sys/event.h... yes
checking for sys/queue.h... yes
checking for clock_gettime()... yes
checking for CLOCK_MONOTONIC_RAW in time.h... yes
checking for CLOCK_MONOTONIC in time.h... yes
CXXFLAGS= -Wall -Wextra -Wno-deprecated-declarations -Wno-ignored-qualifiers -Wno-unused-result -Wno-address
creating Makefile
current directory: /Users/user_name/.rvm/gems/ruby-3.0.0/gems/eventmachine-1.2.7/ext
make "DESTDIR=" clean
current directory: /Users/user_name/.rvm/gems/ruby-3.0.0/gems/eventmachine-1.2.7/ext
make "DESTDIR="
compiling binder.cpp
In file included from binder.cpp:20:
./project.h:119:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
 ^~~~~~~~~~~~~~~
1 error generated.
make: *** [binder.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/user_name/.rvm/gems/ruby-3.0.0/gems/eventmachine-1.2.7 for inspection.
Results logged to /Users/user_name/.rvm/gems/ruby-3.0.0/extensions/x86_64-darwin-20/3.0.0/eventmachine-1.2.7/gem_make.out

我确实看到其他帖子建议使用 sudo gem install scbi_distributed_blast ;我确实尝试过,但同样的错误。

我正在使用 macOS Big Sur; XCode v 12.5.1;红宝石(通过 RVM 安装)v 3.0.0p0;如果有人建议安装它,那就太好了!

【问题讨论】:

    标签: ruby xcode rubygems


    【解决方案1】:

    从这里:

    ./project.h:119:10: fatal error: 'openssl/ssl.h' file not found
    

    看起来您需要 ssl 开发库来编译 gem。如果您安装了 xcode,请尝试:

    xcode-select --install
    

    另一种安装所需库的方法是将homebrew 与:

    brew install openssl
    brew link openssl --force
    

    更新

    如果您已安装所有必需的库,请尝试自行安装 eventmachine,但指定 ssl 库所在的路径。

    gem install eventmachine -- --with-cppflags=-I/usr/local/opt/openssl/include
    

    然后,再次尝试安装scbi_distributed_blast

    【讨论】:

    • eventmachinescbi_mapreduce 的依赖关系,它是 scbi_distributed_blast 的依赖关系
    • 所以我尝试了 brew install openssl 以及 xcode-select 选项;两者都说它们已安装并且是最新的。通过自制软件重新安装,但没有运气。当我尝试运行 gem install 时,我是否需要在某个地方有一个 PATH 或其他东西?
    • @Gina 我已经更新了我的答案。再试一次,告诉我这是否有效
    猜你喜欢
    • 1970-01-01
    • 2022-09-23
    • 2022-10-25
    • 1970-01-01
    • 2015-07-20
    • 2015-06-18
    • 2016-03-08
    • 2012-07-26
    相关资源
    最近更新 更多