Skip to content

Instantly share code, notes, and snippets.

@tenderlove
Last active December 4, 2020 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tenderlove/6e0c2ca4f7edf8aded4f148ff9987bf4 to your computer and use it in GitHub Desktop.
Save tenderlove/6e0c2ca4f7edf8aded4f148ff9987bf4 to your computer and use it in GitHub Desktop.
muck with RbConfig before RubyGems can
[aaron@tc-lan-adapter ~]$ cat x.rb
require "rbconfig"
# Change the compiler to "aarons-compiler"
RbConfig::CONFIG["CC"] = "aarons-compiler"
[aaron@tc-lan-adapter ~]$ RUBYOPT='-I/Users/aaron -rx' gem install sqlite3
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
current directory: /Users/aaron/.gem/ruby/3.0.0/gems/sqlite3-1.4.2/ext/sqlite3
/Users/aaron/.rubies/ruby-trunk/bin/ruby -I /Users/aaron/.rubies/ruby-trunk/lib/ruby/3.0.0 -r ./siteconf20201203-66828-mlfi8b.rb extconf.rb
*** 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:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/aaron/.rubies/ruby-trunk/bin/$(RUBY_BASE_NAME)
--with-sqlcipher
--without-sqlcipher
--with-sqlcipher
--without-sqlcipher
--with-sqlite3-config
--without-sqlite3-config
--with-pkg-config
--without-pkg-config
/Users/aaron/.rubies/ruby-trunk/lib/ruby/3.0.0/mkmf.rb:471:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/aaron/.rubies/ruby-trunk/lib/ruby/3.0.0/mkmf.rb:564:in `try_link0'
from /Users/aaron/.rubies/ruby-trunk/lib/ruby/3.0.0/mkmf.rb:582:in `try_link'
from /Users/aaron/.rubies/ruby-trunk/lib/ruby/3.0.0/mkmf.rb:684:in `try_ldflags'
from /Users/aaron/.rubies/ruby-trunk/lib/ruby/3.0.0/mkmf.rb:1851:in `pkg_config'
from extconf.rb:35:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/aaron/.gem/ruby/3.0.0/extensions/x86_64-darwin-20/3.0.0-static/sqlite3-1.4.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/aaron/.gem/ruby/3.0.0/gems/sqlite3-1.4.2 for inspection.
Results logged to /Users/aaron/.gem/ruby/3.0.0/extensions/x86_64-darwin-20/3.0.0-static/sqlite3-1.4.2/gem_make.out
[aaron@tc-lan-adapter ~]$ cat /Users/aaron/.gem/ruby/3.0.0/extensions/x86_64-darwin-20/3.0.0-static/sqlite3-1.4.2/mkmf.log
"pkg-config --exists sqlite3"
| pkg-config --libs sqlite3
=> "-L/usr/local/Cellar/sqlite/3.33.0/lib -lsqlite3\n"
"aarons-compiler -o conftest -I/Users/aaron/.rubies/ruby-trunk/include/ruby-3.0.0/x86_64-darwin20 -I/Users/aaron/.rubies/ruby-trunk/include/ruby-3.0.0/ruby/backward -I/Users/aaron/.rubies/ruby-trunk/include/ruby-3.0.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -DNDEBUG -ggdb -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe conftest.c -L. -L/Users/aaron/.rubies/ruby-trunk/lib -L. -fstack-protector-strong -L/usr/local/lib -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return !!argv[argc];
6: }
/* end */
[aaron@tc-lan-adapter ~]$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment