1. 官网下载4.5.0.tar.gz;
地址:https://github.com/jemalloc/jemalloc/archive/4.5.0.tar.gz
2. 解压到指定目录;
tar -zxvf 4.5.0.tar.gz
note:tar -zxvf 为解压指令 例如: tar -zcvf 4.5.0.tar.gz ./ (解压到当前文件夹)
tar -zcvf 压缩指令 例如: tar -zcvf 4.5.0.tar.gz jemalloc-4.5.0/ (4.5.0.tar.gz 是压缩文件名 jemalloc-4.5.0 被压缩文件)
3、进入解压后的目录,依次运行指令:
./autogen.sh
make
make install
4如果编译出现cannot stat ‘doc/jemalloc.html’: No such file or directory
把make install 改成 make install_lib_static
5如果编译出现/usr/bin/ld: /usr/local/lib/libjemalloc.a(jemalloc.o): relocation R_X86_64_32S against `je_index2size_tab' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libjemalloc.a: error adding symbols: 错误的值
则将修改MakeFile
vim MakeFile
条加加黑字体
CPPFLAGS := -D_GNU_SOURCE -D_REENTRANT -I$(srcroot)include -I$(objroot)include –fPIC
6.重新编译文件
make &&make install_lib_static