Cannot link to Wayland Cursor statically
Weston's clients can only be built against the Wayland Cursor library when it is built as a shared library. When attempting to link against a static version of Wayland, there are duplicate symbols due to the symbol os_create_anonymous_file
from the os-compatibility.c
file. This file does in fact, appear to be used directly in the Wayland source code as part of Wayland Cursor as seen here. I hit this same issue in libdecor previously, as described in this issue.
This can probably just be fixed by renaming the symbol to avoid the conflict.
The build failure follows below for reference.
[272/379] Linking target clients/weston-simple-egl
FAILED: clients/weston-simple-egl
gcc -o clients/weston-simple-egl clients/weston-simple-egl.p/meson-generated_.._.._protocol_fractional-scale-v1-protocol.c.o clients/weston-simple-egl.p/meson-generated_.._.._protocol_tearing-control-v1-protocol.c.o clients/weston-simple-egl.p/meson-generated_.._.._protocol_viewporter-protocol.c.o clients/weston-simple-egl.p/meson-generated_.._.._protocol_xdg-shell-protocol.c.o clients/weston-simple-egl.p/meson-generated_.._.._protocol_ivi-application-protocol.c.o clients/weston-simple-egl.p/simple-egl.c.o clients/weston-simple-egl.p/.._shared_matrix.c.o -Wl,--as-needed -Wl,--no-undefined -fuse-ld=lld -Wl,-rpath,/home/jordan/.conan2/p/b/libgl3ac61fc112c8e/p/lib -Wl,-rpath-link,/home/jordan/.conan2/p/b/libgl3ac61fc112c8e/p/lib -Wl,--start-group shared/libshared.a -lm /home/jordan/.conan2/p/b/wayla86eca9b4f04c0/p/lib/libwayland-client.a -lpthread -lrt /home/jordan/.conan2/p/b/libffd42f788d90937/p/lib/libffi.a /home/jordan/.conan2/p/b/wayla86eca9b4f04c0/p/lib/libwayland-server.a /home/jordan/.conan2/p/b/pixma4271311a66625/p/lib/libpixman-1.a /home/jordan/.conan2/p/b/xkbco529ba226868c9/p/lib/libxkbcommon.a /home/jordan/.conan2/p/b/libgl3ac61fc112c8e/p/lib/libEGL.so /home/jordan/.conan2/p/b/libgl3ac61fc112c8e/p/lib/libGLdispatch.so -ldl /usr/lib64/libX11.so /home/jordan/.conan2/p/b/wayla86eca9b4f04c0/p/lib/libwayland-egl.a /home/jordan/.conan2/p/b/libgl3ac61fc112c8e/p/lib/libGLESv2.so /home/jordan/.conan2/p/b/wayla86eca9b4f04c0/p/lib/libwayland-cursor.a -Wl,--end-group
ld.lld: error: duplicate symbol: os_create_anonymous_file
>>> defined at os-compatibility.c:179 (../src/shared/os-compatibility.c:179)
>>> libshared.a.p/os-compatibility.c.o:(os_create_anonymous_file) in archive shared/libshared.a
>>> defined at os-compatibility.c:119 (../src/cursor/os-compatibility.c:119)
>>> os-compatibility.c.o:(.text+0x37) in archive /home/jordan/.conan2/p/b/wayla86eca9b4f04c0/p/lib/libwayland-cursor.a
collect2: error: ld returned 1 exit status
[291/379] Compiling C object clients/weston-editor.p/editor.c.o
ninja: build stopped: subcommand failed.