fix: export absl::time_zone name on MinGW DLL builds#2104
Closed
mvanhorn wants to merge 1 commit into
Closed
Conversation
mkruskal-google
approved these changes
Jul 10, 2026
mkruskal-google
approved these changes
Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Building the monolithic shared library (
-DABSL_BUILD_MONOLITHIC_SHARED_LIBS=ON -DBUILD_SHARED_LIBS=ON) with MinGW on Windows fails at link time with an undefined reference toabsl::time_internal::cctz::GetWindowsLocalTimeZone(). That symbol lives intime/internal/cctz/src/time_zone_name_win.cc, whichCMake/AbseilDll.cmakeonly appends toABSL_INTERNAL_DLL_FILESunderif(MSVC)- so MinGW DLL builds never compile it, even thoughtime_zone_lookup.cccalls it on all Windows toolchains.This splits the single
if(MSVC) ... else() ... endif()block into two independent conditions: thetime_zone_name_win.cc/.hsources are appended underif(WIN32)(covering MSVC, clang-cl, and MinGW), and theflags/*source group stays underif(NOT MSVC)so MinGW keeps receiving exactly the flags sources it gets today.Why this matters
The per-target (non-DLL) build in
absl/time/CMakeLists.txtalready gates this file on$<$<PLATFORM_ID:Windows>:...>- i.e. any Windows platform - so the DLL list'sMSVC-only gate is the inconsistency.WIN32is the correct CMake variable here; the patch sketched in the issue comments usedif(Windows), which is not a variable CMake defines, so this supersedes it. A carry-along fix was merged downstream into microsoft/vcpkg (#50887), but upstream remains broken.Testing
No C++ sources change and there is no test file for the DLL file list, so verification is a CMake configure/build matrix: the monolithic shared-library build now links under MinGW (the previously-undefined
GetWindowsLocalTimeZone()is compiled into the DLL), and the MSVC and non-MSVC builds are unchanged (MSVC still gets the Windows time-zone source viaWIN32; MinGW still gets theflags/*sources viaNOT MSVC).Fixes #2025