Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sqlite3 gem compilation error

I am trying to install the sqlite3 gem on OSX Mavericks and I have run into an error that seems tricky to get around. By googling, I've not managed to find anyone else with the same problem.

Basically, when I run the gem install command this is what happens:

Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/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 rb_integer_pack()... no
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
compiling database.c
database.c:300:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
1 warning generated.
compiling exception.c
compiling sqlite3.c
compiling statement.c
linking shared-object sqlite3/sqlite3_native.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: *** [sqlite3_native.bundle] Error 1


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/sqlite3-1.3.9 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/sqlite3-1.3.9/ext/sqlite3/gem_make.out

I don't know what clang is, but gem seems to be passing an argument which is perhaps deprecated or something? Anybody with any more knowledge about this stuff got any ideas?

like image 385
Luke Avatar asked Apr 09 '14 18:04

Luke


1 Answers

New version of XCode in Mavericks apparently ships with a compiler that treats unknown passed parameters as errors.

To workaround this issue, set the environment variable to ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future in order to downgrade the error to a warning.

So to install sqlite3 gem:

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install sqlite3

Reference: http://bruteforce.gr/bypassing-clang-error-unknown-argument.html

like image 129
LukasMac Avatar answered Oct 21 '22 23:10

LukasMac