Installation of jekyll on macOS Sierra fails - ruby

I'm trying to install jekyll on macOS with following versions and xcode command line tools installed with ruby 2.4.0p0 and gem 2.6.10
installing jekyll and bundler
gem install jekyll bundler
the result of the command is
Fetching: public_suffix-2.0.5.gem (100%)
Successfully installed public_suffix-2.0.5
Fetching: addressable-2.5.0.gem (100%)
Successfully installed addressable-2.5.0
Fetching: colorator-1.1.0.gem (100%)
Successfully installed colorator-1.1.0
Fetching: sass-3.4.23.gem (100%)
Successfully installed sass-3.4.23
Fetching: jekyll-sass-converter-1.5.0.gem (100%)
Successfully installed jekyll-sass-converter-1.5.0
Fetching: rb-fsevent-0.9.8.gem (100%)
Successfully installed rb-fsevent-0.9.8
Fetching: ffi-1.9.17.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/2.4.0/gems/ffi-1.9.17/ext/ffi_c
/usr/local/opt/ruby/bin/ruby -r ./siteconf20170303-1307-1slrb61.rb extconf.rb
checking for ffi.h... *** 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
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/Cellar/ruby/2.4.0/bin/$(RUBY_BASE_NAME)
--with-ffi_c-dir
--without-ffi_c-dir
--with-ffi_c-include
--without-ffi_c-include=${ffi_c-dir}/include
--with-ffi_c-lib
--without-ffi_c-lib=${ffi_c-dir}/lib
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
/usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:457:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:588:in `try_cpp'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:1095:in `block in have_header'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:945:in `block in checking_for'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:321:in `open'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:351:in `block in postpone'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:321:in `open'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:347:in `postpone'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:944:in `checking_for'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:1094:in `have_header'
from extconf.rb:16:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0/ffi-1.9.17/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /usr/local/lib/ruby/gems/2.4.0/gems/ffi-1.9.17 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0/ffi-1.9.17/gem_make.out
Fetching: bundler-1.14.5.gem (100%)
Successfully installed bundler-1.14.5
Parsing documentation for bundler-1.14.5
Installing ri documentation for bundler-1.14.5
Done installing documentation for bundler after 4 seconds
1 gem installed
contents of log file mkmf.log
package configuration for libffi is not found
"clang -o conftest -I/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0/x86_64-darwin16 -I/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0/ruby/backward -I/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0 -I. -I/usr/local/opt/libyaml/include -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -fno-common -pipe conftest.c -L. -L/usr/local/Cellar/ruby/2.4.0/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -lruby.2.4.0 -lpthread -ldl -lobjc "
2017-03-03 09:09 xcodebuild[1311] (FSEvents.framework) FSEventStreamStart: ERROR: FSEvents_connect() => (ipc/send) invalid destination port (268435459)
2017-03-03 09:09 xcodebuild[1311] (FSEvents.framework) FSEventStreamInvalidate(): failed assertion 'streamRef != NULL'
2017-03-03 09:09 xcodebuild[1311] (FSEvents.framework) FSEventStreamRelease(): failed assertion 'streamRef != NULL'
2017-03-03 09:09:01.029 xcodebuild[1311:92957] DVTFilePathFSEvents: Failed to start fs event stream.
sh: line 1: 1313 Abort trap: 6 /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk / -find clang 2> /dev/null
clang: error: unable to find utility "clang", not a developer tool or in PATH
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */

i looked for solutions to fix clang: error: unable to find utility "clang", not a developer tool or in PATH
and found out that Xcode couldn't find its own Command Line Tools.
This link fixed it for me.

Related

Nokogiri fails install on Ubuntu 20.04

