Bug #110745 Build failure with -DWITH_ZLIB=system

Submitted: 20 Apr 2023 7:25 Modified: 3 May 2023 21:19
Reporter: Ronny Perinke Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:8.0.33 OS:Linux
Assigned to: CPU Architecture:x86
Tags: cmake, zlib

[20 Apr 2023 7:25] Ronny Perinke
Description:
When MySQL is compiled with -DWITH_ZLIB=system, the build fails at an early stage with "Cannot find system zlib libraries." even though zlib was found. ZLIB_INCLUDE_DIR, ZLIB_LIBRARY_RELEASE and other ZLIB variables are set in CMakeCache.txt. The error does not occur with MySQL 8.0.23.

This is caused by changing "FIND_SYSTEM_ZLIB" from MACRO to FUNCTION. FIND_SYSTEM_ZLIB calls FIND_PACKAGE(ZLIB) and all variables like ZLIB_FOUND are therefore limited to the scope of the function (see https://cmake.org/cmake/help/latest/command/function.html#command:function). But ZLIB_FOUND is also used outside the function where it is no longer defined.

How to repeat:
Build Mysql 8.0.33 -DWITH_ZLIB=system

Suggested fix:
Change FIND_SYSTEM_ZLIB in cmake/zlib.cmake from FUNCTION back to MACRO.
[20 Apr 2023 7:26] Ronny Perinke
Patch cmake/zlib.cmake

Attachment: mysql-zlib-cmake.patch (text/plain), 651 bytes.

[20 Apr 2023 8:54] MySQL Verification Team
Hello Ronny Perinke,

Thank you for the report and feedback.

regards,
Umesh
[3 May 2023 21:19] Philip Olson
Posted by developer:
 
Fixed as of the upcoming MySQL Server 8.0.34 and 8.1.0 releases, and here's the proposed changelog entry from the documentation team:

MySQL would not build with -DWITH_ZLIB=system; it'd complain about not
finding the system zlib library despite finding it.

Thank you for the bug report.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.058 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.