Skip to content

build: Fix linking to libICE when --enable-libsm is used

Michał Górny requested to merge mgorny/libxfce4ui:libsm into master

Convert libsm into a feature, and add libICE as its dependency, in order to fix underlinking. The code in libxfce4ui/xfce-sm-client.c is using the functions from <X11/ICE/ICElib.h> when --enable-libsm is used. If libxfce4ui is compiled with a more strict linker (this could be simulated e.g. by passing -Wl,-z,defs to GNU ld), it fails due to missing function references:

/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: .libs/libxfce4ui_2_la-xfce-sm-client.o: in function `xsmp_new_ice_connection':
/tmp/libxfce4ui/libxfce4ui/xfce-sm-client.c:840:(.text+0xa80): undefined reference to `IceConnectionNumber'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/libxfce4ui/libxfce4ui/xfce-sm-client.c:839:(.text+0xa99): undefined reference to `IceConnectionNumber'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/libxfce4ui/libxfce4ui/xfce-sm-client.c:842:(.text+0xab5): undefined reference to `IceConnectionNumber'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: .libs/libxfce4ui_2_la-xfce-sm-client.o: in function `xsmp_ice_init':
/tmp/libxfce4ui/libxfce4ui/xfce-sm-client.c:875:(.text+0x220a): undefined reference to `IceSetIOErrorHandler'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/libxfce4ui/libxfce4ui/xfce-sm-client.c:876:(.text+0x221d): undefined reference to `IceSetIOErrorHandler'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/libxfce4ui/libxfce4ui/xfce-sm-client.c:881:(.text+0x2239): undefined reference to `IceAddConnectionWatch'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: .libs/libxfce4ui_2_la-xfce-sm-client.o: in function `xsmp_process_ice_messages':
/tmp/libxfce4ui/libxfce4ui/xfce-sm-client.c:806:(.text+0x2875): undefined reference to `IceProcessMessages'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/libxfce4ui/libxfce4ui/xfce-sm-client.c:810:(.text+0x28c5): undefined reference to `IceSetShutdownNegotiation'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/libxfce4ui/libxfce4ui/xfce-sm-client.c:814:(.text+0x28ec): undefined reference to `IceCloseConnection'

Originally reported to https://bugs.gentoo.org/924321

Merge request reports