Can't Install Eventmachine On Synology DiskStation With OpenSSL - ruby

I'm trying to install the EventMachine ruby gem on my Synology DiskStation DS211 Linux-based NAS, but the installation fails while trying to create the Makefile for the native extension, saying:
> gem install eventmachine --pre
Building native extensions. This could take a while...
ERROR: Error installing eventmachine:
ERROR: Failed to build gem native extension.
/opt/bin/ruby extconf.rb
checking for main() in -lssl... *** 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.
The contents of mkmf.log:
package configuration for openssl is not found
Ruby and OpenSSL were both installed successfully on the machine using Optware ipkg to the default /opt directory.
I suspect that EventMachine fails due to OpenSSL being installed in an unexpected directory, but it is unclear which combination of configuration options and values are necessary to specify the correct location.
Some environment details:
> ruby -v
ruby 1.9.1p243 (2009-07-16 revision 24175) [arm-linux-eabi]
> openssl version
OpenSSL 0.9.8p 16 Nov 2010
> which openssl
/opt/bin/openssl
Has anyone else had any luck installing EventMachine in this environment?

You need install openssl-dev package:
ipkg install openssl-dev
openssl-dev contains package configuration(openssl.pc) and header files.

Related

Gem will not install sqlite3 despite sqlite3 being installed (Mac)

I'm trying to install Ruby (3.2.0) (and Rails [7.0.4]) on an Intel Mac (OS 12.6). I'm running into issues with sqlite3 — no surprise. My current error message is this:
package configuration for /usr/local/lib/ruby/gems/3.2.0/gems/sqlite3-1.5.4/ports/x86_64-apple-darwin21.6.0/sqlite3/3.40.0/lib/pkgconfig/sqlite3.pc is not found
When I enter gem install sqlite3 I get the following ugly error message:
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/3.2.0/gems/sqlite3-1.5.4/ext/sqlite3
/usr/local/opt/ruby/bin/ruby -I /usr/local/lib/ruby/site_ruby/3.2.0 extconf.rb
Building sqlite3-ruby using packaged sqlite3.
Extracting sqlite-autoconf-3400000.tar.gz into tmp/x86_64-apple-darwin21.6.0/ports/sqlite3/3.40.0... OK
Running 'configure' for sqlite3 3.40.0... OK
Running 'compile' for sqlite3 3.40.0... OK
Running 'install' for sqlite3 3.40.0... OK
Activating sqlite3 3.40.0 (from /usr/local/lib/ruby/gems/3.2.0/gems/sqlite3-1.5.4/ports/x86_64-apple-darwin21.6.0/sqlite3/3.40.0)...
Could not configure the build properly (pkg_config). Please install either the `pkg-config` utility or the `pkg-config` rubygem.
*** 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:
[insert long list of options...]
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/local/lib/ruby/gems/3.2.0/extensions/x86_64-darwin-21/3.2.0/sqlite3-1.5.4/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /usr/local/lib/ruby/gems/3.2.0/gems/sqlite3-1.5.4 for inspection.
Results logged to /usr/local/lib/ruby/gems/3.2.0/extensions/x86_64-darwin-21/3.2.0/sqlite3-1.5.4/gem_make.out
I've been through many iterations of solutions found across the interwebs (changing permissions, installing pkg-config per the error message, changing $PATH in .zshrc, installing sqlite binary packages, modifying the Gemfile, total uninstalls of both, and restarts) to no avail.
The Homebrew-installed sqlite3 is working properly. which sqlite3 produces
/usr/local/opt/sqlite3/bin/sqlite3
Happy to provide any more relevant information that's helpful. Any guidance appreciated!
If you do not have pkg-config installed, you should install to proceed
You can check it using:
$ which pkg-config
If not found, install it:
$ curl https://pkg-config.freedesktop.org/releases/pkg-config-0.28.tar.gz -o pkgconfig.tgz
$ tar -zxf pkgconfig.tgz && cd pkg-config-0.28
$ ./configure && make install
I'm just following this page

What does XCode installing do when solving 'gem install sqilte3' error(Failed to build gem native extension.)?

I was trying to install gem sqlite3 but failed with error below.
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
/usr/local/opt/ruby/bin/ruby -r ./siteconf20151016-8328-1i1buur.rb extconf.rb --with-sqlite3-dir /usr/bin
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.
.....
I just searched through and solved it via installing XCode before installing sqlite3, can anyone tell me the reason? What does XCode actually do?
I am a newbie on those gem of Ruby.
Installing XCode (or more precisely the XCode command line tools) will also install the toolchain needed to compile the native extensions (written in C) needed by the sqlite3 gem.

