So I am installing Redmine and after installing all the prerequisites, the next step was (my home is /home/sbh/)
/home/sbh/SW/Ruby/dev/execprefix/bin/bundle install --path vendor/bundle --without development test
which resulted in (several) erros such as;
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.
(I use vendor/bundle because I'm trying to keep the Ruby stuff dealing with redmine local - if I understand gem help install correctly) So I try this;
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
I did check that that location is not good, even the lowest folder doesn't exist, i.e. (no /include/);
sbh@sbh-MacBookPro ~ $ ls /home/sbh/SW/Ruby/dev/execprefix/lib/ruby/
2.4.0 gems site_ruby vendor_ruby
Also the make check succeeded in the build of Ruby from the svn (I understand this to be the dev branch and so I don't see why I would need to apt-get install any ruby-devs);
svn co https://svn.ruby-lang.org/repos/ruby/trunk ruby
So I did this;
find . -name ruby.h -print -exec ls -Alrt {} \;
resulting in four files;
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
I don't know why there are four, or two judging by the size, though I don't see them as links...(?) So I added to ~/.profile, at the bottom;
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/
and then ran sudo ldconfig and source ~/.profile. But it still didn't work after closing out terminal and starting it again.
Internet resulted in these ideas;
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)
but they all seem to want the OP to sudo apt-get install ruby-dev, and I only want to work off my 'local tree' - so no apt-get.
Shouldn't this be super simple? Or does Redmine somehow expect a certain path for these header files? Something maybe hardcoded for a default Ruby install?
Any ideas?
P.S. I want a 'local' build of Ruby much like Anaconda/Python...
P.P.S. I also realize that I could also use apt-get to only download the package to the archive, then use either dpkg or ar to extract the files, and then move them somewhere into my Ruby installation (I suppose a path too), but without adding any new PPAs, my default sources only cover up to ruby2.3-dev and my svn pulled 2.4. I don't know if there is any difference but I don't see why I can't get everything from ruby-lang.org...
P.P.P.S. When building Ruby, I put everything here;
./configure --prefix=/home/sbh/SW/Ruby/dev/prefix
--exec-prefix=/home/sbh/SW/Ruby/dev/execprefix
--oldincludedir=/home/sbh/SW/Ruby/dev/oldincludedir