Skip to content

Build your own zlib

Frank Haverkamp edited this page Dec 11, 2017 · 2 revisions

Build and install private version of software zlib

Our hardware accelerated libz loads the software libz automatically using the dlopen/dlsym mechanism. If it happens that you have a very old Linux distro using a very old libz e.g. RHEL6.x using libz-1.2.3, the software fall-back mechanism does not work. Our lib requires at least 1.2.8. To overcome this problem, you can install a recent libz version in /opt/genwqe/lib, where our library searches first once it tries to load the software libz. The next sections describe how you install your private version of libz on your old distribution.

  1. Go to http://www.zlib.net/ and download at least zlib-1.2.8.tar.gz.

  2. Unpack the sources

    tar xfvz zlib-1.2.8.tar.gz

  3. Build them with

    cd zlib-1.2.8 CFLAGS=-O3 ./configure --prefix=/opt/genwqe

    make

Normally you might assume that the ./configure step selects something like optimization (-O3) automatically. This seems not to be the case for libz. Therefore setting CFLAGS to something useful, is really what you like to do here. Otherwise you get a software zlib without optimization, and that might be slow depending on the platform you run the code onto.

  1. Install the resulting library with

    sudo make install

  2. Rebuild our software such that it will compile against the recent libz version. /opt/genwqe is used for searching headers and the software libz prior using the distribution version.

    make clean all

If you miss to rebuild the code, you might get header/library version mismatch. Use ZLIB_TRACE=0xf to see if something does not work as expected.