Building with CMake on Alpine (musl) fails (configure works, though) (Issue #25749)

18 views
Skip to first unread message

Luke

unread,
Sep 1, 2025, 1:27:51 PM (6 days ago) Sep 1
to wx-...@googlegroups.com, Subscribed
lszl84 created an issue (wxWidgets/wxWidgets#25749)

Build System Used

I build wxWidgets and/or my application using:

  • CMake
  • configure
  • mingw32-make with makefile.gcc
  • MSBuild (Microsoft Visual Studio solution file)
  • nmake with makefile.vc
  • Xcode

Description

When building with CMake, I get strtoul_l errors:

[563/976] Building CXX object libs/core/CMakeFiles/wxcore.dir/__/__/__/__/src/unix/fontenum.cpp.o
[564/976] Building CXX object libs/core/CMakeFiles/wxcore.dir/__/__/__/__/src/unix/dialup.cpp.o
ninja: job failed: /usr/bin/c++ -DWXBUILDING -DWXDLLNAME=wx_baseu-3.3 -DWXMAKINGDLL_BASE -DWX_PRECOMP -D_FILE_OFFSET_BITS=64 -D_UNICODE -D__WXGTK3__ -D__WXGTK__ -DwxUSE_BASE=1 -DwxUSE_GUI=0 -Dwxbase_EXPORTS -I/home/luke/Developer/wxbuild/lib/wx/include/gtk3-unicode-3.3 -I/home/luke/Developer/wxWidgets/include -g -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -Winvalid-pch -include /home/luke/Developer/wxbuild/libs/base/CMakeFiles/wxbase.dir/cmake_pch.hxx -MD -MT libs/base/CMakeFiles/wxbase.dir/__/__/__/__/src/common/xlocale.cpp.o -MF libs/base/CMakeFiles/wxbase.dir/__/__/__/__/src/common/xlocale.cpp.o.d -o libs/base/CMakeFiles/wxbase.dir/__/__/__/__/src/common/xlocale.cpp.o -c /home/luke/Developer/wxWidgets/src/common/xlocale.cpp
In file included from /home/luke/Developer/wxWidgets/src/common/xlocale.cpp:29:
/home/luke/Developer/wxWidgets/include/wx/xlocale.h: In function 'long int wxStrtol_lA(const char*, char**, int, const wxXLocale&)':
/home/luke/Developer/wxWidgets/include/wx/xlocale.h:240:45: error: 'strtol_l' was not declared in this scope; did you mean 'strtoll'?
  240 |     #define wxCRT_Strtol_lA wxXLOCALE_IDENT(strtol_l)
      |                                             ^~~~~~~~
/home/luke/Developer/wxWidgets/include/wx/xlocale.h:56:39: note: in definition of macro 'wxXLOCALE_IDENT'
   56 |         #define wxXLOCALE_IDENT(name) name
      |                                       ^~~~
/home/luke/Developer/wxWidgets/include/wx/xlocale.h:246:18: note: in expansion of macro 'wxCRT_Strtol_lA'
  246 |         { return wxCRT_Strtol_lA(c, endptr, base, loc.Get()); }
      |                  ^~~~~~~~~~~~~~~
/home/luke/Developer/wxWidgets/include/wx/xlocale.h: In function 'long unsigned int wxStrtoul_lA(const char*, char**, int, const wxXLocale&)':
/home/luke/Developer/wxWidgets/include/wx/xlocale.h:241:46: error: 'strtoul_l' was not declared in this scope; did you mean 'strtoull'?
  241 |     #define wxCRT_Strtoul_lA wxXLOCALE_IDENT(strtoul_l)
      |                                              ^~~~~~~~~
/home/luke/Developer/wxWidgets/include/wx/xlocale.h:56:39: note: in definition of macro 'wxXLOCALE_IDENT'
   56 |         #define wxXLOCALE_IDENT(name) name
      |                                       ^~~~
/home/luke/Developer/wxWidgets/include/wx/xlocale.h:248:18: note: in expansion of macro 'wxCRT_Strtoul_lA'
  248 |         { return wxCRT_Strtoul_lA(c, endptr, base, loc.Get()); }
      |                  ^~~~~~~~~~~~~~~~
/home/luke/Developer/wxWidgets/include/wx/xlocale.h: In function 'double wxStrtod_l(const wchar_t*, wchar_t**, const wxXLocale&)':
/home/luke/Developer/wxWidgets/include/wx/xlocale.h:295:45: error: 'wcstod_l' was not declared in this scope; did you mean 'wcstoull'?
  295 |     #define wxCRT_Strtod_lW wxXLOCALE_IDENT(wcstod_l)
      |                                             ^~~~~~~~
/home/luke/Developer/wxWidgets/include/wx/xlocale.h:56:39: note: in definition of macro 'wxXLOCALE_IDENT'
   56 |         #define wxXLOCALE_IDENT(name) name
      |                                       ^~~~
/home/luke/Developer/wxWidgets/include/wx/xlocale.h:300:18: note: in expansion of macro 'wxCRT_Strtod_lW'
  300 |         { return wxCRT_Strtod_lW(c, endptr, loc.Get()); }
      |                  ^~~~~~~~~~~~~~~
/home/luke/Developer/wxWidgets/include/wx/xlocale.h: In function 'long int wxStrtol_l(const wchar_t*, wchar_t**, int, const wxXLocale&)':
/home/luke/Developer/wxWidgets/include/wx/xlocale.h:296:45: error: 'wcstol_l' was not declared in this scope; did you mean 'wcstoll'?
  296 |     #define wxCRT_Strtol_lW wxXLOCALE_IDENT(wcstol_l)
      |                                             ^~~~~~~~
/home/luke/Developer/wxWidgets/include/wx/xlocale.h:56:39: note: in definition of macro 'wxXLOCALE_IDENT'
   56 |         #define wxXLOCALE_IDENT(name) name
      |                                       ^~~~
/home/luke/Developer/wxWidgets/include/wx/xlocale.h:302:18: note: in expansion of macro 'wxCRT_Strtol_lW'
  302 |         { return wxCRT_Strtol_lW(c, endptr, base, loc.Get()); }
      |                  ^~~~~~~~~~~~~~~
/home/luke/Developer/wxWidgets/include/wx/xlocale.h: In function 'long unsigned int wxStrtoul_l(const wchar_t*, wchar_t**, int, const wxXLocale&)':
/home/luke/Developer/wxWidgets/include/wx/xlocale.h:297:46: error: 'wcstoul_l' was not declared in this scope; did you mean 'wcstoull'?
  297 |     #define wxCRT_Strtoul_lW wxXLOCALE_IDENT(wcstoul_l)
      |                                              ^~~~~~~~~
/home/luke/Developer/wxWidgets/include/wx/xlocale.h:56:39: note: in definition of macro 'wxXLOCALE_IDENT'
   56 |         #define wxXLOCALE_IDENT(name) name
      |                                       ^~~~
/home/luke/Developer/wxWidgets/include/wx/xlocale.h:304:18: note: in expansion of macro 'wxCRT_Strtoul_lW'
  304 |         { return wxCRT_Strtoul_lW(c, endptr, base, loc.Get()); }
      |                  ^~~~~~~~~~~~~~~~
ninja: subcommand failed
~/Developer/wxbuild $ c++ --version
c++ (Alpine 14.2.0) 14.2.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

~/Developer/wxbuild $ cc --version
cc (Alpine 14.2.0) 14.2.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

~/Developer/wxbuild $ uname -a
Linux alpine 6.12.44-0-lts #1-Alpine SMP PREEMPT_DYNAMIC 2025-08-29 07:25:37 x86_64 Linux

Using instructions from https://docs.wxwidgets.org/latest/overview_cmake.html:

cd wxbuild
cmake -G "Ninja" ~/Developer/wxWidgets
cmake --build . -j

Interestingly, everything works well when using the configure script as described here https://wiki.wxwidgets.org/Compiling_and_getting_started

cd wxWidgets
mkdir gtk-build     
cd gtk-build
../configure      
make -j3  

Platform and version information

  • wxWidgets version you are building: current master
  • wxWidgets port you are building: wxGTK
  • OS and its version: Linux alpine 6.12.44-0-lts
  • Compiler being used: gcc 14.2
  • Non-default compiler options, if any :


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/issues/25749@github.com>

VZ

unread,
Sep 1, 2025, 4:25:12 PM (6 days ago) Sep 1
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#25749)

I think musl (used in Alpine) doesn't actually have xlocale support, so something must be wrong with the test for it in build/cmake/setup.cmake. In fact, it looks like we don't do anything with the result of the test, I think we need to reset wxUSE_XLOCALE to 0 if(NOT HAVE_LOCALE_T) or something like that. Should be simple to fix, if you can test 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/issues/25749/3243209298@github.com>

Maarten

unread,
Sep 1, 2025, 6:15:22 PM (6 days ago) Sep 1
to wx-...@googlegroups.com, Subscribed
MaartenBent left a comment (wxWidgets/wxWidgets#25749)

CMake does use the results of HAVE_XLOCALE_H and HAVE_LOCALE_T, their values are used when generating setup.h from setup.h.in.

And apparently HAVE_LOCALE_T is 1/TRUE, because this will define wxHAS_XLOCALE_SUPPORT in wx/featrues.h, which will then enable the code in wx/xlocale.h.

What is the CMake output when configuring?

Looking for xlocale.h
Looking for xlocale.h - not found
Check size of locale_t
Check size of locale_t - failed


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/issues/25749/3243320553@github.com>

VZ

unread,
Sep 1, 2025, 6:50:42 PM (6 days ago) Sep 1
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#25749)

I had Alpine 3.19 container lying around, so I ran cmake in it and got

-- Looking for xlocale.h
-- Looking for xlocale.h - not found
-- Check size of locale_t
-- Check size of locale_t - done

and I can confirm that the build fails with the error given here afterwards. Looking...


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/issues/25749/3243349565@github.com>

VZ

unread,
Sep 1, 2025, 6:56:39 PM (6 days ago) Sep 1
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#25749)

... OK, so musl does define locale_t but doesn't define any of strxxx_l() and cmake, unlike configure, doesn't check for them. I'll add this.


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/issues/25749/3243354194@github.com>

VZ

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

Closed #25749 as completed via 170c386.


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/issue/25749/issue_event/19448822965@github.com>

Reply all
Reply to author
Forward
0 new messages