I am attempting to install the Nokogiri gem for use with Ruby on Rails, but I cannot get it to build no matter which packages I install. I am running Ubuntu 20.04.
I have installed all the packages from this guide on the Nokogiri website (https://nokogiri.org/tutorials/installing_nokogiri.html):
sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev
gem install nokogiri
I am using RVM, so I have also installed the libgmp-dev package, which the above tutorial also recommends.
While searching for other solutions, I have also installed the following packages:
sudo apt-get install gcc ruby-dev libxslt-dev libxml2-dev zlib1g-dev
Ruby Version: 2.7.1
RVM Version: 1.29.10
Gem Version: 3.1.2
gem_make.out
current directory: /home/dan/.rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/ext/nokogiri
/usr/share/rvm/rubies/ruby-2.7.1/bin/ruby -I /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0 -r ./siteconf20200924-8532-1t7wwwh.rb extconf.rb
checking if the C compiler accepts ... *** 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}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/share/rvm/rubies/ruby-2.7.1/bin/$(RUBY_BASE_NAME)
--help
--clean
/usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/mkmf.rb:471:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/mkmf.rb:597:in `block in try_compile'
from /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/mkmf.rb:544:in `with_werror'
from /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/mkmf.rb:597:in `try_compile'
from extconf.rb:138:in `nokogiri_try_compile'
from extconf.rb:162:in `block in add_cflags'
from /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/mkmf.rb:655:in `with_cflags'
from extconf.rb:161:in `add_cflags'
from extconf.rb:416:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/dan/.rvm/gems/ruby-2.7.1/extensions/x86_64-linux/2.7.0/nokogiri-1.10.10/mkmf.log
extconf failed, exit code 1
mkmf.log
"gcc -o conftest -I/usr/share/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/x86_64-linux -I/usr/share/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby/backward -I/usr/share/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0 -I. -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -fPIC conftest.c -L. -L/usr/share/rvm/rubies/ruby-2.7.1/lib -Wl,-rpath,/usr/share/rvm/rubies/ruby-2.7.1/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-rpath,'/../lib' -Wl,-rpath,'/../lib' -lruby -lm -lc "
gcc: error: unrecognized command line option '-Wduplicated-cond'
gcc: error: unrecognized command line option '-Wmisleading-indentation'
gcc: error: unrecognized command line option '-Wimplicit-fallthrough=0'
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return !!argv[argc];
6: }
/* end */
Any help would be much appreciated.
You have to do a full compile of Ruby 2.7.x in order to get nokogiri 1.10.10 to install on Ubuntu 20.04.
For a clean install run:
rvm install 2.7 --disable-binary
To reinstall your existing ruby version use:
rvm reinstall 2.7 --disable-binary
Ubuntu 20.04. Ruby 2.7.1.
Changing rvm to rbenv was fixed this error.
I reinstalled Ubuntu 20.04 fresh along with Ruby etc, and it worked. I don't know what went wrong, and I don't know if any of the solutions below will work.
I add the same problem. On this environment :
ubuntu 20.04 LTS
ruby 2.7.0
gem 3.1.2
bundler 2.1.4,
the steps described here https://mrtan.me/post/34.html/ worked for me :
sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev
gem install nokogiri
bundle
Can confirm. Going to rbenv worked for me as well.

How to install Jekyll on Debian

I'm following the "Jekyll on Debian" directions step-by-step for installing Jekyll on my Debian 10.1:
sudo apt-get install ruby-full build-essential zlib1g-dev
echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc
echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
gem install jekyll bundler
but it doesn't work. Here is the output:
$ gem install jekyll bundler
Building native extensions. This could take a while...
/usr/lib/ruby/2.5.0/rubygems/ext/builder.rb:76: warning: Insecure world writable dir /srv/dev-disk-by-label-data/home/mark/gems/bin in PATH, mode 040777
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
current directory: /srv/dev-disk-by-label-data/home/mark/gems/gems/eventmachine-1.2.7/ext
/usr/bin/ruby2.5 -r ./siteconf20200102-7165-18dxplz.rb extconf.rb
*** 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}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/$(RUBY_BASE_NAME)2.5
--with-ssl-dir
--without-ssl-dir
--with-ssl-include
--without-ssl-include=${ssl-dir}/include
--with-ssl-lib
--without-ssl-lib=${ssl-dir}/lib
--with-openssl-config
--without-openssl-config
--with-pkg-config
--without-pkg-config
/usr/lib/ruby/2.5.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/lib/ruby/2.5.0/mkmf.rb:541:in `try_link0'
from /usr/lib/ruby/2.5.0/mkmf.rb:559:in `try_link'
from /usr/lib/ruby/2.5.0/mkmf.rb:661:in `try_ldflags'
from /usr/lib/ruby/2.5.0/mkmf.rb:1821:in `pkg_config'
from extconf.rb:65:in `pkg_config_wrapper'
from extconf.rb:92:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/srv/dev-disk-by-label-data/home/mark/gems/extensions/x86-linux/2.5.0/eventmachine-1.2.7/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /srv/dev-disk-by-label-data/home/mark/gems/gems/eventmachine-1.2.7 for inspection.
Results logged to /srv/dev-disk-by-label-data/home/mark/gems/extensions/x86-linux/2.5.0/eventmachine-1.2.7/gem_make.out
Successfully installed bundler-2.1.3
Parsing documentation for bundler-2.1.3
Done installing documentation for bundler after 19 seconds
1 gem installed
and here is the log file:
"gcc -o conftest -I/usr/include/i386-linux-gnu/ruby-2.5.0 -I/usr/include/ruby-2.5.0/ruby/backward -I/usr/include/ruby-2.5.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64 -g -O2 -fdebug-prefix-map=/build/ruby2.5-qqUyFd/ruby2.5-2.5.5=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c -L. -L/usr/lib/i386-linux-gnu -L. -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -lruby-2.5 -lpthread -lgmp -ldl -lcrypt -lm -lc"
/usr/lib/ruby/2.5.0/mkmf.rb:395: warning: Insecure world writable dir /srv/dev-disk-by-label-data/home/marcotrapanese/gems/bin in PATH, mode 040777
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
"pkg-config --exists openssl"
| pkg-config --libs openssl
=> "-lssl -lcrypto\n"
The warning about the permissions on the gems/bin folder is weird, because it was created by the installer, not by me.
It says "You have to install development tools first", but I've already installed them. Furthermore the error message doesn't tell what it thinks is missing.
Why does following such a simple procedure fail?

