使用jemalloc和rbenv编译Ruby 2.2的正确方法是什么?

时间:2015-09-13 15:26:18

标签: ruby compilation rbenv

使用建议的步骤(从根目录)下载并安装jemalloc 4.0.0:

./autogen.sh
make dist
make
make install

已验证安装在我的路径中:

    $ls /usr/local/bin | grep je
    jemalloc-config
    jemalloc.sh
    jeprof

使用rbenv 0.4.0,尝试构建ruby 2.2.3并将标志传递给指定here的ruby构建以使用--with-jemalloc选项。构建失败:(如果我只是通过编译器,它会成功。任何想法如何获得rbenv / ruby​​-build来找到我的jemalloc安装?

$CC="/usr/local/Cellar/gcc5/5.2.0/bin/gcc-5" CONFIGURE_OPTS="--with-jemalloc" rbenv install 2.2.3
Downloading ruby-2.2.3.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/df795f2f99860745a416092a4004b016ccf77e8b82dec956b120f18bdc71edce
Installing ruby-2.2.3...

BUILD FAILED (OS X 10.10.4 using ruby-build 20150818)

Inspect or clean up the working tree at /var/folders/xw/15_55jhn0hb309d6zvh5k9mc0000gn/T/ruby-build.20150913102001.819
Results logged to /var/folders/xw/15_55jhn0hb309d6zvh5k9mc0000gn/T/ruby-build.20150913102001.819.log

Last 10 log lines:
checking gmp.h usability... no
checking gmp.h presence... no
checking for gmp.h... no
checking for malloc_conf in -ljemalloc... no
checking jemalloc/jemalloc.h usability... no
checking jemalloc/jemalloc.h presence... no
checking for jemalloc/jemalloc.h... no
checking for jemalloc with JEMALLOC_MANGLE... no
configure: error: jemalloc requested but not found
make: *** No targets specified and no makefile found.  Stop.

1 个答案:

答案 0 :(得分:5)

想出来。在OS X Yosemite上清理了我的第一次尝试,然后下载了jemalloc-4.0.0.tar.bz2。解压缩并根据https://bugs.ruby-lang.org/issues/9113#note-39中的Nobu注释从根目录运行./configure --with-jemalloc-prefix=""。然后只需makemake install

一旦我验证了jemalloc安装正确,我就可以通过CONFIGURE_OPTS="--with-jemalloc" rbenv install 2.2.3将选项传递给rbenv。

奖励:另一个有助于确定断点的方法是直接下载并解压缩ruby源代码tarball,然后在根目录中运行./configure --with-jemalloc。它将吐出所有构建检查的输出,包括一个用于jemalloc。