[MDEV-7645] jemalloc isn't used when it's built with a prefix Created: 2015-02-27  Updated: 2022-10-20  Resolved: 2022-10-20

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - TokuDB
Affects Version/s: 10.0.16, 10.1.2, 5.5
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Denis Denisov Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: jemalloc, tests, tokudb, upstream
Environment:

==> Configuration
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew
HEAD: c5709064d4c66de739481b9ca9f37ea8cfc9f719
Last commit: 2 days ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit nehalem
OS X: 10.10.3-x86_64
Xcode: 6.3
CLT: 6.1.1.0.1.1416017670
Clang: 6.1 build 602
X11: 2.7.8_beta3 => /opt/X11
System Ruby: 2.0.0-p481
Perl: /usr/bin/perl
Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/local/bin/ruby => /usr/local/Cellar/ruby/2.2.0/bin/ruby
Java: 1.6.0_65
==> ENV
HOMEBREW_CC: clang
HOMEBREW_CXX: clang++
MAKEFLAGS: -j4
CMAKE_PREFIX_PATH: /usr/local/opt/openssl:/usr/local/opt/libressl:/usr/local
CMAKE_INCLUDE_PATH: /usr/include/libxml2:/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers
CMAKE_LIBRARY_PATH: /System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig:/usr/local/opt/libressl/lib/pkgconfig
PKG_CONFIG_LIBDIR: /usr/lib/pkgconfig:/usr/local/Library/ENV/pkgconfig/10.10
ACLOCAL_PATH: /usr/local/share/aclocal
PATH: /usr/local/Library/ENV/4.3:/usr/local/opt/cmake/bin:/usr/local/opt/openssl/bin:/usr/local/opt/libressl/bin:/usr/local/opt/git/bin:/usr/bin:/bin:/usr/sbin:/sbin


Attachments: Zip Archive logs-build.zip    

 Description   

Display an error to the lack jemalloc.
After reconciliation with the environment, its presence exists in /usr/local/lib/libjemalloc*.
`CMAKE_PREFIX_PATH: /usr/local/opt/openssl:/usr/local/opt/libressl:/usr/local`

-- Performing Test TOKUDB_OK
-- Performing Test TOKUDB_OK - Success
CMake Warning at storage/tokudb/CMakeLists.txt:17 (MESSAGE):
  TokuDB is enabled, but jemalloc is not.  This configuration is not
  supported

~ ls /usr/local/lib/libjemalloc*
/usr/local/lib/libjemalloc.1.dylib /usr/local/lib/libjemalloc.dylib
/usr/local/lib/libjemalloc.a       /usr/local/lib/libjemalloc_pic.a
~ tree /usr/local/Cellar/jemalloc/3.6.0/{bin,include,lib}
/usr/local/Cellar/jemalloc/3.6.0/bin
├── jemalloc-pprof
└── jemalloc.sh
/usr/local/Cellar/jemalloc/3.6.0/include
└── jemalloc
    └── jemalloc.h
/usr/local/Cellar/jemalloc/3.6.0/lib
├── libjemalloc.1.dylib
├── libjemalloc.a
├── libjemalloc.dylib -> libjemalloc.1.dylib
└── libjemalloc_pic.a



 Comments   
Comment by Sergei Golubchik [ 2015-04-07 ]

I don't really understand why it fails for you. The command in the logs (thanks!) is

clang -pipe -w -Os -march=native -pie -fPIC -fstack-protector --param=ssp-buffer-size=4 -DWITH_INNODB_DISALLOW_WRITES -DCHECK_FUNCTION_EXISTS=malloc_stats_print -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTryCompileExec3840902724.dir/CheckFunctionExists.c.o -o cmTryCompileExec3840902724 -ljemalloc -isystem/usr/local/include -isystem/usr/include/libxml2 -isystem/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers -I/usr/local/opt/openssl/include -I/usr/local/opt/libressl/include -L/usr/local/opt/openssl/lib -L/usr/local/opt/libressl/lib -L/usr/local/lib -L/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries -Wl,-headerpad_max_install_names

that is

clang ... -ljemalloc ... -L/usr/local/lib

So it should've found libjemalloc.dylyb. Perhaps your OSX port of jemalloc doesn't have malloc_stats_print function?

Anyway, I don't have the same environment so I cannot debug that, unfortunately. But you can try the following: remove these lines from your CMakeCache.txt file:

//Have library jemalloc
HAVE_DYNAMIC_JEMALLOC:INTERNAL=0

Then run

cmake --debug-trycompile

It will fail to find jemalloc again. But inside CMakeFiles/ you fill see CMakeTmp/ which will have a normal cmake project structure — with a C file, Makefile, CMakeFiles/. Running make there will run this test for jemaloc. This way you can examine the test, see the compiler or a linker error and know exactly why it fails.

Comment by Denis Denisov [ 2015-04-07 ]

The problem was found he ignores that jemalloc can be assembled with the prefix

_je_*

jemalloc-3.6.0:

~ nm -gU /usr/local/lib/libjemalloc.dylib | grep malloc_stats_print
0000000000012de4 T _je_malloc_stats_print

"--with-jemalloc-prefix=" may help but by default it creates a prefix

jemalloc version   : 3.6.0-0-g46c0af68bd248b04df75e4f92d5fb804c3d75340
library revision   : 1
 
CC                 : clang
CPPFLAGS           :  -D_REENTRANT
CFLAGS             : -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops
LDFLAGS            :
EXTRA_LDFLAGS      :
LIBS               :  -lpthread
RPATH_EXTRA        :
 
XSLTPROC           : /usr/bin/xsltproc
XSLROOT            :
 
PREFIX             : /usr/local/Cellar/jemalloc/3.6.0
BINDIR             : /usr/local/Cellar/jemalloc/3.6.0/bin
INCLUDEDIR         : /usr/local/Cellar/jemalloc/3.6.0/include
LIBDIR             : /usr/local/Cellar/jemalloc/3.6.0/lib
DATADIR            : /usr/local/Cellar/jemalloc/3.6.0/share
MANDIR             : /usr/local/Cellar/jemalloc/3.6.0/share/man
 
srcroot            :
abs_srcroot        : /private/tmp/jemalloc20150407-14319-1g098b5/jemalloc-3.6.0/
objroot            :
abs_objroot        : /private/tmp/jemalloc20150407-14319-1g098b5/jemalloc-3.6.0/
 
JEMALLOC_PREFIX    : je_
JEMALLOC_PRIVATE_NAMESPACE
                   : je_
install_suffix     :
autogen            : 0
experimental       : 1
cc-silence         : 0
debug              : 0
code-coverage      : 0
stats              : 1
prof               : 0
prof-libunwind     : 0
prof-libgcc        : 0
prof-gcc           : 0
tcache             : 1
fill               : 1
utrace             : 0
valgrind           : 0
xmalloc            : 0
mremap             : 0
munmap             : 1
dss                : 0
lazy_lock          : 0
tls                : 0

Comment by Daniel Black [ 2022-10-20 ]

Won't fix with Tokudb being EOL.

Generated at Thu Feb 08 07:21:11 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.