33
28

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

rubyをビルドしたときのconfigureオプションを表示する

Last updated at Posted at 2013-12-27

rbenvを使って複数のバージョンのRubyをインストールできるのはいいのだけどどうやってビルドしたのかをすぐ忘れてしまう。
こうすればconfigure時のオプションを表示できる。

$ ruby -r rbconfig -e 'puts RbConfig::CONFIG["configure_args"]'

2.1.0は、こうしてビルドしたので

$ RUBY_CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline` --with-openssl-dir=`brew --prefix openssl`" rbenv install 2.1.0

こんなふうに表示された。

'--prefix=/Users/xxxxxx/.rbenv/versions/2.1.0' '--with-readline-dir=/usr/local/opt/readline' '--with-openssl-dir=/usr/local/opt/openssl' 'CFLAGS= -O3 -Wno-error=shorten-64-to-32 ' 'LDFLAGS=-L/Users/xxxxxx/.rbenv/versions/2.1.0/lib ' 'CPPFLAGS=-I/Users/xxxxxx/.rbenv/versions/2.1.0/include '

RbConfig::CONFIGには他にもビルド時の情報が盛りだくさんでperl -Vに負けないくらいの情報が取り出せる。

$ ruby -r rbconfig -e 'RbConfig::CONFIG.sort.each { |c| p c }'
["ALLOCA", ""]
["AR", "ar"]
["ARCHFILE", ""]
["ARCH_FLAG", "  "]
["AS", "as"]
["ASFLAGS", ""]
["BTESTRUBY", "$(MINIRUBY)"]
["BUILTIN_TRANSSRCS", " newline.c"]
["CAPITARGET", "nodoc"]
["CC", "xcrun clang"]
["CCDLFLAGS", ""]
["CFLAGS", " -g -Os -pipe"]
["CHDIR", "cd -P"]
["COMMON_HEADERS", ""]
...
["vendorarchdir", "/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0/universal-darwin13"]
["vendorarchhdrdir", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/vendor_ruby/universal-darwin13"]
["vendordir", "/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby"]
["vendorhdrdir", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/vendor_ruby"]
["vendorlibdir", "/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0"]
["warnflags", ""]
33
28
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
33
28

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?