can't setup ruby environment - installing fii gem error

I'm trying to setup environtment for ruby project.
But when I run 'bundle', I have error during installing 'fii' gem:
Installing ffi (1.8.1)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/bmalets/.rvm/rubies/ruby-1.9.3-p448/bin/ruby 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.
/Users/bmalets/.rvm/rubies/ruby-1.9.3-p448/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.
Gem files will remain installed in /Users/bmalets/.rvm/gems/ruby-1.9.3-p448#api2/gems/ffi-1.8.1 for inspection.
Results logged to /Users/bmalets/.rvm/gems/ruby-1.9.3-p448#api2/gems/ffi-1.8.1/ext/ffi_c/gem_make.out
An error occurred while installing ffi (1.8.1), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.8.1'` succeeds before bundling.
My environment:
OS_X 10.8.4
ruby 1.9.3p448
Xcode 4.6.3
libffi-3.0.13
Please, help me to fix it.
Make sure that you have installed Apple Xcode and Command Line Tools (look at this screenshot):
https://developer.apple.com/technologies/tools/
After that, don't forget to install libffi.
1) if you are using homebrew
brew install libffi
2) if you are using macport
sudo port install libffi

"Error installing charlock_holmes" : "icu required"

I'm attempting to install charlock_holmes on my Mac (10.7.5, ruby-1.9.3-p392), and I'm encountering the following error:
$gem install charlock_holmes -v '0.6.9.4'
Building native extensions.
This could take a while...
ERROR: Error installing charlock_holmes:
ERROR: Failed to build gem native extension.
/Users/mthompson/.rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb
checking for main() in -licui18n... no
checking for main() in -licui18n... no
***************************************************************************************
*********** icu required (brew install icu4c or apt-get install libicu-dev) ***********
***************************************************************************************
*** 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.
I've installed icu via macports, so my icu directories are /opt/local/lib/icu and /opt/local/share/icu. I've tried installing with the directories specified:
$ gem install charlock_holmes -v '0.6.9.4' -- --with-icu-dir=/opt/local/lib/icu --with-opt-include=/usr/local/include/ --with-opt-lib=/usr/local/lib/
..but I hit the same error. Any ideas would be welcome.
I was able to install this gem using the version of ICU installed with macports and pointing --with-opt-include and --with-opt-lib to subdirectories of /opt.
The gem successfully installed by running:
gem install charlock_holmes -v '0.6.9.4' -- --with-icu-dir=/opt/local/lib/icu --with-opt-include=/opt/local/include/ --with-opt-lib=/opt/local/lib/
I ran into this issue today. I realize that the original issue was resolved by switching to Homebrew. That wasn't an acceptable solution to me, so I kept digging. The solution was actually quite simple.
After installing icu via Macports, simply install charlock_holmes by running:
gem install charlock_holmes -- --with-icu-dir=/opt/local
Hopefully this helps others that encounter this issue and are not willing to abandon Macports in order to solve it.
I ended up switching from MacPorts to Homebrew and reinstalling my rubies and packages.

Problem install do_sqlite3 for DataMapper

sudo env ARCHFLAGS="-arch x86_64" gem install do_sqlite3
Building native extensions. This could take a while...
ERROR: Error installing do_sqlite3:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_open() in -lsqlite3... no
*** 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.
I have sqlite3-ruby installed as well as the header files, but for some reason it fails when checking for sqlite3_open()
I am having the same issue:
sudo env ARCHFLAGS="-arch x86_64" gem install do_sqlite3
Building native extensions. This could take a while...
ERROR: Error installing do_sqlite3:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/do_sqlite3-0.10.1.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/do_sqlite3-0.10.1.1/ext/do_sqlite3/gem_make.out
I am running Snow Leopard. I'm not sure about previous installations of sqlite3 but I did try this:
port search sqlite
And it returned the following (among others):
...
sqlite3 #3.6.17 (databases)
an embedded SQL database engine
To be honest I'm not sure what all this means. What would anyone suggest for getting do_sqlite3 installed for use in Rails 3 with DataMapper? (Also, running it without the 'env ARCHFLAGS="-arch x86_64"' gives the same errors.)
Ok, first question is why are you passing the ARCHFLAGS? That should not be necessary, if it also doesn't work without passing them, what is the output you get then?
Next question is what version of sqlite3 is it picking up? Do you have sqlite3 installed through Macports for example? Did you upgrade to Snow Leopard recently and still have an sqlite3 install from before upgrading?

Resources