Install of Google-api-client Ruby fails on OSX Mountain Lion (localmemcache) - ruby

Trying to install Google-api-client for Ruby on Mountain Lion fails due to localmemcache gem (I think).. Here is what happens:
Building native extensions. This could take a while...
ERROR: Error installing localmemcache:
ERROR: Failed to build gem native extension.
sh ./configure --prefix=/Users/rental/.rvm/gems/ruby-1.9.3-p125/gems/localmemcache-0.4.4/src/ruby-binding
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for ranlib... ranlib
checking for apple OS X...
-> Apple OS X is not supported because it doesn't have
sem_getvalue and sem_timedwait!
You may set the environment variable LMC_FORCE_BUILD
to build a version of localmemcache that cannot recover
from crashes.
Important note: this happens, when installed with --development:
sudo gem install google-api-client --development --force --no-rdoc --no-ri

Not sure where lmc is coming from, but its not a direct dependency of the library nor is it required for normal use. For now, suggest skipping the development dependencies and just install with:
gem install google-api-client

Related

How to FIX Zlib missing error on OSX 10.14?

I found this "Zlib missing" continously when installing gems for Rails on Ruby, please let me know a solution :
Fetching nokogiri 1.10.2
Installing nokogiri 1.10.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.2/ext/nokogiri
/usr/local/opt/ruby/bin/ruby -I /usr/local/Cellar/ruby/2.6.2/lib/ruby/2.6.0 -r ./siteconf20190407-34092-u44l37.rb extconf.rb
checking if the C compiler accepts -I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
Using mini_portile version 2.4.0
checking for iconv.h... yes
checking for gzdopen() in -lz... no
zlib is missing; necessary for building libxml2
*** 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 also re-installed OSX 10.14 SDK header but didn't work.
It turned out that I have to manually download zlib from its site and then install it myself to make it work.
Extract the package then install as instruction :
./Configure
make
make install

ERROR: Failed to build gem native extension when installing Sablon gem

I am trying to install and use the Sablon ruby gem. I have installed xcode command line developer tools. However, I continue to get the following error:
ERROR: Error installing sablon:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
Using mini_portile version 2.1.0
checking for iconv.h... yes
checking for gzdopen() in -lz... yes
checking for iconv... yes
Any ideas as to what might be going on here?
try
gem install sablon -- --use-system-libraries=true
if it doesn't work may i ask how you installed xcode command line tools?

rails 4 gem install error using homebrew-installed gcc compiler

I am installing gem sqlite3 for rails 4 and get a compilation error. This is a completely new macbook pro with Mavericks OS installed. I have installed XCode, but then also installed gcc 4.9 using Homebrew (using instructions here). Everything was going smooth until I started getting a compilation error while trying to install the gem sqlite3:
app_folder git:(mybranch) gem install sqlite3 -v '1.3.8'
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
/Users/myname/.rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... yes
checking for sqlite3_initialize()... yes
checking for sqlite3_backup_init()... yes
checking for sqlite3_column_database_name()... no
checking for sqlite3_enable_load_extension()... no
checking for sqlite3_load_extension()... no
checking for sqlite3_open_v2()... yes
checking for sqlite3_prepare_v2()... yes
checking for sqlite3_int64 in sqlite3.h... yes
checking for sqlite3_uint64 in sqlite3.h... yes
creating Makefile
make "DESTDIR="
compiling backup.c
gcc-4.9: error: unrecognized command line option '-Wshorten-64-to-32'
make: *** [backup.o] Error 1
Upon doing some research of the issue, I have found little information besides that this command line option is mac-specific and Homebrew-installed gcc compiler does not have it! Is there a way for me to switch back to native mac gcc compiler? How do I resolve this and why is it barely mentioned anywhere?
gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx- include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.1
I just installed Rails and had a similar experience. I fixed it by getting osx to recognize the correct g++ version and then reinstalling ruby. Here are a few suggestions:
You can set your gcc and g++ version via .bash_profile with the following code
export CC=gcc-4.9
export CXX=g++-4.9
export CPP=cpp-4.9
check your g++ version with g++ -v. If this doesn't work you may need to do bit of hacking.
Per http://instantbadger.blogspot.com/2011/11/porting-rails-23-app-to-ruby-19.html, you can remove the default g++ in /usr/bin and substitute it with a new symlink to g++-4.9:
sudo mv /usr/bin/g++ /usr/bin/g++.bak && sudo ln -s /usr/local/bin/g++-4.9 /usr/bin/g++
Note: this command is different from the one present in the linked page (which moves /usr/local/bin/g++). I didn't have a copy of g++ in /usr/local/bin/, so I adapted the command to work with /usr/bin instead.
Check g++ -v again. It should now reflect the correct version of g++.
Once your g++ version checks out, you can try reinstalling ruby. This insures that your ruby version is compiled with the same compiler that your going to build your gems with.
rvm install 2.0.0
Once you've done that, repeat
gem install sqlite3 -v '1.3.8'
Hopefully, this should work now.

Nokogiri native extension failing to build (Not libxml2 or libxslt missing issue)

As the title says, it doesn't seem to be failing because libxml2 or libxslt is missing. I'm not really sure what to make of the error. (Get it? Because the issue is during make? hehe...)
Anywho, here's the output I'm getting. Any ideas would be appreciated:
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
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 xmlHasFeature()... 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 xml_element_content.c
compiling xml_relax_ng.c
compiling xml_cdata.c
compiling xml_sax_parser_context.c
compiling xml_node_set.c
compiling xml_text.c
compiling xml_sax_parser.c
compiling xml_attribute_decl.c
compiling nokogiri.c
nokogiri.c: In function ‘ruby_strdup’:
nokogiri.c:43:31: warning: conversion to ‘size_t’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
compiling xml_entity_reference.c
compiling xml_node.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 /var/lib/gems/1.9.1/gems/nokogiri-1.5.0 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/nokogiri-1.5.0/ext/nokogiri/gem_make.out
For context, I upgraded from Ubuntu 12.04 to 12.10 last night. I had previously built the Nokogiri native extension on this box, though I do not know if it was the same version or not.
I also checked that I have all packages specified in the second post on "error installing nokogiri 1.5.0 with rails 3.1.0 and ubuntu"
to no avail.
Took me some time to figure out how to append the cflags. Here is my command for nokogiri 1.4.7:
sudo gem install nokogiri -v '1.4.7' -- --with-cflags=\"-Wformat-nonliteral -Wno-format-security\"
If you're trying to install Nokogiri < 1.5.4, you'll have problems on hardened Debian systems like Ubuntu 12.
Details on the underlying issue are here: https://github.com/sparklemotion/nokogiri/issues/680
You should be able to upgrade to 1.5.4 or later and install without this problem.
Alternatively, you should be able to set the CFLAGS environment variable at gem-install time to include the string:
-Wno-error=format-security
or
-Wformat-nonliteral -Wno-format-security
Good luck!
Have you tried installing the following depencies for nokogiri??
# nokogiri requirements
sudo apt-get install libxslt-dev libxml2-dev
sudo gem install nokogiri
This may be happening due to this bug > https://leap.se/code/issues/7231
Run below before running the command:
sudo apt-get install zlib1g-dev

sudo gem install rmagick fails

I am getting this error when I try to install RMagick on my machine so I can play with Scruffy graph creator:
sudo gem install rmagick
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/Users/richardjburton/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.
Any help would be awesome! Thanks.
Looks like you installed ImageMagick using a binary distro or something else which didn't include the headers. From your /Users directory you're probably using OSX. Assuming so, install ImageMagick using either Macports or Homebrew.

Resources