In trying to install the nio4r gem. I tried
gem install nio4r -v '1.0.0'
The error that pops up is:
Building native extensions. This could take a while...
ERROR: Error installing nio4r:
ERROR: Failed to build gem native extension.
/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150406-11564-1qtifmf.rb extconf.rb
checking for rb_thread_blocking_region()... no
checking for sys/select.h... yes
checking for poll.h... yes
checking for sys/epoll.h... no
checking for sys/event.h... yes
checking for sys/queue.h... yes
checking for port.h... no
checking for sys/resource.h... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling monitor.c
In file included from monitor.c:6:
In file included from ./nio4r.h:10:
/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/backward/rubyio.h:2:2: warning: use "ruby/io.h" instead of "rubyio.h" [-W#warnings]
warning use "ruby/io.h" instead of "rubyio.h"
...
What am I getting wrong? Is it an issue with my RVM?
With some basic updates, I was able to get it to work.
bundle update
and then
bundle
installs the gem.
Thanks to https://github.com/celluloid/nio4r/issues/46
Another approach would be to install a later version of ruby with RVM and do bundle again. Both works
Related
I'm having troubles to do bundle install in one project I get to work on in Rails 4.2.10. When I bundle I receive the next error:
An error occurred while installing ffi (1.9.25), and Bundler cannot continue.
Make sure that gem install ffi -v '1.9.25' succeeds before bundling.
In Gemfile:
s3_direct_upload was resolved to 0.1.6, which depends on
sass-rails was resolved to 5.0.7, which depends on
sass was resolved to 3.6.0, which depends on
sass-listen was resolved to 4.0.0, which depends on
rb-inotify was resolved to 0.9.10, which depends on
ffi
When I run gem install ffi -v '1.9.25' also an error occurs:
Building native extensions. This could take a while...
ERROR: Error installing ffi:
ERROR: Failed to build gem native extension.
current directory: /xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c
/xxx/xxx/.rvm/rubies/ruby-2.5.3/bin/ruby -r ./siteconf20190110-6923-1jimorr.rb extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... yes
checking for ffi_call() in -lffi... yes
checking for ffi_closure_alloc()... no
checking for ffi_raw_call()... no
checking for shlwapi.h... no
checking for ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
creating extconf.h
creating Makefile
current directory: /xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c
make "DESTDIR=" clean
current directory: /xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c
make "DESTDIR="
Configuring libffi
clang: error: unsupported option '-print-multi-os-directory'
clang: error: no input files
cd "/xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c/libffi-x86_64-darwin18" && /Volumes/Macintosh HD/Applications/Xcode.app/Contents/Developer/usr/bin/make
/bin/sh: /Volumes/Macintosh: No such file or directory
make: *** ["/xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c/libffi-x86_64-darwin18"/.libs/libffi_convenience.a] Error 127
make failed, exit code 2
Gem files will remain installed in /xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25 for inspection.
Results logged to /xxx/xxx/.rvm/gems/ruby-2.5.3/extensions/x86_64-darwin-18/2.5.0/ffi-1.9.25/gem_make.out
I've been trying many solutions online but cannot resolve this issue.
Seems the issue is with my system as I'm new to the team and the other developers were unable to help me as they do not have this kind of issue.
I was able to successfully install ffi with the following command:
LDFLAGS="-L/usr/local/opt/libffi/lib" PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig" gem install ffi -v '1.9.25'
Found on some japanese board
According to the libffi README, only GCC is a tested compiler on macOS. You are using Clang, which doesn't support the command line option -print-multi-os-directory.
You need to either patch libffi to work with Clang, or use GCC.
Your error is the following Configuring libffi
clang: error: unsupported option '-print-multi-os-directory'
clang: error: no input files because Clang (wich is the C compiler you are using) doesn't support the option '-print-multi-os-directory'.
Could you check that X-Code command line tools are perfectly installed by executing the following command? xcode-select --install
Also would you mind to try brew install automake autoconf libtool libffi to install required dependencies?
I've looked at and tried just about everything on the topic here at Stackoverflow.com and still can't figure this out...
When I 'gem install mysql2' I get a permissions error. when I 'sudo gem install mysql2' I get the following:
Teds-MacBook-Pro:~ tedmartin$ sudo gem install mysql2
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
current directory: /Users/tedmartin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/mysql2-0.4.5/ext/mysql2
/Users/tedmartin/.rbenv/versions/2.4.1/bin/ruby -r ./siteconf20170420-50202-1nekuvd.rb extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for rb_big_cmp()... yes
-----
Using mysql_config at /usr/local/bin/mysql_config
-----
checking for mysql.h... yes
checking for SSL_MODE_DISABLED in mysql.h... yes
checking for SSL_MODE_PREFERRED in mysql.h... yes
checking for SSL_MODE_REQUIRED in mysql.h... yes
checking for SSL_MODE_VERIFY_CA in mysql.h... yes
checking for SSL_MODE_VERIFY_IDENTITY in mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
-----
Don't know how to set rpath on your system, if MySQL libraries are not in path mysql2 may not load
-----
-----
Setting libpath to /usr/local/Cellar/mysql-connector-c/6.1.9/lib
-----
creating Makefile
current directory: /Users/tedmartin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/mysql2-0.4.5/ext/mysql2
make "DESTDIR=" clean
current directory: /Users/tedmartin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/mysql2-0.4.5/ext/mysql2
make "DESTDIR="
compiling client.c
compiling infile.c
compiling mysql2_ext.c
compiling result.c
compiling statement.c
linking shared-object mysql2/mysql2.bundle
ld: library not found for -l-lpthread
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mysql2.bundle] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/tedmartin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/mysql2-0.4.5 for inspection.
Results logged to /Users/tedmartin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-15/2.4.0-static/mysql2-0.4.5/gem_make.out
Anyone who has an idea, suggestion, tip, fix, etc... I'd be really grateful.
Thanks!
From the answer at this question, running the following worked for me
gem install mysql2 --source 'https://rubygems.org/' -- --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include
I ran into this same issue on Mojave, and none of the previous answers worked for me but this commands mentioned in this Github issue comment did
Step 1.
brew install openssl
Step 2.
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/
In my case I already had openssl installed so it was really the export command that solved the problem.
Make sure openssl is installed on Mac via Homebrew.
brew install openssl
Install mysql2 gem.
gem install mysql2 -v '0.5.2' -- --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include
If the bug is not fixed, this above solution is the last one
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
Another solution if the above does not work.
cd /usr/local/Cellar/openssl/1.0.2s/lib/
sudo cp libssl.1.0.0.dylib libcrypto.1.0.0.dylib /usr/local/lib
This worked for me on macOS Catalina:
Make sure you have openssl installed. If not:
brew install openssl
Then do the gem install:
gem install mysql2 -- --with-opt-dir="$(brew --prefix openssl)"
Try this:
which mysql
Then, use the output-result to install the gem using the existing mysql installation directory:
gem install mysql2 -- --with-mysql-dir=<mysql-installation-directory>
It away working for me after 2h crazy
Unstall Ruby and Install Ruby v2.6.6
Run command line as Administrator gem install mysql2
Install rails gem install rails
Create new project rails new my_proj -d mysql
Work 100% in Windown
I use homebrew to install the fox library successfully.
When I try sudo gem install fxruby, it fails.
The error message is shown below.
Building native extensions. This could take a while...
ERROR: Error installing fxruby:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for sys/time.h... yes
checking for signal.h... yes
checking for deflate() in -lz... yes
checking for png_create_read_struct() in -lpng... yes
checking for jpeg_mem_init() in -ljpeg... no
checking for TIFFSetErrorHandler() in -ltiff... no
checking for XftInit() in -lXft... yes
checking for XShmQueryVersion() in -lXext... yes
checking for XFindContext() in -lX11... yes
checking for glXCreateContext() in -lGL... yes
checking for gluNewQuadric() in -lGLU... yes
checking for FXRbCommon.h in ./include... no
creating Makefile
make "DESTDIR="
compiling librb.c
compiling core_wrap.cpp
core_wrap.cpp:593:10: fatal error: 'FXRbCommon.h' file not found
#include "FXRbCommon.h"
^
1 error generated.
make: *** [core_wrap.o] Error 1
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/fxruby-1.6.28 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/fxruby-1.6.28/ext/fox16_c/gem_make.out
I had the exact same problem (Mac 10.9.3) and followed the advice on https://github.com/larskanis/fxruby/issues/7 (actually reference a Debian installation)
This was basically to try sudo gem install fxruby -- --with-cppflags=-I./include
Worked for me
Hope it helps.
When I run bundle install it stops with:
Installing nokogiri (1.4.3.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
I tried installing it manually using "Installing Nokogiri" but this did work out in my favour.
Do I need to change something?
/usr/bin/ruby1.9.1 extconf.rb'
extconf.rb:10: Use RbConfig instead of obsolete and deprecated Config.
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for xmlParseDoc() in -lxml2... yes
checking for xsltParseStylesheetDoc() in -lxslt... yes
checking for exsltFuncRegister() in -lexslt... yes
checking for xmlFirstElementChild()... yes
checking for xmlRelaxNGSetParserStructuredErrors()... yes
checking for xmlRelaxNGSetParserStructuredErrors()... yes
checking for xmlRelaxNGSetValidStructuredErrors()... yes
checking for xmlSchemaSetValidStructuredErrors()... yes
checking for xmlSchemaSetParserStructuredErrors()... yes
creating Makefile
Or this:
make
compiling xml_dtd.c
compiling xml_entity_reference.c
compiling xml_sax_parser_context.c
compiling xml_attribute_decl.c
compiling xml_schema.c
compiling xml_processing_instruction.c
compiling xml_cdata.c
compiling xml_xpath_context.c
xml_xpath_context.c: In function ‘xpath_generic_exception_handler’:
xml_xpath_context.c:154:3: error: format not a string literal and no format arguments [- Werror=format-security]
cc1: some warnings being treated as errors
make: *** [xml_xpath_context.o] Error 1
Gem files will remain installed in /home/virinchy/.bundler/tmp/10048/gems/nokogiri- 1.4.3.1 for inspection.
Results logged to /home/virinchy/.bundler/tmp/10048/gems/nokogiri- 1.4.3.1/ext/nokogiri/gem_make.out
An error occured while installing nokogiri (1.4.3.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.4.3.1'` succeeds before bundling.'
First, Nokogiri 1.4.3.1 is almost three years old. You should upgrade.
Second, please see https://github.com/sparklemotion/nokogiri/issues/680 for details around how Debian hardened the gcc compiler. You will need to use either an older version of debian or a newer version of Nokogiri.
While installing Nokogiri on Ubuntu 12, I got an error:
Installing nokogiri (1.4.4) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
extconf.rb:10: Use RbConfig instead of obsolete and deprecated Config.
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... yes
checking for xmlParseDoc() in -lxml2... yes
checking for xsltParseStylesheetDoc() in -lxslt... yes
checking for exsltFuncRegister() in -lexslt... yes
checking for xmlFirstElementChild()... yes
checking for xmlRelaxNGSetParserStructuredErrors()... yes
checking for xmlRelaxNGSetParserStructuredErrors()... yes
checking for xmlRelaxNGSetValidStructuredErrors()... yes
checking for xmlSchemaSetValidStructuredErrors()... yes
checking for xmlSchemaSetParserStructuredErrors()... yes
creating Makefile
make
compiling html_sax_parser_context.c
compiling xml_io.c
compiling xml_entity_reference.c
compiling xml_schema.c
compiling xml_element_content.c
compiling xml_reader.c
compiling xml_sax_push_parser.c
compiling xml_sax_parser.c
compiling xslt_stylesheet.c
compiling xml_element_decl.c
compiling xml_node.c
compiling xml_cdata.c
compiling xml_processing_instruction.c
compiling xml_entity_decl.c
compiling xml_attribute_decl.c
compiling xml_xpath_context.c
xml_xpath_context.c: In function ‘xpath_generic_exception_handler’:
xml_xpath_context.c:184:3: error: format not a string literal and no format arguments [-Werror=format-security]
cc1: some warnings being treated as errors
make: *** [xml_xpath_context.o] Error 1
Gem files will remain installed in /home/alex/.bundler/tmp/22194/gems/nokogiri-1.4.4 for inspection.
Results logged to /home/alex/.bundler/tmp/22194/gems/nokogiri-1.4.4/ext/nokogiri/gem_make.out
An error occurred while installing nokogiri (1.4.4), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.4.4'` succeeds before bundling.
I already installed libxslt-dev and libxml2-dev, but as you see, it didn't help.
How do I solve it?
I stumbled at this trying to install bigbluebutton on ubuntu 13.04
I solved it doing this trick to compile reverting the -Wformat-security gcc flag systemwide
Be careful doing the first rm. It can break your whole system!!
rm /usr/bin/gcc
nano /usr/bin/gcc
## contents of /usr/bin/gcc
#!/bin/sh
gcc-4.7 $* -Wno-format-security
## save and exit
chmod u+x /usr/bin/gcc
gem install nokogiri -v '1.4.4'
Is there a specific reason you need 1.4.4 instead of the latest 1.5.6? Otherwise I suggest upgrading.
The Nokogiri changelog shows they fixed this in 1.5.4:
Build support on hardened Debian systems that use
-Werror=format-security. #680.
#Confusion has the right idea.
Bundler is probably locked to nokogiri-1.4.4 in the Gemfile and/or Gemfile.lock. #Confusion's answer of running bundle update should allow your Ruby Bundler environment to use the successfully installed nokogiri-1.5.6.