Gem mysql2 installation error on ruby1.9.3

Just updated to macOS Mojave, reinstalled mysql via brew & downloaded latest xcode 9.2 . While triying to setup a development enviroment for an old rails project, bundle crashes on installation of mysql2 gem. In the beggining i thought it was because latest mysql2 version, is not compatible with ruby 1.9 so i tried:
gem install mysql2 -v '0.3.17'
and i received:
/Users/me/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
checking for ruby/thread.h... * 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
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/me/.rvm/rubies/ruby-1.9.3-p125/bin/ruby
/Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:381:in try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:506:intry_cpp'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:931:in block in have_header'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:790:inblock in checking_for'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:284:in block (2 levels) in postpone'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:254:inopen'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:284:in block in postpone'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:254:inopen'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:280:in postpone'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:789:inchecking_for'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:930:in have_header'
from extconf.rb:9:in'
copy from /Users/me/.rvm/gems/ruby-1.9.3-p125#mailcatcher/gems/mysql2-0.2.18/ext/mysql2/mkmf.log:
"/usr/bin/gcc-4.2 -o conftest -I/Users/me/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/x86_64-darwin10.8.0 -I/Users/me/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/ruby/backward -I/Users/me/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1 -I. -I/Users/me/.rvm/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -fno-common -pipe conftest.c -L. -L/Users/me/.rvm/rubies/ruby-1.9.3-p125/lib -L/Users/me/.rvm/usr/lib -L. -L/usr/local/lib -lruby.1.9.1 -lpthread -ldl -lobjc "
checked program was:
/* begin /
1: #include "ruby.h"
2:
3: int main() {return 0;}
/ end */
It sounds like you're either missing the XCode command line tools:
xcode-select --install
Or mySQL packages:
If you don't already have homebrew:
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then to install mysql:
brew install mysql
I can't remember which solved this issue for me in the past but I'm sure it was one of them.
Cross linking my answer to almost this exact same question. I think it might just be not finding the correct config path
sudo gem install mysql2 -- --with-mysql-config=/usr/local/bin/mysql_config
See the answer here
edit: formatting

cannot load such file -- sqlite3 (LoadError)

