Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-7645

jemalloc isn't used when it's built with a prefix

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Won't Fix
    • 10.0.16, 10.1.2, 5.5(EOL)
    • N/A

    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

      Attachments

        Activity

          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.

          serg Sergei Golubchik added a comment - 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.
          denji Denis Denisov added a comment - - edited

          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
          

          denji Denis Denisov added a comment - - edited 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
          danblack Daniel Black added a comment -

          Won't fix with Tokudb being EOL.

          danblack Daniel Black added a comment - Won't fix with Tokudb being EOL.

          People

            Unassigned Unassigned
            denji Denis Denisov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.