Fix check for extended locale functions in CMake (PR #25750)

16 views
Skip to first unread message

VZ

unread,
Sep 1, 2025, 7:11:34 PM (5 days ago) Sep 1
to wx-...@googlegroups.com, Subscribed

HAVE_LOCALE_T is misnamed, as it must only be defined not just when locale_t type is available but when the functions using it, such as strxxx_l(), are available.

Due to the confusion about the nature of this symbol, CMake didn't check for it correctly and only checked for its existence, but musl (used by e.g. Alpine) does define the type without providing any of the functions using it, which resulted in build errors later.

Fix this by checking for both the type and the functions in CMake too, just as we do in configure.

Closes #25749.


You can view, comment on, or merge this pull request online at:

  https://github.com/wxWidgets/wxWidgets/pull/25750

Commit Summary

  • 1ff612e Fix check for extended locale functions in CMake

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/25750@github.com>

Maarten

unread,
Sep 1, 2025, 7:17:09 PM (5 days ago) Sep 1
to wx-...@googlegroups.com, Subscribed

@MaartenBent commented on this pull request.


In build/cmake/setup.cmake:

>      endif()
-    check_type_size(locale_t LOCALE_T)
+    wx_check_c_source_compiles("
+        locale_t t;
+        strtod_l(NULL, NULL, t);
+        strtol_l(NULL, NULL, 0, t);
+        strtoul_l(NULL, NULL, 0, t);
+"
+        HAVE_LOCALE_T
+        ${xlocale_headers}
+        )
     set(CMAKE_EXTRA_INCLUDE_FILES)

You can get rid of this line too. CMAKE_EXTRA_INCLUDE_FILES is not used anymore so no need to reset it.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/25750/review/3174560182@github.com>

VZ

unread,
Sep 1, 2025, 7:29:59 PM (5 days ago) Sep 1
to wx-...@googlegroups.com, Subscribed

@vadz commented on this pull request.


In build/cmake/setup.cmake:

>      endif()
-    check_type_size(locale_t LOCALE_T)
+    wx_check_c_source_compiles("
+        locale_t t;
+        strtod_l(NULL, NULL, t);
+        strtol_l(NULL, NULL, 0, t);
+        strtoul_l(NULL, NULL, 0, t);
+"
+        HAVE_LOCALE_T
+        ${xlocale_headers}
+        )
     set(CMAKE_EXTRA_INCLUDE_FILES)

Sorry, I planned to do it but somehow forgot. I'll do it when merging (if you don't have any further comments).


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/25750/review/3174580934@github.com>

Maarten

unread,
Sep 1, 2025, 7:32:32 PM (5 days ago) Sep 1
to wx-...@googlegroups.com, Subscribed

@MaartenBent commented on this pull request.


In build/cmake/setup.cmake:

>      endif()
-    check_type_size(locale_t LOCALE_T)
+    wx_check_c_source_compiles("
+        locale_t t;
+        strtod_l(NULL, NULL, t);
+        strtol_l(NULL, NULL, 0, t);
+        strtoul_l(NULL, NULL, 0, t);
+"
+        HAVE_LOCALE_T
+        ${xlocale_headers}
+        )
     set(CMAKE_EXTRA_INCLUDE_FILES)

No other comments. CMake builds / Ubuntu 22.04 still passes the test, so looks good to me.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/25750/review/3174582135@github.com>

VZ

unread,
Sep 1, 2025, 7:36:15 PM (5 days ago) Sep 1
to wx-...@googlegroups.com, Subscribed

Closed #25750.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/25750/issue_event/19448826322@github.com>

VZ

unread,
Sep 1, 2025, 7:36:17 PM (5 days ago) Sep 1
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#25750)

Merged in the commit above.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/25750/c3243402953@github.com>

Reply all
Reply to author
Forward
0 new messages