Cannot find ruby.h file in system - ruby

Error installing cocoapods:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.3.0/gems/ffi-1.12.2/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20200330-8267-hpu1jf.rb extconf.rb
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/universal-darwin18/rbconfig.rb:215: warning: Insecure world writable dir /Library/Ruby/Gems/2.3.0 in PATH, mode 040777
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/ffi-1.12.2 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/ffi-1.12.2/gem_make.out
I am trying to download CocoaPods and this error is generatedThe system wasn't able to find ruby.h file but when I digged a little deep, I found out that there is no folder like include in the location specified(/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h). I even tried to manually add the folder but the system didn't give me permission for that even when I used sudo command.

Related

issue installing a gem

I've checked many other posts but I can't seem to find a solution, I get the same error each time I try to install this gem. I've tried reinstalling and even changing ruby versions (I tried my original 25 install then the latest 26 then 25), but nothing worked.
here's the log:
PS X:\Windows\system32> gem install solargraph
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
ERROR: Error installing solargraph:
ERROR: Failed to build gem native extension.
current directory: X:/Program Files (x86)/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jaro_winkler-1.5.4/ext/jaro_winkler
"X:/Program Files (x86)/Ruby25-x64/bin/ruby.exe" -r ./siteconf20191204-11892-whysdy.rb extconf.rb
creating Makefile
current directory: X:/Program Files (x86)/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jaro_winkler-1.5.4/ext/jaro_winkler
make "DESTDIR=" clean
Makefile:267: *** multiple target patterns. Stop.
current directory: X:/Program Files (x86)/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jaro_winkler-1.5.4/ext/jaro_winkler
make "DESTDIR="
Makefile:267: *** multiple target patterns. Stop.
make failed, exit code 2
Gem files will remain installed in X:/Program Files (x86)/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jaro_winkler-1.5.4 for inspection.
Results logged to X:/Program Files (x86)/Ruby25-x64/lib/ruby/gems/2.5.0/extensions/x64-mingw32/2.5.0/jaro_winkler-1.5.4/gem_make.out
Ruby was installed in Program Files (x86) which contains a space, which apparently MINGW gems, such as jaro_winkler, don't agree with, so if you encounter this issue change your Ruby install location.

rubocop gem install gives ERROR: Failed to build native gem extension

I recently installed Ruby from http://railsinstaller.org/en.
This included Ruby on Rails and the Ruby dev-kit.
Now I am trying to install rubocop, but it isn't working:
C:\Windows\System32>gem install rubocop
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
The system cannot find the path specified.
ERROR: Error installing rubocop:
ERROR: Failed to build gem native extension.
current directory: C:/_Programming/Ruby/Installation/RailsInstaller/Ruby2.3.
0/lib/ruby/gems/2.3.0/gems/rainbow-2.2.2/ext
C:/_Programming/Ruby/Installation/RailsInstaller/Ruby2.3.0/bin/ruby.exe mkrf_con
f.rb
rake failed, exit code 1
Gem files will remain installed in C:/_Programming/Ruby/Installation/RailsInstal
ler/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/rainbow-2.2.2 for inspection.
Results logged to C:/_Programming/Ruby/Installation/RailsInstaller/Ruby2.3.0/lib
/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/rainbow-2.2.2/gem_make.out
C:\Windows\System32>echo %path%
C:\ProgramData\Oracle\Java\javapath;C:\_Programming\Install\Python27\;C:\_Progra
mming\Install\Python27\Scripts;C:\Program Files (x86)\Borland\Delphi7\Bin;C:\Pro
gram Files (x86)\Borland\Delphi7\Projects\Bpl\;C:\Program Files (x86)\Embarcader
o\Studio\16.0\bin;C:\Users\Public\Documents\Embarcadero\Studio\16.0\Bpl;C:\Progr
am Files (x86)\Embarcadero\Studio\16.0\bin64;C:\Users\Public\Documents\Embarcade
ro\Studio\16.0\Bpl\Win64;C:\Ruby193\bin;C:\Windows\System32;C:\Program Files (x8
6)\Borland\Delphi5\Bin;Q:\;C:\Windows\System32\Windows System Resource Manager\b
in;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;
C:\Program Files (x86)\Extra!\;C:\HashiCorp\Vagrant\bin;C:\_Programming\Ruby\Ins
tallation\RailsInstaller\Ruby2.3.0\bin;C:\Windows\system32\16.0\Bpl;C:\Program F
iles\Git\cmd