I'm a complete Ruby newbie. I'm trying to load the sqlite3 module. Here's the
entirety of my script:
#!/usr/bin/ruby -w
require 'sqlite3'
Running that command results in this output:
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- sqlite3 (LoadError)
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from ./sqlite.rb:2:in `<main>'
The go-to page for this problem seems to be this page. However, none of the solutions there help.
The most popular solution is to edit sqlite3's gemspec file. I can only find
one file on my system that looks like a gemspec file for sqlite3. It has the following rather odd path:
/home/terry/.gem/specs/api.rubygems.org%443/quick/Marshal.4.8/sqlite3-1.3.13.gemspec
The contents of that file look like this (word wrapped for reading):
;;F;U; [[[I"~>;TU;[I" 3.15;T0I"jamis#37signals.com;TI"luislavena#gmail.com;TI"
aaron#tenderlovemaking.com;TI"Jamis Buck;TI"Luis Lavena;TI"Aaron Patterson;TI"▒
This module allows Ruby programs to interface with the SQLite3 database engine
(http://www.sqlite.org). You must have the SQLite engine installed in order
to build this module.
Note that this module is only compatible with SQLite 3.6.16 or newer.;TI"
2https://github.com/sparklemotion/sqlite3-ruby;TT#[I" BSD-3;T
That doesn't match with anything like the stackoverflow page's description.
So I'm lost.
Here are some of my system specifications:
Ubuntu Linux 16.04.1
# sqlite3 -version
3.11.0 2016-02-15 17:29:24 3d862f207e3adc00f78066799ac5a8c282430a5f
# ruby --version
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
Let me know if there is other information I should post. Any help is appreciated. Thanks!
-- update --
In response to Amadan's suggestion, I tried the suggested command and got this result:
# gem install sqlite3
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /var/lib/gems/2.3.0 directory.
So I tried it with sudo and got this:
# sudo gem install sqlite3
[sudo] password for terry:
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/sqlite3-1.3.13/ext/sqlite3
/usr/bin/ruby2.3 -r ./siteconf20170308-16463-q46juc.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/sqlite3-1.3.13 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/gem_make.out
I checked that log file and it just has the same error.
-- another update --
On #maxple's suggestion, I installed ruby2.3-dev. That seemed to go well:
# sudo apt-get install ruby2.3-dev
[sudo] password for terry:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libgmp-dev libgmpxx4ldbl
Suggested packages:
gmp-doc libgmp10-doc libmpfr-dev
The following NEW packages will be installed:
libgmp-dev libgmpxx4ldbl ruby2.3-dev
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,357 kB of archives.
After this operation, 6,493 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://nyc2.mirrors.digitalocean.com/ubuntu xenial/main amd64 libgmpxx4ldbl amd64 2:6.1.0+dfsg-2 [8,948 B]
Get:2 http://nyc2.mirrors.digitalocean.com/ubuntu xenial/main amd64 libgmp-dev amd64 2:6.1.0+dfsg-2 [314 kB]
Get:3 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 ruby2.3-dev amd64 2.3.1-2~16.04 [1,034 kB]
Fetched 1,357 kB in 0s (3,228 kB/s)
Selecting previously unselected package libgmpxx4ldbl:amd64.
(Reading database ... 125914 files and directories currently installed.)
Preparing to unpack .../libgmpxx4ldbl_2%3a6.1.0+dfsg-2_amd64.deb ...
Unpacking libgmpxx4ldbl:amd64 (2:6.1.0+dfsg-2) ...
Selecting previously unselected package libgmp-dev:amd64.
Preparing to unpack .../libgmp-dev_2%3a6.1.0+dfsg-2_amd64.deb ...
Unpacking libgmp-dev:amd64 (2:6.1.0+dfsg-2) ...
Selecting previously unselected package ruby2.3-dev:amd64.
Preparing to unpack .../ruby2.3-dev_2.3.1-2~16.04_amd64.deb ...
Unpacking ruby2.3-dev:amd64 (2.3.1-2~16.04) ...
Processing triggers for libc-bin (2.23-0ubuntu5) ...
Setting up libgmpxx4ldbl:amd64 (2:6.1.0+dfsg-2) ...
Setting up libgmp-dev:amd64 (2:6.1.0+dfsg-2) ...
Setting up ruby2.3-dev:amd64 (2.3.1-2~16.04) ...
Processing triggers for libc-bin (2.23-0ubuntu5) ...
Then I attempted again to gem install sqlite3, and that didn't seem to go well:
# sudo gem install sqlite3
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/sqlite3-1.3.13/ext/sqlite3
/usr/bin/ruby2.3 -r ./siteconf20170308-16984-tcxs0x.rb extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'brew install sqlite3',
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
and check your shared library search path (the
location where your sqlite3 shared library is located).
*** 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}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/$(RUBY_BASE_NAME)2.3
--with-sqlite3-config
--without-sqlite3-config
--with-pkg-config
--without-pkg-config
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/sqlite3-1.3.13 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/gem_make.out
The log file mkmf.log has this:
package configuration for sqlite3 is not found
find_header: checking for sqlite3.h... -------------------- no
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c -L. -L/usr/lib/x86_64-linux-gnu -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -lruby-2.3 -lpthread -lgmp -ldl -lcrypt -lm -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
"gcc -E -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c -o conftest.i"
conftest.c:3:21: fatal error: sqlite3.h: No such file or directory
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <sqlite3.h>
/* end */
--------------------

Bundle Install Rsruby Fails, But Gem Install Succeeds

I have ruby2.2, ubuntu 14.04.4 LTS, and I want to install the rsruby gem. Everything is set up, and all my other gems are set up, with "sudo bundle install." But rsruby keeps crashing when I try to install it like that. How do I debug it and make it work?
I have a script I run which runs this command
sudo bundle config build.rsruby "--with-R-include=/usr/share/R/include --with_cflags=\"-fPIC -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wall -fno-strict-aliasing\""
Then I run "sudo bundle install" and it crashes on RSRuby:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby2.2 -r ./siteconf20161028-31919-l2ks0n.rb extconf.rb
--with-R-include=/usr/share/R/include --with_cflags=\"-fPIC -g -O2
-fstack-protector --param=ssp-buffer-size=4 -Wformat -Wall
-fno-strict-aliasing\"
checking for main() in -lR... *** 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.
from /usr/lib/ruby/2.2.0/mkmf.rb:541:in `try_link0'
from /usr/lib/ruby/2.2.0/mkmf.rb:556:in `try_link'
from /usr/lib/ruby/2.2.0/mkmf.rb:735:in `try_func'
from /usr/lib/ruby/2.2.0/mkmf.rb:992:in `block in find_library'
from /usr/lib/ruby/2.2.0/mkmf.rb:911:in `block in checking_for'
from /usr/lib/ruby/2.2.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /usr/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from /usr/lib/ruby/2.2.0/mkmf.rb:351:in `block in postpone'
from /usr/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from /usr/lib/ruby/2.2.0/mkmf.rb:347:in `postpone'
from /usr/lib/ruby/2.2.0/mkmf.rb:910:in `checking_for'
from /usr/lib/ruby/2.2.0/mkmf.rb:988:in `find_library'
from extconf.rb:15:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in
/var/lib/gems/2.2.0/bundler/gems/rsruby-e72a8dc61617 for inspection.
Results logged to
/var/lib/gems/2.2.0/bundler/gems/extensions/x86_64-linux/2.2.0/rsruby-e72a8dc61617/gem_make.out
An error occurred while installing rsruby (0.5.5), and Bundler cannot
continue.
But if I run
sudo gem install rsruby -- --with-R-dir=/usr/lib/R --with-R-include=/usr/share/R/include --with_cflags="-fPIC -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wall -fno-strict-aliasing"
Then it successfully installs
Fetching: rsruby-0.5.1.1.gem (100%)
Building native extensions with: '--with-R-dir=/usr/lib/R --with-R-include=/usr/share/R/include --with_cflags=-fPIC -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wall -fno-strict-aliasing'
This could take a while...
Successfully installed rsruby-0.5.1.1
Parsing documentation for rsruby-0.5.1.1
Installing ri documentation for rsruby-0.5.1.1
Done installing documentation for rsruby after 0 seconds
1 gem installed
SO, my question is, how do I debug this? And how do I get it working with bundle install? Thanks!
UPDATE, as matt pointed out in the comments, the version of the rsruby gem installed by the two commands was different. if i change my Gemfile to specify bundle to install version "0.5.1.1" then "sudo bundle install" installs successfully. however, i need version "0.5.5". my Gemfile is currently set up like this, "gem 'rsruby', github: 'custora/rsruby'" and must get version 0.5.5. so why would 0.5.1.1 install correctly, but not 0.5.5?
UPDATE, mkmf.log
gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.1.0 -I/usr/include/ruby-2.1.0/ruby/backward -I/usr/include/ruby-2.1.0 -I. -I/usr/share/R/include -D_FORTIFY_SOURCE=2 "-g conftest.c -L. -L/usr/lib/x86_64-linux-gnu -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -L/build/ruby2.1-3vrZnx/ruby2.1-2.1.9/debian/lib -fstack-protector -rdynamic -Wl,-export-dynamic -lruby-2.1 -lpthread -lgmp -ldl -lcrypt -lm -lc"
sh: 1: Syntax error: Unterminated quoted string
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
Okay so there were a few different things going on here. I will document them all here in case someone else who needs to use rsruby comes across this. First, as Matt pointed out, bundle install and gem install were trying to install two different versions of rsruby. Second, I had to change this script which I ran to set the bundle configuration options, this script did NOT work. To make this work, I replaced the \" with '
#!/bin/bash
# Does /usr/bin/gem link to /usr/bin/gem2.1 ?
# gem install bundler -v 1.6.0.rc2
sudo bundle config build.rsruby "--with-R-include=/usr/share/R/include --with-cflags=\"-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -fPIC\""
The above two steps made rsruby install. But after that I kept getting segfault errors anyway. The problem seems to have been either an old distro of ubuntu, or the fact that since it was an old distro of ubuntu, I had to use brightbox repo to get a more recent version of ruby. In any case, after updating to a current distro of linux which had a current version of ruby, it worked.

Resources