8

我在 ubuntu 12.04.5 LTS 上并尝试使用 jemalloc 安装 ruby​​。jemalloc 安装成功(https://blog.scalingo.com/2017/05/02/improve-ruby-application-memory-jemalloc.html)但是在安装 ruby​​ 2.3.4 时,它给出了以下错误。

>rvm install 2.3.4 -C --with-jemalloc

Warning, new version of rvm available '1.29.1', you are using older version '1.27.0'.
You can disable this warning with:    echo rvm_autoupdate_flag=0 >> ~/.rvmrc
You can enable  auto-update  with:    echo rvm_autoupdate_flag=2 >> ~/.rvmrc
ruby-2.3.4 - #removing src/ruby-2.3.4..
Checking requirements for ubuntu.
Requirements installation successful.
Installing Ruby from source to: /home/deploy/.rvm/rubies/ruby-2.3.4, this may take a while depending on your cpu(s)...
ruby-2.3.4 - #downloading ruby-2.3.4, this may take a while depending on your connection...
ruby-2.3.4 - #extracting ruby-2.3.4 to /home/deploy/.rvm/src/ruby-2.3.4....
ruby-2.3.4 - #configuring...........................................................
ruby-2.3.4 - #post-configuration..
ruby-2.3.4 - #compiling.....
Error running '__rvm_make -j2',
showing last 15 lines of /home/deploy/.rvm/log/1494486344_ruby-2.3.4/make.log
compiling enumerator.c
compiling error.c
compiling eval.c
eval.c: In function 'rb_raise_jump':
eval.c:763:8: warning: unused variable 'mid' [-Wunused-variable]
compiling load.c
compiling proc.c
compiling file.c
compiling gc.c
In file included from gc.c:50:0:
/usr/include/malloc.h:152:15: error: conflicting types for 'malloc_usable_size'
/usr/include/jemalloc/jemalloc.h:45:8: note: previous declaration of 'malloc_usable_size' was here
make: *** [gc.o] Error 1
make: *** Waiting for unfinished jobs....
++ return 2
There has been an error while running make. Halting the installation.

有没有人遇到过或者有经验的,求帮助。

4

3 回答 3

7

在 [xK]ubuntu 18.10 上

我做了

sudo apt install libjemalloc-dev
rvm install 2.5.2 -C --with-jemalloc
rvm use 2.5.2
ruby -r rbconfig -e "puts RbConfig::CONFIG['LIBS']"
于 2019-03-09T08:09:11.297 回答
2

我使用 Ubuntu 18.04。像这样更改命令

RUBY_EXTRA_CONFIGURE_OPTIONS="--with-jemalloc" rvm install 2.3.4 --disable-binary

要检查 jemalloc 是否已安装,请运行以下命令:

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

如果安装 rvm 后无法识别 ruby​​。

source ~/.rvm/scripts/rvm

当调用 jemalloc 时。你可以看到响应。

-lpthread -ljemalloc -ldl -lobjc

您可以在此处查看完整文档

于 2018-10-04T05:11:27.720 回答
2

在尝试让 rails 使用 jemalloc 时,我遇到了这个问题的一个变体。在我的情况下,我(有目的地)安装了系统范围的红宝石,rvm但忘记rvmsudo像这样使用:

$ sudo apt update; sudo apt install libjemalloc-dev -y
$ rvmsudo rvm reinstall 2.4.1 -C --with-jemalloc

如果您在尝试让 jemalloc 在类似情况下工作时收到权限警告,请试一试^^^...

于 2020-01-15T00:42:31.450 回答