I'm using:
Amazon Linux - 2012.09
RVM v1.19.1
Ruby ruby-1.9.3-p362 (via RVM)
System ruby 1.8.7
Thrift v0.7.0 (I know there is a newer version that removes the C dependancy, however, I have a dependancy that requires v0.7.0)
I'm running the following command which happily installs gems until is crashes out at thrift:
/usr/local/rvm/bin/rvm ruby-1.9.3-p362 exec bundle install
which produces the error:
Installing thrift (0.7.0)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p362/bin/ruby extconf.rb
checking for strlcpy() in string.h... no
creating Makefile
make
compiling compact_protocol.c
compiling struct.c
struct.c:28:1: error: static declaration of ‘strlcpy’ follows non-static declaration
/usr/local/rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1/ruby/missing.h:198:20: note: previous declaration of ‘strlcpy’ was here
make: *** [struct.o] Error 1
I can see quite a lot discussion around this topic, however, no real solution - any help would be greatly appreciated.
Thanks
Related
Trying to install thift gem after OSX El Capitan upgrade:
$ gem install thrift
Building native extensions. This could take a while...
ERROR: Error installing thrift:
ERROR: Failed to build gem native extension.
/Users/foo/.rvm/rubies/ruby-2.1.4/bin/ruby -r ./siteconf20160402-32256-7dzqel.rb extconf.rb
checking for strlcpy() in string.h... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling binary_protocol_accelerated.c
compiling bytes.c
compiling compact_protocol.c
compact_protocol.c:442:41: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
rb_exc_raise(get_protocol_exception(INT2FIX(-1), rb_str_new2(buf)));
^~~~~~~~~~~
Compilation fails with
compact_protocol.c:442:41: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
I have a solution for you! Hopefully.
Had this same problem the other day.
The problem is in the clang compiler that El Capitan comes bundled with. I'm sure it screws up other issues but this is one point that I had a lot of issues with.
Try running the following command and let me know how it goes!
gem install thrift -- --with-cppflags=\"-D_FORTIFY_SOURCE=0 -Wno-shift-negative-value\"
You need to escape double quotes.
$ bundle config build.thrift "--with-cppflags=\"-D_FORTIFY_SOURCE=0 -Wno-shift-negative-value\""
$ cat ~/.bundle/config
BUNDLE_BUILD__THRIFT: --with-cppflags="-D_FORTIFY_SOURCE=0 -Wno-shift-negative-value"
There is help for Big Sur https://github.com/instructure/canvas-lms/issues/827#issuecomment-946388555
gem install thrift -v 0.15.0 -- --with-cppflags="-Wno-compound-token-split-by-macro"
This worked for me on mac bigsur
gem install thrift -v '0.10.0.0' -- --with-cppflags="-D_FORTIFY_SOURCE=0 -Wno-shift-negative-value -Wno-compound-token-split-by-macro"
Try this
gem install thrift -v '0.9.0' -- --with-cppflags='-D_FORTIFY_SOURCE=0'
I'm on Windows, with Ruby 2.0 installed using RailsInstaller.
When I tried to install id3lib-ruby using gem install id3lib-ruby, I get the following:
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing id3lib-ruby:
ERROR: Failed to build gem native extension.
C:/RailsInstaller/Ruby2.0.0/bin/ruby.exe extconf.rb
checking for main() in -lstdc++... yes
checking for main() in -lz... no You must have zlib installed.
*** 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.
In mkmf.log, it includes the line:
c:/railsinstaller/devkit/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lz
collect2: ld returned 1 exit status
I have zlib1.dll in C:\RailsInstaller\Ruby2.0.0\bin, renaming the file to zlib.dll doesn't work. So, it looks like RubyInstaller already included the zlib library, but something's still causing the gem install to fail. Any ideas?
Couldn't work it out. "Fixed" by installing RailsInstaller 2.2.2 (Ruby 1.9.3) and taglib-ruby instead.
I try to install pushmeup plugin for phonegap push notifications (ios).
When I run command sudo gem install pushmeup I get this error:
Building native extensions. This could take a while... ERROR: Error
installing pushmeup: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
extconf.rb creating Makefile
make "DESTDIR=" clean
make "DESTDIR=" compiling generator.c linking shared-object
json/ext/generator.bundle clang: error: unknown argument:
'-multiply_definedsuppress'
[-Wunused-command-line-argument-hard-error-in-future] clang: note:
this will be a hard error (cannot be downgraded to a warning) in the
future make: * [generator.bundle] Error 1
make failed, exit code 2
Gem files will remain installed in
/Library/Ruby/Gems/2.0.0/gems/json-1.8.1 for inspection. Results
logged to
/Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/json-1.8.1/gem_make.out
GitHub:
https://github.com/phonegap-build/PushPlugin
Params:
ruby -v ruby 2.0.0p247 (2013-06-27 revision 41674)
[universal.x86_64-darwin13]
gem -v
2.2.2
Mac OS X v 10.9.2
XCode Version 5.1 (5B130a)
cordova -v
3.4.0-0.1.3
Apparently Apple broke something on Mavericks, they removed the warning flag unused-command-line-argument-hard-error-in-future acording to this issue: #528
Please try this command:
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future sudo gem install pushmeup
what it does? this sets the environment variable: ARCHFLAGS= this adds a ignore warnings -Wno-error= and this is the warning that you don't see in mavericks unused-command-line-argument-hard-error-in-future (which should be ignored)
In Apple documentation:
Compiler
As of Apple LLVM compiler version 5.1 (clang-502) and later, the
optimization level -O4 no longer implies link time optimization (LTO).
In order to build with LTO explicitly use the -flto option in addition
to the optimization level flag. (15633276) The Apple LLVM compiler in
Xcode 5.1 treats unrecognized command-line options as errors. This
issue has been seen when building both Python native extensions and
Ruby Gems, where some invalid compiler options are currently
specified. Projects using invalid compiler options will need to be
changed to remove those options. To help ease that transition, the
compiler will temporarily accept an option to downgrade the error to a
warning:
-Wno-error=unused-command-line-argument-hard-error-in-future
Note: This option will not be supported in the future. To workaround
this issue, set the ARCHFLAGS environment variable to downgrade the
error to a warning. For example, you can install a Python native
extension with:
$ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future
easy_install ExtensionName
Similarly, you can install a Ruby Gem with:
$ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future
gem install GemName 16214764 updated
EDIT HISTORY
just tested on my machine, using same ruby:
$ gem install pushmeup
Fetching: pushmeup-0.1.2.gem (100%)
Successfully installed pushmeup-0.1.2
Parsing documentation for pushmeup-0.1.2
Installing ri documentation for pushmeup-0.1.2
Done installing documentation for pushmeup after 1 seconds
1 gem installed
From what i saw you are not using rvm or rbenv so the problem is not in gcc dependencies
Accordingly to the output provided, the error was when installing json-1.8.1.
Can you post the log located at: /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/json-1.8.1/gem_make.out ?
when I try to install the Ruby gem sequel_pg I get the following error meassage:
~$ sudo gem update
Updating installed gems
Updating sequel_pg
Building native extensions. This could take a while...
ERROR: Error installing sequel_pg:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
checking for main() in -lpq... yes
checking for libpq-fe.h... yes
checking for PQsetSingleRowMode()... no
creating Makefile
make
compiling sequel_pg.c
sequel_pg.c: In function ‘spg_timestamp_error’:
sequel_pg.c:279:3: error: format not a string literal and no format arguments [- Werror=format-security]
cc1: some warnings being treated as errors
make: *** [sequel_pg.o] Error 1
Gem files will remain installed in /var/lib/gems/1.9.1/gems/sequel_pg-1.6.5 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/sequel_pg-1.6.5/ext/sequel_pg/gem_make.out
Nothing to update
I am running Lubuntu 13.04. The depencies: pg and sequel are installed. Packages files postgresql and postgresql-server-dev-9.1 is also installed
Does anyone have a clue?
This bug was fixed in master of the gem with this patch. You should wait for new release or install head version of the gem.
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?