Fix Windows clock_gettime64 compatibility issue in mimalloc #1996
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.
Fixed Windows DLL error "The procedure entry point clock_gettime64 could not be located"
Problem
Windows users were experiencing runtime errors when launching Arturo builds created with newer MinGW-w64 toolchains:
This error occurred because newer MinGW-w64 versions with glibc compatibility features were introducing
clock_gettime64
symbol dependencies in Windows builds, even though Windows should use native time APIs.Root Cause
The issue was in the embedded mimalloc library configuration:
static.c
andalloc.c
files unconditionally defined_DEFAULT_SOURCE
clock_gettime
calls toclock_gettime64
clock_gettime64
, causing the runtime errorSolution
This PR makes three targeted changes to prevent POSIX time function dependencies in Windows builds:
1. Guard
_DEFAULT_SOURCE
definition instatic.c
2. Guard
_DEFAULT_SOURCE
definition inalloc.c
3. Add explicit guards in
windows/prim.c
Impact
QueryPerformanceCounter
/QueryPerformanceFrequency
)This fix ensures Arturo works correctly on all Windows versions, including older systems that don't have POSIX compatibility layers.
Note: This PR replaces the previous one with the problematic branch name that contained
/
character which was breaking CI workflows.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.