1.8.3: missing `XInitThreads` symbol on linking gthumb (master)
Just started testing some updates from master of the gthumb
(https://gitlab.gnome.org/GNOME/gthumb/) and found that on on linking it fails with message about missing
[tkloczko@pers-jacek x86_64-redhat-linux-gnu]$ ninja
[1/1] Linking target gthumb/gthumb
FAILED: gthumb/gthumb
/usr/bin/gcc -o gthumb/gthumb gthumb/gthumb.p/meson-generated_.._gth-marshal.c.o gthumb/gthumb.p/meson-generated_.._gth-enum-types.c.o gthumb/gthumb.p/meson-generated_.._gth-resources.c.o gthumb/gthumb.p/cairo-scale.c.o gthumb/gthumb.p/cairo-utils.c.o gthumb/gthumb.p/color-utils.c.o gthumb/gthumb.p/dlg-favorite-properties.c.o gthumb/gthumb.p/dlg-location.c.o gthumb/gthumb.p/dlg-personalize-filters.c.o gthumb/gthumb.p/dlg-preferences.c.o gthumb/gthumb.p/dlg-preferences-browser.c.o gthumb/gthumb.p/dlg-preferences-extensions.c.o gthumb/gthumb.p/dlg-preferences-general.c.o gthumb/gthumb.p/dlg-preferences-shortcuts.c.o gthumb/gthumb.p/dlg-sort-order.c.o gthumb/gthumb.p/dom.c.o gthumb/gthumb.p/gimp-op.c.o gthumb/gthumb.p/gio-utils.c.o gthumb/gthumb.p/glib-utils.c.o gthumb/gthumb.p/gsignature.c.o gthumb/gthumb.p/gth-accel-button.c.o gthumb/gthumb.p/gth-accel-dialog.c.o gthumb/gthumb.p/gth-application.c.o gthumb/gthumb.p/gth-auto-paned.c.o gthumb/gthumb.p/gth-async-task.c.o gthumb/gthumb.p/gth-browser.c.o gthumb/gthumb.p/gth-browser-actions-callbacks.c.o gthumb/gthumb.p/gth-buffer-data.c.o gthumb/gthumb.p/gth-color-manager.c.o gthumb/gthumb.p/gth-color-scale.c.o gthumb/gthumb.p/gth-delete-task.c.o gthumb/gthumb.p/gth-duplicable.c.o gthumb/gthumb.p/gth-empty-list.c.o gthumb/gthumb.p/gth-error.c.o gthumb/gthumb.p/gth-extensions.c.o gthumb/gthumb.p/gth-file-chooser-dialog.c.o gthumb/gthumb.p/gth-file-comment.c.o gthumb/gthumb.p/gth-file-data.c.o gthumb/gthumb.p/gth-file-details.c.o gthumb/gthumb.p/gth-file-list.c.o gthumb/gthumb.p/gth-file-properties.c.o gthumb/gthumb.p/gth-file-selection.c.o gthumb/gthumb.p/gth-file-selection-info.c.o gthumb/gthumb.p/gth-file-source.c.o gthumb/gthumb.p/gth-file-source-vfs.c.o gthumb/gthumb.p/gth-file-store.c.o gthumb/gthumb.p/gth-file-tool.c.o gthumb/gthumb.p/gth-file-view.c.o gthumb/gthumb.p/gth-filter.c.o gthumb/gthumb.p/gth-filterbar.c.o gthumb/gthumb.p/gth-filter-editor-dialog.c.o gthumb/gthumb.p/gth-filter-file.c.o gthumb/gthumb.p/gth-filter-grid.c.o gthumb/gthumb.p/gth-folder-tree.c.o gthumb/gthumb.p/gth-grid-view.c.o gthumb/gthumb.p/gth-histogram.c.o gthumb/gthumb.p/gth-histogram-view.c.o gthumb/gthumb.p/gth-hook.c.o gthumb/gthumb.p/gth-icc-profile.c.o gthumb/gthumb.p/gth-icon-cache.c.o gthumb/gthumb.p/gth-image.c.o gthumb/gthumb.p/gth-image-dragger.c.o gthumb/gthumb.p/gth-image-history.c.o gthumb/gthumb.p/gth-image-list-task.c.o gthumb/gthumb.p/gth-image-loader.c.o gthumb/gthumb.p/gth-image-navigator.c.o gthumb/gthumb.p/gth-image-overview.c.o gthumb/gthumb.p/gth-image-preloader.c.o gthumb/gthumb.p/gth-image-saver.c.o gthumb/gthumb.p/gth-image-selector.c.o gthumb/gthumb.p/gth-image-task.c.o gthumb/gthumb.p/gth-image-task-chain.c.o gthumb/gthumb.p/gth-image-utils.c.o gthumb/gthumb.p/gth-image-viewer.c.o gthumb/gthumb.p/gth-image-viewer-tool.c.o gthumb/gthumb.p/gth-info-bar.c.o gthumb/gthumb.p/gth-load-file-data-task.c.o gthumb/gthumb.p/gth-location-bar.c.o gthumb/gthumb.p/gth-location-chooser.c.o gthumb/gthumb.p/gth-location-chooser-dialog.c.o gthumb/gthumb.p/gth-main.c.o gthumb/gthumb.p/gth-main-default-hooks.c.o gthumb/gthumb.p/gth-main-default-metadata.c.o gthumb/gthumb.p/gth-main-default-sort-types.c.o gthumb/gthumb.p/gth-main-default-tests.c.o gthumb/gthumb.p/gth-main-default-types.c.o gthumb/gthumb.p/gth-menu-manager.c.o gthumb/gthumb.p/gth-metadata.c.o gthumb/gthumb.p/gth-metadata-chooser.c.o gthumb/gthumb.p/gth-metadata-provider.c.o gthumb/gthumb.p/gth-metadata-provider-file.c.o gthumb/gthumb.p/gth-monitor.c.o gthumb/gthumb.p/gth-overwrite-dialog.c.o gthumb/gthumb.p/gth-paned.c.o gthumb/gthumb.p/gth-preferences.c.o gthumb/gthumb.p/gth-progress-dialog.c.o gthumb/gthumb.p/gth-property-view.c.o gthumb/gthumb.p/gth-request-dialog.c.o gthumb/gthumb.p/gth-save-file-data-task.c.o gthumb/gthumb.p/gth-save-image-task.c.o gthumb/gthumb.p/gth-screensaver.c.o gthumb/gthumb.p/gth-shortcut.c.o gthumb/gthumb.p/gth-shortcuts-window.c.o gthumb/gthumb.p/gth-sidebar.c.o gthumb/gthumb.p/gth-sidebar-section.c.o gthumb/gthumb.p/gth-statusbar.c.o gthumb/gthumb.p/gth-string-list.c.o gthumb/gthumb.p/gth-tags-entry.c.o gthumb/gthumb.p/gth-tags-file.c.o gthumb/gthumb.p/gth-template-editor-dialog.c.o gthumb/gthumb.p/gth-template-selector.c.o gthumb/gthumb.p/gth-task.c.o gthumb/gthumb.p/gth-test.c.o gthumb/gthumb.p/gth-test-aspect-ratio.c.o gthumb/gthumb.p/gth-test-category.c.o gthumb/gthumb.p/gth-test-chain.c.o gthumb/gthumb.p/gth-test-selector.c.o gthumb/gthumb.p/gth-test-simple.c.o gthumb/gthumb.p/gth-thumb-loader.c.o gthumb/gthumb.p/gth-time.c.o gthumb/gthumb.p/gth-time-selector.c.o gthumb/gthumb.p/gth-toolbox.c.o gthumb/gthumb.p/gth-trash-task.c.o gthumb/gthumb.p/gth-uri-list.c.o gthumb/gthumb.p/gth-user-dir.c.o gthumb/gthumb.p/gth-vfs-tree.c.o gthumb/gthumb.p/gth-viewer-page.c.o gthumb/gthumb.p/gth-window.c.o gthumb/gthumb.p/gth-window-title.c.o gthumb/gthumb.p/gtk-utils.c.o gthumb/gthumb.p/gvaluehash.c.o gthumb/gthumb.p/main.c.o gthumb/gthumb.p/main-migrate-catalogs.c.o gthumb/gthumb.p/pixbuf-cache.c.o gthumb/gthumb.p/pixbuf-io.c.o gthumb/gthumb.p/pixbuf-utils.c.o gthumb/gthumb.p/str-utils.c.o gthumb/gthumb.p/uri-utils.c.o gthumb/gthumb.p/zlib-utils.c.o gthumb/gthumb.p/gnome-desktop-thumbnail.c.o gthumb/gthumb.p/gnome-thumbnail-pixbuf-utils.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,-export-dynamic -Wl,--as-needed -Wl,--gc-sections -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto=auto -flto-partition=none -fuse-linker-plugin -Wl,--build-id=sha1 -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -Wl,--start-group -lm -pthread /usr/lib64/libglib-2.0.so /usr/lib64/libgthread-2.0.so -Wl,--export-dynamic /usr/lib64/libgmodule-2.0.so /usr/lib64/libgobject-2.0.so /usr/lib64/libgio-2.0.so /usr/lib64/libgtk-3.so /usr/lib64/libgdk-3.so /usr/lib64/libz.so /usr/lib64/libpango-1.0.so /usr/lib64/libharfbuzz.so /usr/lib64/libpangocairo-1.0.so /usr/lib64/libcairo.so /usr/lib64/libgdk_pixbuf-2.0.so /usr/lib64/libcairo-gobject.so /usr/lib64/libatk-1.0.so /usr/lib64/libwayland-client.so /usr/lib64/libpng16.so -ljpeg /usr/lib64/libexiv2.so /usr/lib64/libgstreamer-1.0.so /usr/lib64/libgstvideo-1.0.so /usr/lib64/libgstbase-1.0.so /usr/lib64/liblcms2.so /usr/lib64/libcolord.so -ltiff /usr/lib64/libwebp.so /usr/lib64/libsharpyuv.so /usr/lib64/libraw.so /usr/lib64/librsvg-2.so /usr/lib64/libwebkit2gtk-4.0.so /usr/lib64/libsoup-2.4.so /usr/lib64/libjavascriptcoregtk-4.0.so /usr/lib64/libjson-glib-1.0.so /usr/lib64/libsecret-1.so /usr/lib64/libbrasero-burn3.so -Wl,--end-group
/usr/bin/ld: /tmp/cc1DOhqz.lto.o: undefined reference to symbol 'XInitThreads'
/usr/bin/ld: /usr/lib64/libX11.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Checking libX11 source tree I see
[tkloczko@pers-jacek libX11-1.8.3]$ grep -r XInitThreads
README.md: to call XInitThreads() from the library's constructor, thus enabling
src/globals.c: XInitThreads();
src/XlibInt.c:/* these pointers get initialized by XInitThreads */
src/XlibInt.c:/* NOTE: only called if !XTHREADS, or when XInitThreads wasn't called. */
src/locking.c:Status XInitThreads(void)
src/locking.c: "XInitThreads called, but no libthread in the calling program!\n" );
src/locking.c:Status XInitThreads(void)
src/config.h.in:/* Call XInitThreads() from the library constructor */
src/xcb_io.c: fprintf(stderr, "[xcb] You called XInitThreads, this is not your fault\n"); \
src/xcb_io.c: "and XInitThreads has not been called\n"); \
configure.ac: AC_DEFINE(USE_THREAD_SAFETY_CONSTRUCTOR,1,[Call XInitThreads() from the library constructor])
ChangeLog: the predicate callback. But that's not new, non-XInitThreads'd xlib
ChangeLog: global: call XInitThreads() from the library's constructor
ChangeLog: xcb: Clarify the XInitThreads error message
ChangeLog: XInitThreads has been called if _Xglobal_lock != NULL, we may as well
ChangeLog: It adds error messages offering advice (e.g. call XInitThreads() first)
ChangeLog: In the XTHREADS case, after you've called XInitThreads, we can hook
ChangeLog: In the !XTHREADS case, or if you haven't called XInitThreads, you don't
ChangeLog: for XID and sequence sync. Tested with and without XInitThreads(), and
ChangeLog: We acquire the lock even when XInitThreads was not called, so that pure
man/XLockDisplay.man:.so man__libmansuffix__/XInitThreads.__libmansuffix__
man/XUnlockDisplay.man:.so man__libmansuffix__/XInitThreads.__libmansuffix__
man/Makefile.in: XInitThreads.man \
man/Makefile.in: $(XInitThreads_shadows) \
man/Makefile.in:XInitThreads_shadows = \
man/Makefile.am: XInitThreads.man \
man/Makefile.am: $(XInitThreads_shadows) \
man/Makefile.am:XInitThreads_shadows = \
man/XInitThreads.man:.TH XInitThreads __libmansuffix__ __xorgversion__ "XLIB FUNCTIONS"
man/XInitThreads.man:XInitThreads, XLockDisplay, XUnlockDisplay \- multi-threading support
man/XInitThreads.man:Status XInitThreads\^(void);
man/XInitThreads.man:.B XInitThreads
man/XInitThreads.man:.BR XInitThreads .
man/XInitThreads.man:.BR XInitThreads .
man/XInitThreads.man:.BR XInitThreads .
specs/libX11/CH02.xml:<function>XInitThreads</function>.
specs/libX11/CH02.xml:<indexterm significance="preferred"><primary>XInitThreads</primary></indexterm>
specs/libX11/CH02.xml:<funcsynopsis id='XInitThreads'>
specs/libX11/CH02.xml: <funcdef>Status <function>XInitThreads</function></funcdef>
specs/libX11/CH02.xml:<function>XInitThreads</function>
specs/libX11/CH02.xml:<function>XInitThreads</function>.
specs/libX11/CH02.xml:<function>XInitThreads</function>.
include/X11/Xlib.h:extern Status XInitThreads(
I've checked as well my libX11.spec file where I have
%configure \
--disable-loadable-i18n \
--disable-static \
--enable-composecache \
--enable-ipv6 \
--enable-loadable-xcursor \
--enable-specs \
--enable-tcp-transport \
--enable-unix-transport \
--enable-xcms \
--enable-xf86bigfont \
--enable-xkb \
--enable-xlocale \
--enable-xlocaledir \
--enable-xthreads \
%{nil}
and in the build log I see
libX11 1.8.3 will be built with the following settings:
Loadable i18n module support: no
Loadable xcursor library support: yes
Threading support: yes
Use Threads safe API: yes
Use thread safety constructor: yes
XCMS: yes
Internationalization support: yes
XF86BigFont support: yes
XKB support: yes
XLOCALEDIR environment variable support: yes
Compose table cache enabled: yes
Functional specs building enabled: yes
However tesing generated binary indeed I don't see that symbol
[tkloczko@pers-jacek .build_logs]$ objdump -x /usr/lib64/libX11.so.6 | grep XInitThreads
[tkloczko@pers-jacek .build_logs]$