gpt4 book ai didi

ruby - 如何将 `--with-ruby-include` 之类的构建标志传递给 gem 安装?

转载 作者:行者123 更新时间:2023-12-02 17:23:08 30 4
gpt4 key购买 nike

(我知道我的 Ruby 安装有点乱,但是:)我正在尝试安装 native gem,但出现错误

ytg@yui:~> sudo /usr/bin/ruby.ruby2.3 /usr/bin/gem install ruby-debug-ide
Building native extensions. This could take a while...
ERROR: Error installing ruby-debug-ide:
ERROR: Failed to build gem native extension.

current directory: /usr/lib64/ruby/gems/2.3.0/gems/ruby-debug-ide-0.6.0/ext
/usr/bin/ruby.ruby2.3 mkrf_conf.rb
Installing base gem
Building native extensions. This could take a while...
Building native extensions. This could take a while...
ERROR: Failed to build gem native extension.

current directory: /usr/lib64/ruby/gems/2.3.0/gems/debase-0.2.2.beta9/ext
/usr/bin/ruby.ruby2.3 -r ./siteconf20161213-12983-1q9o2d7.rb extconf.rb
checking for vm_core.h... no
checking for vm_core.h... no
checking for vm_core.h... no
Makefile creation failed
*************************************************************

NOTE: If your headers were not found, try passing
--with-ruby-include=PATH_TO_HEADERS

*************************************************************

*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib64
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/$(RUBY_BASE_NAME).ruby2.3
--with-ruby-dir
--without-ruby-dir
---with-ruby-include
--without-ruby-include=${ruby-dir}/include
--with-ruby-lib
--without-ruby-lib=${ruby-dir}/lib64

To see why this extension failed to compile, please check the mkmf.log which can be found here:

/usr/lib64/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0/debase-0.2.2.beta9/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/lib64/ruby/gems/2.3.0/gems/debase-0.2.2.beta9 for inspection.
Results logged to /usr/lib64/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0/debase-0.2.2.beta9/gem_make.out
/usr/lib64/ruby/2.3.0/rubygems/ext/builder.rb:92:in `run'
/usr/lib64/ruby/2.3.0/rubygems/ext/ext_conf_builder.rb:37:in `block in build'
/usr/lib64/ruby/2.3.0/tempfile.rb:295:in `open'
/usr/lib64/ruby/2.3.0/rubygems/ext/ext_conf_builder.rb:20:in `build'
/usr/lib64/ruby/2.3.0/rubygems/ext/builder.rb:164:in `block (2 levels) in build_extension'
/usr/lib64/ruby/2.3.0/rubygems/ext/builder.rb:163:in `chdir'
/usr/lib64/ruby/2.3.0/rubygems/ext/builder.rb:163:in `block in build_extension'
/usr/lib64/ruby/2.3.0/rubygems/ext/builder.rb:162:in `synchronize'
/usr/lib64/ruby/2.3.0/rubygems/ext/builder.rb:162:in `build_extension'
/usr/lib64/ruby/2.3.0/rubygems/ext/builder.rb:201:in `block in build_extensions'
/usr/lib64/ruby/2.3.0/rubygems/ext/builder.rb:198:in `each'
/usr/lib64/ruby/2.3.0/rubygems/ext/builder.rb:198:in `build_extensions'
/usr/lib64/ruby/2.3.0/rubygems/installer.rb:742:in `build_extensions'
/usr/lib64/ruby/2.3.0/rubygems/installer.rb:291:in `install'
/usr/lib64/ruby/2.3.0/rubygems/request_set.rb:167:in `block in install'
/usr/lib64/ruby/2.3.0/rubygems/request_set.rb:151:in `each'
/usr/lib64/ruby/2.3.0/rubygems/request_set.rb:151:in `install'
/usr/lib64/ruby/2.3.0/rubygems/dependency_installer.rb:405:in `install'
mkrf_conf.rb:35:in `rescue in <main>'
mkrf_conf.rb:28:in `<main>'

rake failed, exit code 1

Gem files will remain installed in /usr/lib64/ruby/gems/2.3.0/gems/ruby-debug-ide-0.6.0 for inspection.
Results logged to /usr/lib64/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0/ruby-debug-ide-0.6.0/gem_make.out

但是当我尝试添加建议的参数时,我得到:

ytg@yui:~> sudo /usr/bin/ruby.ruby2.3 /usr/bin/gem install ruby-debug-ide --with-ruby-include="/usr/include/ruby-2.3.0/"
ERROR: While executing gem ... (OptionParser::InvalidOption)
invalid option: --with-ruby-include=/usr/include/ruby-2.3.0/
/usr/lib64/ruby/2.3.0/rubygems/command.rb:378:in `handle_options'
/usr/lib64/ruby/2.3.0/rubygems/command.rb:299:in `invoke_with_build_args'
/usr/lib64/ruby/2.3.0/rubygems/command_manager.rb:169:in `process_args'
/usr/lib64/ruby/2.3.0/rubygems/command_manager.rb:139:in `run'
/usr/lib64/ruby/2.3.0/rubygems/gem_runner.rb:55:in `run'
/usr/bin/gem:21:in `<main>'

有没有办法让 gem install 识别那些头文件?

最佳答案

您必须使用 -- 将构建标志与选项分开。

来自help page : (gem install --help)

Usage

gem install GEMNAME [GEMNAME ...] [options] -- --build-flags [options]

稍后:

Extension Install Failures

If an extension fails to compile during gem installation the gem specification is not written out, but the gem remains unpacked in the repository. You may need to specify the path to the library’s headers and libraries to continue. You can do this by adding a -- between RubyGems' options and the extension's build options:

$ gem install some_extension_gem
[build fails]
Gem files will remain installed in /path/to/gems/some_extension_gem-1.0 for inspection.
Results logged to /path/to/gems/some_extension_gem-1.0/gem_make.out

$ gem install some_extension_gem -- --with-extension-lib=/path/to/lib
[build succeeds]

关于ruby - 如何将 `--with-ruby-include` 之类的构建标志传递给 gem 安装?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41120566/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com