Precise is a pretty old Ubuntu release. It requires quite a lot of preparations to be able to build MariaDB with all the features that users request to see in a official MariaDB binaries. In particular:

  • gcc is too old, TokuDB requires at least 4.7
  • cmake is too old, TokuDB requires at least 2.8.9
  • ld is too old, TokuDB uses linker plugin which is supported starting from binutils 2.23 (?) and after fixing all the above the next problem is:
  • jemalloc 2.2.5 seems to be buggy, causes crashes in the mysql-test (in the jemalloc code, red-black tree handling)

Here's what we've done to our precise-amd64-build VM image.

  1. install cmake, from the sources, into /usr/local
  2. install binutils 2.23.2, from the sources, into /usr/local
  3. install gcc 4.7.3, this is not straightforward:
    1. download, unpack
    2. patch it, otherwise gcc won't build
    3. run contrib/download_prerequisites script
    4. configure with ./configure --with-multilib-list=m64 --enable-languages=lto,c,c++ — without m64 it won't compile (our VM doesn't have 32-bit libs), without lto it will be useless, TokuDB won't build.
    5. make and install in /usr/local
    6. create a symlink cc to gcc, cmake needs it, but somehow make install doesn't do it
  4. now there's a problem: gcc comes with a matching version of libstdc++. It contains symbols than old (vanilla precise) libstdc++ doesn't have. That is, a binary built on this system may not work on the vanilla precise system. This should be fixed:
    1. copy libstdc++.a to libstdc++extra.a
    2. get a list of all symbols of GLIBCXX_3.4.15 version from the new
    3. generate a list of .o files that contain these symbols
    4. remove all other files from libstdc++extra.a
    5. if we force libstdc++extra.a always to be linked before libstdc++, it will statically link into mariadb all symbols that are not available in the vanilla precise
    6. for this, create a shell script, called ld, it'll force -lstdc++extra into linker's command line when -lstdc++ is used and then it'll call the original ld.
  5. jemalloc is installed from our deb repository for precise (where we have our custom-built jemalloc 3.6.0 debs)

Scripts are attached


Comments loading...