ruby.h library(ies) not found despite make check success; when building redmine

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
You're using the new-and-shiny 2.4.0.
It recently got a "unified Integer type", which combined BigDecimal and Fixnum into Integer.
Your project relies on the json rubygem, which is also a C-based extension. The json gem v1.8.3 doesn't know about the new way of handling numbers.
Here's how to demand a newer version of the json gem:
In your Gemfile, add:
gem 'json', '~> 2.0', '>= 2.0.2'
(That can be read as "at least the 2.0.x series", and also "at least 2.0.2".)
Hope this helps!
PS: Here is a typical patch which updates a C-based extension to this new way of handling numbers.
PPS: A workaround is to use ruby-build and build yourself a Ruby 2.3.1, which will support the gem versions that Redmine would install by default.

Guide to installing ta-lib on Windows for Ruby gem

I have tried for quite a while to install ta-lib so I can use some of the indicator functions for trading based on this github example. So far I have determined that I need to:
run gem install talib_ruby
C:\Users\king\Desktop\_REPOS\misc\stock_analysis\forex\oanda\ruby>gem install talib_ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing talib_ruby:
ERROR: Failed to build gem native extension.
C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20160810-7176-j5lye2.rb extconf.rb
checking for TA_Initialize() in -lta_lib... no
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
generating talib-x64-mingw32.def
compiling talib.c
talib.c:2:32: fatal error: ta-lib/ta_abstract.h: No such file or directory
compilation terminated.
make: *** [talib.o] Error 1
make failed, exit code 2
....
Download ta-lib header files which are in the msvc from here
Tell the talib_ruby gem where the ta-lib files when installing. Based on this SO post the correct command should look something like: sudo env ARCHFLAGS="-arch x86_64" gem install talib_ruby -- --with-talib-include=/opt/local/var/macports/software/ta-lib/0.4.0_0/opt/local/include/ta-lib --with-talib-lib=/opt/local/var/macports/software/ta-lib/0.4.0_0/opt/local/lib
. The command specifies a path to a lib folder which is missing from the ta-lib I downloaded. Does anyone know how to fix this?
Windows?
Sorry for my english.
My system: Windows 7 SP1 x64, ruby 2.2.4p230
You have to install Ruby Development Kit to build the binary extensions.
Download and extract source, I used ta-lib-0.4.0-src.tar.gz.
Run msys.bat from Ruby DevKit or if you have installed mingw as part of RubyInstaller, run either mingw64.exe or ming32.exe. Navigate to ta-lib source files (in my case it is /d/dev/ta-lib) and build the library:
cd /d/dev/ta-lib
./configure
make
Because the path to C headers hardcoded in gem to #include <ta-lib/ta_abstract.h>, I just make a new directory ta-lib within d:\dev\ta-lib\include source folder and all copy header files here. (Files in d:\dev\ta-lib\include*.h are copied to d:\dev\ta-lib\include\ta-lib)
Install gem. Exit the msys or mingw terminal and run the following in your Windows cmd. Be sure to replace these paths with the correct path to your ta-lib source:
gem install talib_ruby -- --with-talib-include=d:/dev/ta-lib/include --with-talib-lib=d:/dev/ta-lib/src/.libs
Make sure to change paths to yours.

Issue installing caldecott, make inoperable command

I've been trying to install this for a few days now with no success. Looking for help, I've been through this site a half dozen times to try and resolve the issue but I'm not having any luck.
c:\Ruby193\DevKit>gem install caldecott --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing caldecott:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile
make
'make' is not recognized as an internal or external command,
operable program or batch file.
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/escape_ut
ils-0.3.2 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/escape_utils-0.3.2/ext/esc
ape_utils/gem_make.out
I've attempted to follow the instructions on this post
-Make Is Not Recognized as an internal or exernal command
By Doing this:
c:\Ruby193>set make=mingw32-make
I unfortunately still get:
c:\Ruby193>gem install caldecott --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing caldecott:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile
mingw32-make
'mingw32-make' is not recognized as an internal or external command,
operable program or batch file.
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/escape_ut
ils-0.3.2 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/escape_utils-0.3.2/ext/esc
ape_utils/gem_make.out
I've also done:
c:\Ruby193\DevKit>gem install eventmachine --pre
As discussed here.
-Error Installing Caldecott
HALP!!! What am I doing wrong?
Windows 7
Running CMD as Admin
Ruby v1.9.3
DevKit - installed, in Ruby Folder, and postinstall ran
Update:
I've attempted to create my own match.bat file in the c:/ruby193/devkit/mingw/bin that should forward the make command to mingw32-make, still successful but here is my code for the batch (match.bat) file.
#echo off
mingw32-make %*
As explained on this forum.
-make.bat
Still no luck, I'll likely continue to roll my face on the keyboard until I find a solution.
Can you try to install without platform arugment, simply this command
$ gem install caldecott
what error you get now?

Resources