Fix bundled libuv Windows CPU-info output pointer type

This commit is contained in:
Max Lv
2026-09-11 13:53:16 +08:00
parent babd3feb06
commit e13d7b7ac5
3 changed files with 28 additions and 0 deletions
+1
View File
@@ -66,6 +66,7 @@ endif()
set(LIBUV_BUILD_SHARED OFF CACHE BOOL "" FORCE)
set(LIBUV_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(LIBUV_BUILD_BENCH OFF CACHE BOOL "" FORCE)
include(LibuvWindows.cmake)
add_subdirectory("${uv_SOURCE}" uv EXCLUDE_FROM_ALL)
add_library(ss_uv ALIAS uv_a)
include(${PROJECT_SOURCE_DIR}/cmake/EventLoop.cmake)
+23
View File
@@ -0,0 +1,23 @@
# libuv 1.52.1 passes const char ** to a converter that writes char **.
# GCC 14+ rejects this. Keep the archive untouched and use a mutable temporary
# in the extracted source, assigning it to the const public field afterwards.
if(WIN32)
set(uv_util "${uv_SOURCE}/src/win/util.c")
file(READ "${uv_util}" uv_util_content)
set(uv_old [=[ uv__convert_utf16_to_utf8(cpu_brand,
cpu_brand_size / sizeof(WCHAR),
&(cpu_info->model));]=])
set(uv_new [=[ char* model = NULL;
uv__convert_utf16_to_utf8(cpu_brand,
cpu_brand_size / sizeof(WCHAR),
&model);
cpu_info->model = model;]=])
string(FIND "${uv_util_content}" "${uv_old}" uv_old_offset)
string(FIND "${uv_util_content}" "${uv_new}" uv_new_offset)
if(NOT uv_old_offset EQUAL -1)
string(REPLACE "${uv_old}" "${uv_new}" uv_util_content "${uv_util_content}")
file(WRITE "${uv_util}" "${uv_util_content}")
elseif(uv_new_offset EQUAL -1)
message(FATAL_ERROR "Bundled libuv changed; review the Windows CPU-info compatibility fix")
endif()
endif()
+4
View File
@@ -22,6 +22,10 @@ CMake adapter compiles the portable C backends listed in upstream Makefile.am;
it is maintained by this project, not upstream. Upstream known-answer tests
are built and run under the `vendor` CTest label. SIMD acceleration needs its
own compiler probes and validation before enabling additional backends.
On Windows, `LibuvWindows.cmake` applies a checked, idempotent fix to extracted
libuv 1.52.1 CPU-info code: a mutable string temporary replaces an incompatible
`const char **` output argument rejected by GCC 14+. The archive is unchanged.
Libuv replaces libev. Its Windows socket polling uses AFD readiness requests
completed through IOCP; macOS uses kqueue. The internal `ss_event` layer combines
read/write watchers for each descriptor and owns libuv handle lifetime separately