CYGWIN: WXQT cannot be built because it uses SM and X11 but they are not linked. (Issue #26691)

8 views
Skip to first unread message

Carlo Bramini

unread,
Jul 13, 2026, 12:24:10 PMĀ (21 hours ago)Ā Jul 13
to wx-...@googlegroups.com, Subscribed
carlo-bramini created an issue (wxWidgets/wxWidgets#26691)

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

Configuration options:

	-G Ninja
	-DCMAKE_CXX_STANDARD=17
	-DwxUSE_STL=ON
	-DwxUSE_IFF=ON
	-DwxBUILD_MONOLITHIC=OFF
	-DwxBUILD_PRECOMP=OFF
	-DwxBUILD_TESTS=OFF
	-DwxBUILD_OPTIMISE=ON
	-DwxUSE_LIBSDL=OFF
	-DwxUSE_EXPAT=sys
	-DwxUSE_LIBJPEG=sys
	-DwxUSE_LIBPNG=sys
	-DwxUSE_LIBTIFF=sys
	-DwxUSE_LIBLZMA=ON
	-DwxUSE_LIBWEBP=sys
	-DwxUSE_STACKWALKER=OFF
	-DwxUSE_FSWATCHER=OFF
	-DwxUSE_REGEX=sys
	-DwxUSE_ZLIB=sys
	-DBUILD_SHARED_LIBS=ON
	-DwxBUILD_SHARED=ON
	-DwxBUILD_TOOLKIT=qt

Configuration log:

-- The C compiler identification is GNU 14.4.0
-- The CXX compiler identification is GNU 14.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of wchar_t
-- Check size of wchar_t - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Looking for lzma_auto_decoder in /usr/lib/liblzma.dll.a
-- Looking for lzma_auto_decoder in /usr/lib/liblzma.dll.a - found
-- Looking for lzma_easy_encoder in /usr/lib/liblzma.dll.a
-- Looking for lzma_easy_encoder in /usr/lib/liblzma.dll.a - found
-- Looking for lzma_lzma_preset in /usr/lib/liblzma.dll.a
-- Looking for lzma_lzma_preset in /usr/lib/liblzma.dll.a - found
-- Found LibLZMA: /usr/lib/liblzma.dll.a (found version "5.8.3")
-- Found CURL: /usr/lib/libcurl.dll.a (found version "8.20.0")
-- Found PkgConfig: /usr/bin/pkg-config (found version "2.5.1")
-- Found LIBSECRET: /usr/include/libsecret-1;/usr/include;/usr/include/glib-2.0;/usr/lib/glib-2.0/include
-- Found Iconv: /usr/lib/libiconv.dll.a
-- Found OpenGL: /usr/lib/libGL.dll.a
-- Found MSPACK: /usr/lib/libmspack.dll.a
-- Checking for module 'sm'
--   Found sm, version 1.2.6
-- Found PCRE2: /usr/lib/libpcre2-16.dll.a (found version "10.47")
-- Found ZLIB: /usr/lib/libz.dll.a (found version "1.3.2")
-- Found EXPAT: /usr/lib/libexpat.dll.a (found version "2.8.0")
-- Found JPEG: /usr/lib/libjpeg.dll.a (found version "80")
-- Found PNG: /usr/lib/libpng.dll.a (found version "1.6.47")
-- Found TIFF: /usr/lib/cmake/tiff (found version "4.7.1")
-- Could NOT find WebP (missing: WebP_DIR)
-- Checking for modules 'libwebp;libwebpdemux'
--   Found libwebp, version 1.6.0
--   Found libwebpdemux, version 1.6.0
-- Performing Test HAVE_VISIBILITY
-- Performing Test HAVE_VISIBILITY - Success
-- Performing Test HAVE_GCC_ATOMIC_BUILTINS
-- Performing Test HAVE_GCC_ATOMIC_BUILTINS - Success
-- Looking for sigaction
-- Looking for sigaction - found
-- Looking for mkstemp
-- Looking for mkstemp - found
-- Performing Test HAVE_STATVFS
-- Performing Test HAVE_STATVFS - Success
-- Looking for fcntl
-- Looking for fcntl - found
-- Looking for setenv
-- Looking for setenv - found
-- Looking for unsetenv
-- Looking for unsetenv - found
-- Looking for nanosleep in time.h
-- Looking for nanosleep
-- Looking for nanosleep - found
-- Looking for nanosleep in time.h - found
-- Looking for uname in sys/utsname.h
-- Looking for uname
-- Looking for uname - found
-- Looking for uname in sys/utsname.h - found
-- Looking for strtok_r
-- Looking for strtok_r - found
-- Looking for fdopen
-- Looking for fdopen - found
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for sysconf
-- Looking for sysconf - found
-- Looking for getpwuid_r in pwd.h
-- Looking for getpwuid_r
-- Looking for getpwuid_r - found
-- Looking for getpwuid_r in pwd.h - found
-- Looking for getgrgid_r in grp.h
-- Looking for getgrgid_r
-- Looking for getgrgid_r - found
-- Looking for getgrgid_r in grp.h - found
-- Looking for sys/soundcard.h
-- Looking for sys/soundcard.h - found
-- Performing Test WX_SOCKLEN_T_IS_SOCKLEN_T
-- Performing Test WX_SOCKLEN_T_IS_SOCKLEN_T - Success
-- Performing Test SOCKOPTLEN_T_IS_SOCKLEN_T
-- Performing Test SOCKOPTLEN_T_IS_SOCKLEN_T - Success
-- Performing Test HAVE_FUNC_GETHOSTBYNAME_R_6
-- Performing Test HAVE_FUNC_GETHOSTBYNAME_R_6 - Failed
-- Performing Test HAVE_FUNC_GETHOSTBYNAME_R_5
-- Performing Test HAVE_FUNC_GETHOSTBYNAME_R_5 - Failed
-- Looking for inet_aton in arpa/inet.h
-- Looking for inet_aton
-- Looking for inet_aton - found
-- Looking for inet_aton in arpa/inet.h - found
-- Looking for inet_addr in arpa/inet.h
-- Looking for inet_addr
-- Looking for inet_addr - found
-- Looking for inet_addr in arpa/inet.h - found
-- Looking for pthread_attr_setstacksize in pthread.h
-- Looking for pthread_attr_setstacksize
-- Looking for pthread_attr_setstacksize - found
-- Looking for pthread_attr_setstacksize in pthread.h - found
-- Looking for pthread_cancel in pthread.h
-- Looking for pthread_cancel
-- Looking for pthread_cancel - found
-- Looking for pthread_cancel in pthread.h - found
-- Looking for pthread_setconcurrency in pthread.h
-- Looking for pthread_setconcurrency
-- Looking for pthread_setconcurrency - found
-- Looking for pthread_setconcurrency in pthread.h - found
-- Looking for sched_yield in pthread.h
-- Looking for sched_yield
-- Looking for sched_yield - found
-- Looking for sched_yield in pthread.h - found
-- Looking for pthread_mutex_timedlock in pthread.h
-- Looking for pthread_mutex_timedlock
-- Looking for pthread_mutex_timedlock - found
-- Looking for pthread_mutex_timedlock in pthread.h - found
-- Looking for pthread_attr_getschedpolicy
-- Looking for pthread_attr_getschedpolicy - found
-- Looking for pthread_attr_setschedparam
-- Looking for pthread_attr_setschedparam - found
-- Looking for sched_get_priority_max
-- Looking for sched_get_priority_max - found
-- Performing Test wxHAVE_PTHREAD_CLEANUP
-- Performing Test wxHAVE_PTHREAD_CLEANUP - Success
-- Performing Test HAVE_PTHREAD_MUTEXATTR_T
-- Performing Test HAVE_PTHREAD_MUTEXATTR_T - Success
-- Performing Test HAVE_PTHREAD_MUTEXATTR_SETTYPE_DECL
-- Performing Test HAVE_PTHREAD_MUTEXATTR_SETTYPE_DECL - Success
-- Performing Test HAVE_ABI_FORCEDUNWIND
-- Performing Test HAVE_ABI_FORCEDUNWIND - Success
-- Looking for localtime_r in time.h
-- Looking for localtime_r
-- Looking for localtime_r - found
-- Looking for localtime_r in time.h - found
-- Looking for gmtime_r in time.h
-- Looking for gmtime_r
-- Looking for gmtime_r - found
-- Looking for gmtime_r in time.h - found
-- Performing Test wxSIZE_T_IS_NOT_UINT
-- Performing Test wxSIZE_T_IS_NOT_UINT - Success
-- Performing Test wxSIZE_T_IS_NOT_ULONG
-- Performing Test wxSIZE_T_IS_NOT_ULONG - Failed
-- Performing Test HAVE_PW_GECOS
-- Performing Test HAVE_PW_GECOS - Success
-- Looking for wcsftime
-- Looking for wcsftime - found
-- Looking for wprintf
-- Looking for wprintf - found
-- Looking for fputws
-- Looking for fputws - found
-- Looking for vswprintf
-- Looking for vswprintf - found
-- Looking for vswscanf
-- Looking for vswscanf - found
-- Looking for wcsdup
-- Looking for wcsdup - found
-- Looking for wcsnlen
-- Looking for wcsnlen - found
-- Looking for wcscasecmp
-- Looking for wcscasecmp - found
-- Looking for wcsncasecmp
-- Looking for wcsncasecmp - found
-- Looking for wcsrctombs
-- Looking for wcsrctombs - not found
-- Looking for wcstoull
-- Looking for wcstoull - found
-- Looking for wcslen
-- Looking for wcslen - found
-- Looking for snprintf
-- Looking for snprintf - found
-- Looking for vsnprintf
-- Looking for vsnprintf - found
-- Looking for strnlen
-- Looking for strnlen - found
-- Looking for strtoull
-- Looking for strtoull - found
-- Looking for setpriority
-- Looking for setpriority - found
-- Looking for gettimeofday
-- Looking for gettimeofday - found
-- Looking for vsscanf
-- Looking for vsscanf - found
-- Looking for wcsrtombs
-- Looking for wcsrtombs - found
-- Looking for fsync
-- Looking for fsync - found
-- Looking for langinfo.h
-- Looking for langinfo.h - found
-- Looking for sched.h
-- Looking for sched.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Performing Test wxTEST_TZ_timezone
-- Performing Test wxTEST_TZ_timezone - Success
-- Performing Test WX_GMTOFF_IN_TM
-- Performing Test WX_GMTOFF_IN_TM - Success
-- Performing Test HAVE_NL_TIME_FIRST_WEEKDAY
-- Performing Test HAVE_NL_TIME_FIRST_WEEKDAY - Failed
-- Looking for dlopen in dlfcn.h
-- Looking for dlopen
-- Looking for dlopen - found
-- Looking for dlopen in dlfcn.h - found
-- Looking for dladdr in dlfcn.h
-- Looking for dladdr
-- Looking for dladdr - not found
-- Looking for dladdr in dlfcn.h - not found
-- Looking for dl_iterate_phdr in link.h
-- Looking for dl_iterate_phdr
-- Looking for dl_iterate_phdr - not found
-- Looking for dl_iterate_phdr in link.h - not found
-- Looking for sys/epoll.h
-- Looking for sys/epoll.h - not found
-- Looking for sys/select.h
-- Looking for sys/select.h - found
-- Looking for xlocale.h
-- Looking for xlocale.h - not found
-- Performing Test HAVE_LOCALE_T
-- Performing Test HAVE_LOCALE_T - Success
-- Check size of size_t
-- Check size of size_t - done
-- Check size of int
-- Check size of int - done
-- Check size of long
-- Check size of long - done
-- Check size of short
-- Check size of short - done
-- Check size of long long
-- Check size of long long - done
-- Check size of ssize_t
-- Check size of ssize_t - done
-- Which libraries should wxWidgets use?
    wxUSE_REGEX:      sys      (enable support for wxRegEx class)
    wxUSE_ZLIB:       sys      (use zlib for LZW compression)
    wxUSE_EXPAT:      sys      (use expat for XML parsing)
    wxUSE_LIBJPEG:    sys      (use libjpeg (JPEG file format))
    wxUSE_LIBPNG:     sys      (use libpng (PNG image format))
    wxUSE_LIBTIFF:    sys      (use libtiff (TIFF file format))
    wxUSE_LIBWEBP:    sys      (use libwebp (WebP file format))
    wxUSE_NANOSVG:    builtin  (use NanoSVG for rasterizing SVG)
    wxUSE_LUNASVG:    OFF      (use LunaSVG for rasterizing SVG (C++17 minimum))
    wxUSE_LIBLZMA:    ON       (use liblzma for LZMA compression)
    wxUSE_LIBSDL:     OFF      (use SDL for audio on Unix)
    wxUSE_LIBMSPACK:  ON       (use libmspack (CHM help files loading))
    wxUSE_WEBVIEW:    OFF      (enable wxWebview)

-- Configured wxWidgets 3.3.3 for CYGWIN
    Min OS Version required at runtime:                Windows 7 / Windows Server 2008 (x64 Edition)
    Which GUI toolkit should wxWidgets use?            qt 5.15.18
    Should wxWidgets be compiled into single library?  OFF
    Should wxWidgets be linked as a shared library?    ON
    Which wxWidgets API compatibility should be used?  3.2
-- Configuring done (61.9s)
-- Generating done (1.6s)
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_Fortran_COMPILER
    CMAKE_Fortran_FLAGS
    CMAKE_LEGACY_CYGWIN_WIN32
    wxUSE_STL

Description

After issue #26664 has been fixed, I tried again to update my package of wxWidgets for Cygwin to version 3.3.3.
The libraries based on GTK+ have been compiled perfectly.
Unfortunately, the ones based on Qt are not.
My build process hangs with this message:

[461/824] Linking CXX shared library lib/cygwx_qtu_core-3.3-3.dll
FAILED: [code=1] lib/cygwx_qtu_core-3.3-3.dll lib/libwx_qtu_core-3.3.dll.a

and with these reports:

/usr/x86_64-pc-cygwin/bin/ld: libs/core/CMakeFiles/wxcore.dir/__/__/__/__/src/unix/apptraits.cpp.o: in function `wxX11Display::wxX11Display()':
/usr/src/debug/wxWidgets_3.3-3.3.3-1/include/wx/unix/utilsx11.h:62:(.text+0x5f2): undefined reference to `XOpenDisplay'
/usr/x86_64-pc-cygwin/bin/ld: libs/core/CMakeFiles/wxcore.dir/__/__/__/__/src/unix/apptraits.cpp.o: in function `GetSM':
/usr/src/debug/wxWidgets_3.3-3.3.3-1/src/unix/apptraits.cpp:50:(.text+0x64f): undefined reference to `SmcOpenConnection'
/usr/x86_64-pc-cygwin/bin/ld: /usr/src/debug/wxWidgets_3.3-3.3.3-1/src/unix/apptraits.cpp:66:(.text+0x663): undefined reference to `SmcVendor'
/usr/x86_64-pc-cygwin/bin/ld: /usr/src/debug/wxWidgets_3.3-3.3.3-1/src/unix/apptraits.cpp:70:(.text+0x68e): undefined reference to `SmcCloseConnection'
/usr/x86_64-pc-cygwin/bin/ld: libs/core/CMakeFiles/wxcore.dir/__/__/__/__/src/unix/apptraits.cpp.o: in function `wxX11Display::~wxX11Display()':
/usr/src/debug/wxWidgets_3.3-3.3.3-1/include/wx/unix/utilsx11.h:63:(.text+0x6f5): undefined reference to `XCloseDisplay'
/usr/x86_64-pc-cygwin/bin/ld: /usr/src/debug/wxWidgets_3.3-3.3.3-1/include/wx/unix/utilsx11.h:63:(.text+0x14e4): undefined reference to `XCloseDisplay'
collect2: error: ld returned 1 exit status

It seems that wx_qtu_core-3.3 depends on X11 and SM, but these libraries are not added at link time.
I also did an experiment by doing an hack, so I added myself -lX11 and -lSM into the ninja script and the library has been linked successfully.

It is interesting to see that I had not this error when I built version 3.3.2.
By looking these CMakeCache.txt, for version 3.3.2 I found this:

//use code to detect X11 session manager
wxUSE_DETECT_SM:BOOL=OFF

Instead, for version 3.3.3 I have found this:

//use code to detect X11 session manager
wxUSE_DETECT_SM:BOOL=ON

And when CMake was configuring, this was printed on the console, as you can see into the log above:

-- Checking for module 'sm'
--   Found sm, version 1.2.6

and these extra information is added into its CMakeCache.txt:

SM_CFLAGS:INTERNAL=-I/usr/include;-I/usr/include/uuid
SM_CFLAGS_I:INTERNAL=
SM_CFLAGS_OTHER:INTERNAL=
SM_FOUND:INTERNAL=1
SM_INCLUDEDIR:INTERNAL=/usr/include
SM_INCLUDE_DIRS:INTERNAL=/usr/include;/usr/include/uuid
SM_LDFLAGS:INTERNAL=-L/usr/lib;-lSM
SM_LDFLAGS_OTHER:INTERNAL=
SM_LIBDIR:INTERNAL=/usr/lib
SM_LIBRARIES:INTERNAL=SM
SM_LIBRARY_DIRS:INTERNAL=/usr/lib
SM_LIBS:INTERNAL=
SM_LIBS_L:INTERNAL=
SM_LIBS_OTHER:INTERNAL=
SM_LIBS_PATHS:INTERNAL=
SM_MODULE_NAME:INTERNAL=sm
SM_PREFIX:INTERNAL=/usr
SM_STATIC_CFLAGS:INTERNAL=-I/usr/include;-I/usr/include/uuid
SM_STATIC_CFLAGS_I:INTERNAL=
SM_STATIC_CFLAGS_OTHER:INTERNAL=
SM_STATIC_INCLUDE_DIRS:INTERNAL=/usr/include;/usr/include/uuid
SM_STATIC_LDFLAGS:INTERNAL=-L/usr/lib;-lSM;-lICE;-luuid
SM_STATIC_LDFLAGS_OTHER:INTERNAL=
SM_STATIC_LIBDIR:INTERNAL=
SM_STATIC_LIBRARIES:INTERNAL=SM;ICE;uuid
SM_STATIC_LIBRARY_DIRS:INTERNAL=/usr/lib
SM_STATIC_LIBS:INTERNAL=
SM_STATIC_LIBS_L:INTERNAL=
SM_STATIC_LIBS_OTHER:INTERNAL=
SM_STATIC_LIBS_PATHS:INTERNAL=
SM_VERSION:INTERNAL=1.2.6
SM_sm_INCLUDEDIR:INTERNAL=
SM_sm_LIBDIR:INTERNAL=
SM_sm_PREFIX:INTERNAL=
SM_sm_VERSION:INTERNAL=

However, X11 is not searched into both versions of wxWidgets.
Now, I tried to check the affected source code:

https://github.com/wxWidgets/wxWidgets/blob/fcdaa107fb5d295972855ca5e362e40dd37a17e8/src/unix/apptraits.cpp#L35-L39

Here you can see that the code includes X11/SM/SMlib.h and it is using stuff like SmcOpenConnection().
Besides that, it also includes wx/unix/utilsx11.h that uses functions like XOpenDisplay().

However, here:

https://github.com/wxWidgets/wxWidgets/blob/fcdaa107fb5d295972855ca5e362e40dd37a17e8/build/cmake/toolkit.cmake#L124-L129

we can see that find_package(X11 REQUIRED) is not called when WXQT is the target.
In addition to this, the detection of SM is handled here:

https://github.com/wxWidgets/wxWidgets/blob/fcdaa107fb5d295972855ca5e362e40dd37a17e8/build/cmake/init.cmake#L813-L824

But it doesn't search also for X11.
By looking the code into apptraits.cpp, detecting both SM and X11 is unavoidable because they are both used into that CPP source.
In conclusion:

  1. CMake finds libSM correctly because, evidently, wxUSE_DETECT_SM is ON, but it's ok and afterall it's found.
  2. into apptraits.cpp, both SM and X11 are used but here it seems that only detection for SM is done.
  3. both libSM and libX11 are not added at link time, which causes the errors: libSM found but not included, libX11 not even searched.

In my opinion, I could fix this error quite easily, by changing this line:

https://github.com/wxWidgets/wxWidgets/blob/fcdaa107fb5d295972855ca5e362e40dd37a17e8/build/cmake/init.cmake#L814

into this:

if(APPLE OR WIN32 OR CYGWIN)

But it is not clear to me what you are trying to do here, so at the moment I'm reporting this issue here.
Perhaps, this error is not seen elsewhere because MinGW/Cygwin don't allow undefined symbols at link time, while on these platforms it allowed to discover the issue.
If it could be interesting, my precompiled package of wxWidgets 3.3.2 for Cygwin could be found here:

https://github.com/carlo-bramini/packages-cygwin/tree/main/wxWidgets/wxWidgets_3.3.x86_64

Sincerely.

Platform and version information

  • wxWidgets version you are building: 3.3.3
  • wxWidgets port you are building: wxQT
  • OS and its version: Windows/Cygwin
  • Compiler being used: gcc version 14.4.0 (GCC)
  • Non-default compiler options, if any : --

—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26691@github.com>

Reply all
Reply to author
Forward
0 new messages