Bug #65856 cmake does not check for zlib version
Submitted: 9 Jul 2012 22:07 Modified: 1 Mar 2013 16:59
Reporter: Sveta Smirnova Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.5.27 OS:Any
Assigned to: CPU Architecture:Any

[9 Jul 2012 22:07] Sveta Smirnova
Description:
If operating system has outdated version of zlib or does not have it at all cmake finishes fine, but make will fail with failure like here:

[ 56%] Building C object storage/innobase/CMakeFiles/innobase.dir/page/page0zip.c.o
/home/ssmirnov/sparc01/src/mysql-5.5/storage/innobase/page/page0zip.c: In function `page_zip_empty_size':
/home/ssmirnov/sparc01/src/mysql-5.5/storage/innobase/page/page0zip.c:148: warning: implicit declaration of function `compressBound'
/home/ssmirnov/sparc01/src/mysql-5.5/storage/innobase/page/page0zip.c: In function `page_zip_decompress':
/home/ssmirnov/sparc01/src/mysql-5.5/storage/innobase/page/page0zip.c:2968: error: `Z_BLOCK' undeclared (first use in this function)
/home/ssmirnov/sparc01/src/mysql-5.5/storage/innobase/page/page0zip.c:2968: error: (Each undeclared identifier is reported only once
/home/ssmirnov/sparc01/src/mysql-5.5/storage/innobase/page/page0zip.c:2968: error: for each function it appears in.)
*** Error code 1
The following command caused the error:
cd /home/ssmirnov/sparc01/src/mysql-5.5/storage/innobase && /usr/sfw/bin/gcc  -DHAVE_RWLOCK_T -DHAVE_CONFIG_H -DUNIV_SOLARIS -DHAVE_IB_SOLARIS_ATOMICS=1 -DHAVE_IB_ATOMIC_PTHREAD_T_SOLARIS=1 -DSIZEOF_PTHREAD_T=4 -mcpu=v9 -Wall -O2 -g -DDBUG_OFF -I/home/ssmirnov/sparc01/src/mysql-5.5/include -I/home/ssmirnov/sparc01/src/mysql-5.5/storage/innobase/include -I/home/ssmirnov/sparc01/src/mysql-5.5/storage/innobase/handler -I/home/ssmirnov/sparc01/src/mysql-5.5/sql -I/home/ssmirnov/sparc01/src/mysql-5.5/regex -o CMakeFiles/innobase.dir/page/page0zip.c.o   -c /home/ssmirnov/sparc01/src/mysql-5.5/storage/innobase/page/page0zip.c
make: Fatal error: Command failed for target `storage/innobase/CMakeFiles/innobase.dir/page/page0zip.c.o'
Current working directory /home/ssmirnov/sparc01/src/mysql-5.5
*** Error code 1
The following command caused the error:
make -f storage/innobase/CMakeFiles/innobase.dir/build.make storage/innobase/CMakeFiles/innobase.dir/build
make: Fatal error: Command failed for target `storage/innobase/CMakeFiles/innobase.dir/all'
Current working directory /home/ssmirnov/sparc01/src/mysql-5.5
*** Error code 1
The following command caused the error:
make -f CMakeFiles/Makefile2 all
make: Fatal error: Command failed for target `all

Workaround: specify option -DWITH_ZLIB=bundled

How to repeat:
See description

Suggested fix:
Let cmake raise error
[1 Mar 2013 16:59] Paul DuBois
Noted in 5.5.31, 5.6.11, 5.7.1 changelogs.

CMake did not check whether the system zlib had certain functions 
required for MySQL, resulting in build errors. Now it checks and
falls back to the bundled zlib if the functions are missing.