[SERVER-79591] zlib fails to compile on Clang-15 Created: 01/Aug/23  Updated: 29/Oct/23  Resolved: 28/Aug/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.1.0-rc0

Type: Task Priority: Major - P3
Reporter: Colin Stolley Assignee: Matt Kneiser
Resolution: Fixed Votes: 0
Labels: auto-reverted
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Problem/Incident
Assigned Teams:
Storage Execution
Backwards Compatibility: Minor Change
Sprint: Execution NAMR Team 2023-09-04
Participants:
Linked BF Score: 35

 Description   

Our zlib dependency fails to compile on clang-15 because -Wdeprecated-non-prototype is enabled by default.

Upstream appears to be aware but as of today it hasn't been fixed yet: https://github.com/madler/zlib/issues/633

One possible work-around would be to disable this warning for zlib, eg:

diff --git a/src/third_party/scripts/zlib_get_sources.sh b/src/third_party/scripts/zlib_get_sources.sh
index e48154de802..aae536ad400 100755
--- a/src/third_party/scripts/zlib_get_sources.sh
+++ b/src/third_party/scripts/zlib_get_sources.sh
@@ -51,6 +51,8 @@ env.Append(CPPDEFINES=["HAVE_STDARG_H"])
 if not env.TargetOSIs('windows'):
     env.Append(CPPDEFINES=["HAVE_UNISTD_H"])

+env.Append(CCFLAGS=["-Wno-deprecated-non-prototype"])
+
 env.Library(
     target="zlib",
     source=[



 Comments   
Comment by Githook User [ 25/Aug/23 ]

Author:

{'name': 'Matt Kneiser', 'email': 'matt.kneiser@mongodb.com', 'username': 'themattman'}

Message: SERVER-79591 Update zlib to 1.3 - with build fix
Branch: master
https://github.com/mongodb/mongo/commit/41c05306181e880345ec75bb0a166ddbd93d66ae

Comment by xgen-buildbaron-user [ 24/Aug/23 ]

Ticket re-opened due to revert. compile_ninja_quick began a consistent failure of compile_ninja_quick

Comment by Githook User [ 24/Aug/23 ]

Author:

{'name': 'auto-revert-processor', 'email': 'dev-prod-dag@mongodb.com', 'username': ''}

Message: Revert "SERVER-79591 Update zlib to 1.3"

This reverts commit 01a49eaa76cdc334760e9b0d40ca98370dd73277.
Branch: master
https://github.com/mongodb/mongo/commit/50add57ac253d49a41de7f72e8089898863cabab

Comment by Githook User [ 24/Aug/23 ]

Author:

{'name': 'Matt Kneiser', 'email': 'matt.kneiser@mongodb.com', 'username': 'themattman'}

Message: SERVER-79591 Update zlib to 1.3
Branch: master
https://github.com/mongodb/mongo/commit/01a49eaa76cdc334760e9b0d40ca98370dd73277

Comment by Colin Stolley [ 22/Aug/23 ]

It looks like upstream has addressed the issue in their latest release: https://github.com/madler/zlib/issues/842 so upgrading our dependency is probably the way to go.

Comment by Matt Kneiser [ 22/Aug/23 ]

Though this issue appears to only impact clang 15 via clang's own release notes, it hits the clang 14.0.3 binary that ships with the XCode toolchain version 14.3.1 that my intel-based Ventura macbook runs on. There is no mention of this new diagnostic option with clang -help. However, the commit adding this support is dated 4/8/22 whereas the 14.0.3 tag is dated a few weeks later on 4/28/22. One of the linked issues to the zlib issue mentions this problem with XCode as well which confirms the behavior I'm seeing.

 

$ clang --version
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: x86_64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 14.3.1.0.1.1683849156
volume: /
location: /
install-time: 1685779587 

$ sw_vers
ProductName:		macOS
ProductVersion:		13.5
BuildVersion:		22G74 

Long story short - this issue blocks successful compilation on Ventura.

 

Generated at Thu Feb 08 06:41:22 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.