使用建议的步骤(从根目录)下载并安装了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.

最佳答案

弄清楚了。整理完我的第一个尝试,然后在OS X Yosemite上进行了整理,改为下载jemalloc-4.0.0.tar.bz2。根据Nobu在https://bugs.ruby-lang.org/issues/9113#note-39中的注释,将其解压缩并从根目录中运行./configure --with-jemalloc-prefix=""。然后只是makemake install

确认正确安装了jemalloc后,便可以使用CONFIGURE_OPTS="--with-jemalloc" rbenv install 2.2.3将选项传递给rbenv。

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

关于ruby - 用jemalloc和rbenv编译Ruby 2.2的正确方法?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32551266/

10-10 09:37