ruby.h 尽管检查成功,但仍未找到库;在构建redmine时
ruby.h library(ies) not found despite make check success; when building redmine
所以我正在安装 Redmine,在安装所有先决条件之后,下一步是(我的家是 /home/sbh/)
/home/sbh/SW/Ruby/dev/execprefix/bin/bundle install --path vendor/bundle --without development test
这导致了(几个)错误,例如;
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/sbh/SW/Redmine/redmine/vendor/bundle/ruby/2.4.0
/gems/sqlite3-1.3.11/ext/sqlite3
/home/sbh/SW/Ruby/dev/execprefix/bin/ruby -r
./siteconf20160904-12703-1l1dktl.rb extconf.rb
mkmf.rb can't find header files for ruby at /home/sbh/SW/Ruby
/dev/execprefix/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /home/sbh/SW/Redmine/redmine/vendor
/bundle/ruby/2.4.0/gems/sqlite3-1.3.11 for inspection.
Results logged to /home/sbh/SW/Redmine/redmine/vendor/bundle/ruby/2.4.0
/extensions/x86_64-linux/2.4.0-static/sqlite3-1.3.11/gem_make.out
An error occurred while installing json (1.8.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.3'` succeeds before bundling.
(我使用 vendor/bundle 因为我试图将处理 redmine 的 Ruby 东西保留在本地 - 如果我理解 gem 有助于正确安装)所以我试试这个;
sbh@sbh-laptop-M18 ~/SW/Redmine/redmine $ /home/sbh/SW/Ruby
/dev/execprefix/bin/gem install json -v '1.8.3'
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
current directory: /home/sbh/SW/Ruby/dev/execprefix/lib/ruby/gems/2.4.0
/gems/json-1.8.3/ext/json/ext/generator
/home/sbh/SW/Ruby/dev/execprefix/bin/ruby -r
./siteconf20160904-13928-17xfuw8.rb extconf.rb
mkmf.rb can't find header files for ruby at /home/sbh/SW/Ruby
/dev/execprefix/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /home/sbh/SW/Ruby/dev/execprefix
/lib/ruby/gems/2.4.0/gems/json-1.8.3 for inspection.
Results logged to /home/sbh/SW/Ruby/dev/execprefix/lib/ruby/gems/2.4.0
/extensions/x86_64-linux/2.4.0-static/json-1.8.3/gem_make.out
我确实检查过那个位置不好,连最低的文件夹都不存在,即(没有/include/);
sbh@sbh-MacBookPro ~ $ ls /home/sbh/SW/Ruby/dev/execprefix/lib/ruby/
2.4.0 gems site_ruby vendor_ruby
make check 也成功地从 svn 构建了 Ruby(我知道这是 dev b运行ch 所以我不明白为什么我需要 apt-get install any ruby-devs);
svn co https://svn.ruby-lang.org/repos/ruby/trunk ruby
所以我这样做了;
find . -name ruby.h -print -exec ls -Alrt {} \;
产生四个文件;
sbh@sbh-laptop-M18 ~/SW/Ruby $ find . -name ruby.h -print -exec ls
-Alrt {} \;
./dev/ruby/include/ruby.h
-rw-r--r-- 1 sbh sbh 868 Sep 4 20:29 ./dev/ruby/include/ruby.h
./dev/ruby/include/ruby/ruby.h
-rw-r--r-- 1 sbh sbh 77600 Sep 4 20:29 ./dev/ruby/include/ruby/ruby.h
./dev/prefix/include/ruby-2.4.0/ruby.h
-rw-r--r-- 1 sbh sbh 868 Sep 4 20:29 ./dev/prefix/include/ruby-
2.4.0/ruby.h
./dev/prefix/include/ruby-2.4.0/ruby/ruby.h
-rw-r--r-- 1 sbh sbh 77600 Sep 4 20:29 ./dev/prefix/include/ruby-
2.4.0/ruby/ruby.h
我不知道为什么有四个,或者两个从大小来看,虽然我不认为它们是链接...(?) 所以我添加到 ~/.profile ,在底部;
export LD_LIBRARY_PATH=/home/sbh/SW/Ruby/dev/prefix/include/ruby-
2.4.0/ruby/
export LD_LIBRARY_PATH=/home/sbh/SW/Ruby/dev/ruby/include/ruby/
然后 运行 sudo ldconfig 和 source ~/.profile。但是关闭terminal再启动还是不行
互联网产生了这些想法;
Error while installing json gem 'mkmf.rb can't find header files for ruby',
nokogiri will not install - ERROR: Failed to build gem native extension,
`require': no such file to load -- mkmf (LoadError)
但他们似乎都希望 OP sudo apt-get install ruby-dev,而我只想完成我的 'local tree' - 所以没有 apt-get。
这不是应该超级简单吗?或者 Redmine 是否以某种方式期望这些头文件的特定路径?默认 Ruby 安装可能硬编码了一些东西?
有什么想法吗?
P.S。我想要一个 'local' 构建的 Ruby 很像 Anaconda/Python...
P.P.S。我还意识到我也可以使用 apt-get 只将包下载到存档中,然后使用 dpkg 或 ar 提取文件,然后将它们移动到我的 Ruby 安装的某个地方(我想也是一个路径),但没有添加任何新的 PPA,我的默认源仅涵盖 ruby2.3-dev,而我的 svn 拉到了 2.4。我不知道是否有任何区别,但我不明白为什么我无法从 ruby-lang.org...
获得所有内容
P.P.P.S。建Ruby的时候,我把所有东西都放在这里了;
./configure --prefix=/home/sbh/SW/Ruby/dev/prefix
--exec-prefix=/home/sbh/SW/Ruby/dev/execprefix
--oldincludedir=/home/sbh/SW/Ruby/dev/oldincludedir
您正在使用 the new-and-shiny 2.4.0。
最近搞到一个"unified Integer type",把BigDecimal和Fixnum合并成Integer
您的项目依赖于 the json rubygem,它也是基于 C 的扩展。 json gem v1.8.3 不知道处理数字的新方法。
这里是如何要求 json gem 的更新版本:
在您的 Gemfile 中,添加:
gem 'json', '~> 2.0', '>= 2.0.2'
(可以读作"at least the 2.0.x series",也可以读作"at least 2.0.2"。)
希望对您有所帮助!
PS:Here is a typical patch 将基于 C 的扩展更新为这种处理数字的新方式。
PPS:解决方法是使用 ruby-build 并为自己构建一个 Ruby 2.3.1,它将支持 Redmine 将安装的 gem 版本默认。
所以我正在安装 Redmine,在安装所有先决条件之后,下一步是(我的家是 /home/sbh/)
/home/sbh/SW/Ruby/dev/execprefix/bin/bundle install --path vendor/bundle --without development test
这导致了(几个)错误,例如;
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/sbh/SW/Redmine/redmine/vendor/bundle/ruby/2.4.0
/gems/sqlite3-1.3.11/ext/sqlite3
/home/sbh/SW/Ruby/dev/execprefix/bin/ruby -r
./siteconf20160904-12703-1l1dktl.rb extconf.rb
mkmf.rb can't find header files for ruby at /home/sbh/SW/Ruby
/dev/execprefix/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /home/sbh/SW/Redmine/redmine/vendor
/bundle/ruby/2.4.0/gems/sqlite3-1.3.11 for inspection.
Results logged to /home/sbh/SW/Redmine/redmine/vendor/bundle/ruby/2.4.0
/extensions/x86_64-linux/2.4.0-static/sqlite3-1.3.11/gem_make.out
An error occurred while installing json (1.8.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.3'` succeeds before bundling.
(我使用 vendor/bundle 因为我试图将处理 redmine 的 Ruby 东西保留在本地 - 如果我理解 gem 有助于正确安装)所以我试试这个;
sbh@sbh-laptop-M18 ~/SW/Redmine/redmine $ /home/sbh/SW/Ruby
/dev/execprefix/bin/gem install json -v '1.8.3'
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
current directory: /home/sbh/SW/Ruby/dev/execprefix/lib/ruby/gems/2.4.0
/gems/json-1.8.3/ext/json/ext/generator
/home/sbh/SW/Ruby/dev/execprefix/bin/ruby -r
./siteconf20160904-13928-17xfuw8.rb extconf.rb
mkmf.rb can't find header files for ruby at /home/sbh/SW/Ruby
/dev/execprefix/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /home/sbh/SW/Ruby/dev/execprefix
/lib/ruby/gems/2.4.0/gems/json-1.8.3 for inspection.
Results logged to /home/sbh/SW/Ruby/dev/execprefix/lib/ruby/gems/2.4.0
/extensions/x86_64-linux/2.4.0-static/json-1.8.3/gem_make.out
我确实检查过那个位置不好,连最低的文件夹都不存在,即(没有/include/);
sbh@sbh-MacBookPro ~ $ ls /home/sbh/SW/Ruby/dev/execprefix/lib/ruby/
2.4.0 gems site_ruby vendor_ruby
make check 也成功地从 svn 构建了 Ruby(我知道这是 dev b运行ch 所以我不明白为什么我需要 apt-get install any ruby-devs);
svn co https://svn.ruby-lang.org/repos/ruby/trunk ruby
所以我这样做了;
find . -name ruby.h -print -exec ls -Alrt {} \;
产生四个文件;
sbh@sbh-laptop-M18 ~/SW/Ruby $ find . -name ruby.h -print -exec ls
-Alrt {} \;
./dev/ruby/include/ruby.h
-rw-r--r-- 1 sbh sbh 868 Sep 4 20:29 ./dev/ruby/include/ruby.h
./dev/ruby/include/ruby/ruby.h
-rw-r--r-- 1 sbh sbh 77600 Sep 4 20:29 ./dev/ruby/include/ruby/ruby.h
./dev/prefix/include/ruby-2.4.0/ruby.h
-rw-r--r-- 1 sbh sbh 868 Sep 4 20:29 ./dev/prefix/include/ruby-
2.4.0/ruby.h
./dev/prefix/include/ruby-2.4.0/ruby/ruby.h
-rw-r--r-- 1 sbh sbh 77600 Sep 4 20:29 ./dev/prefix/include/ruby-
2.4.0/ruby/ruby.h
我不知道为什么有四个,或者两个从大小来看,虽然我不认为它们是链接...(?) 所以我添加到 ~/.profile ,在底部;
export LD_LIBRARY_PATH=/home/sbh/SW/Ruby/dev/prefix/include/ruby-
2.4.0/ruby/
export LD_LIBRARY_PATH=/home/sbh/SW/Ruby/dev/ruby/include/ruby/
然后 运行 sudo ldconfig 和 source ~/.profile。但是关闭terminal再启动还是不行
互联网产生了这些想法;
Error while installing json gem 'mkmf.rb can't find header files for ruby',
nokogiri will not install - ERROR: Failed to build gem native extension,
`require': no such file to load -- mkmf (LoadError)
但他们似乎都希望 OP sudo apt-get install ruby-dev,而我只想完成我的 'local tree' - 所以没有 apt-get。
这不是应该超级简单吗?或者 Redmine 是否以某种方式期望这些头文件的特定路径?默认 Ruby 安装可能硬编码了一些东西?
有什么想法吗?
P.S。我想要一个 'local' 构建的 Ruby 很像 Anaconda/Python...
P.P.S。我还意识到我也可以使用 apt-get 只将包下载到存档中,然后使用 dpkg 或 ar 提取文件,然后将它们移动到我的 Ruby 安装的某个地方(我想也是一个路径),但没有添加任何新的 PPA,我的默认源仅涵盖 ruby2.3-dev,而我的 svn 拉到了 2.4。我不知道是否有任何区别,但我不明白为什么我无法从 ruby-lang.org...
获得所有内容P.P.P.S。建Ruby的时候,我把所有东西都放在这里了;
./configure --prefix=/home/sbh/SW/Ruby/dev/prefix
--exec-prefix=/home/sbh/SW/Ruby/dev/execprefix
--oldincludedir=/home/sbh/SW/Ruby/dev/oldincludedir
您正在使用 the new-and-shiny 2.4.0。
最近搞到一个"unified Integer type",把BigDecimal和Fixnum合并成Integer
您的项目依赖于 the json rubygem,它也是基于 C 的扩展。 json gem v1.8.3 不知道处理数字的新方法。
这里是如何要求 json gem 的更新版本:
在您的 Gemfile 中,添加:
gem 'json', '~> 2.0', '>= 2.0.2'
(可以读作"at least the 2.0.x series",也可以读作"at least 2.0.2"。)
希望对您有所帮助!
PS:Here is a typical patch 将基于 C 的扩展更新为这种处理数字的新方式。
PPS:解决方法是使用 ruby-build 并为自己构建一个 Ruby 2.3.1,它将支持 Redmine 将安装的 gem 版本默认。