mold: error: undefined symbol: wl_*
Author: NelsonSRCreated Jul 30, 2026Updated Sep 29, 2026
LabelsPlatform: LinuxTriage: NeededComponent: Build system
Bug report
Describe the bug
Here is a clear and concise description of what the problem is:
cmake can't compile Kodi 22.0 (version code 21.90.801) on Debian Trixie, displaying a lot of error messages related with Wayland functions.
Expected Behavior
Here is a clear and concise description of what was expected to happen:
A successful compilation of a Kodi binary.
Actual Behavior
mold: error: undefined symbol: wl_array_release
>>> referenced by wayland-util.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-util.cpp.o):(wayland::detail::argument_t::operator=(wayland::detail::argument_t const&))
>>> referenced by wayland-util.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-util.cpp.o):(wayland::detail::argument_t::~argument_t())
>>> referenced by wayland-util.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-util.cpp.o):(wayland::array_t::~array_t())
>>> referenced 1 more times
mold: error: undefined symbol: wl_display_roundtrip_queue
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::display_t::roundtrip_queue(wayland::event_queue_t const&) const)
mold: error: undefined symbol: wl_display_connect_to_fd
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::display_t::display_t(int))
mold: error: undefined symbol: wl_proxy_get_class
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::proxy_t::get_class[abi:cxx11]() const)
mold: error: undefined symbol: wl_egl_window_get_attached_size
>>> referenced by wayland-egl.cpp
>>> /usr/local/lib/libwayland-egl++.a(wayland-egl.cpp.o):(wayland::egl_window_t::get_attached_size(int&, int&))
mold: error: undefined symbol: wl_display_create_queue
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::display_t::create_queue() const)
mold: error: undefined symbol: wl_proxy_destroy
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::proxy_t::proxy_release())
mold: error: undefined symbol: wl_proxy_marshal_array_constructor
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::proxy_t::marshal_single(unsigned int, wl_interface const*, std::vector<wayland::detail::argument_t, std::allocator<wayland::detail::argument_t> > const&, unsigned int))
mold: error: undefined symbol: wl_cursor_image_get_buffer
>>> referenced by wayland-cursor.cpp
>>> /usr/local/lib/libwayland-cursor++.a(wayland-cursor.cpp.o):(wayland::cursor_image_t::get_buffer() const)
mold: error: undefined symbol: wl_display_dispatch_queue
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::display_t::dispatch_queue(wayland::event_queue_t const&) const)
mold: error: undefined symbol: wl_display_read_events
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::read_intent::read())
mold: error: undefined symbol: wl_proxy_set_queue
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::proxy_t::set_queue(wayland::event_queue_t))
mold: error: undefined symbol: wl_proxy_get_id
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::proxy_t::get_id() const)
mold: error: undefined symbol: wl_cursor_frame
>>> referenced by wayland-cursor.cpp
>>> /usr/local/lib/libwayland-cursor++.a(wayland-cursor.cpp.o):(wayland::cursor_t::frame(unsigned int) const)
mold: error: undefined symbol: wl_cursor_theme_get_cursor
>>> referenced by wayland-cursor.cpp
>>> /usr/local/lib/libwayland-cursor++.a(wayland-cursor.cpp.o):(wayland::cursor_theme_t::get_cursor(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const)
mold: error: undefined symbol: wl_array_init
>>> referenced by wayland-util.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-util.cpp.o):(wayland::detail::argument_t::operator=(wayland::detail::argument_t const&))
>>> referenced by wayland-util.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-util.cpp.o):(wayland::array_t::array_t(wl_array*))
>>> referenced by wayland-util.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-util.cpp.o):(wayland::array_t::get(wl_array*) const)
>>> referenced 4 more times
mold: error: undefined symbol: wl_display_dispatch
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::display_t::dispatch() const)
mold: error: undefined symbol: wl_display_prepare_read
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::display_t::obtain_read_intent() const)
mold: error: undefined symbol: wl_proxy_get_version
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::proxy_t::get_version() const)
mold: error: undefined symbol: wl_egl_window_create
>>> referenced by wayland-egl.cpp
>>> /usr/local/lib/libwayland-egl++.a(wayland-egl.cpp.o):(wayland::egl_window_t::egl_window_t(wayland::surface_t const&, int, int))
mold: error: undefined symbol: wl_cursor_theme_load
>>> referenced by wayland-cursor.cpp
>>> /usr/local/lib/libwayland-cursor++.a(wayland-cursor.cpp.o):(wayland::cursor_theme_t::cursor_theme_t(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, wayland::shm_t const&))
mold: error: undefined symbol: wl_display_get_error
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::display_t::get_error() const)
mold: error: undefined symbol: wl_display_prepare_read_queue
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::display_t::obtain_queue_read_intent(wayland::event_queue_t const&) const)
mold: error: undefined symbol: wl_display_get_fd
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::display_t::get_fd() const)
mold: error: undefined symbol: wl_display_connect
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::display_t::display_t(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&))
mold: error: undefined symbol: wl_proxy_wrapper_destroy
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::proxy_t::proxy_release())
mold: error: undefined symbol: wl_proxy_marshal_array
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::proxy_t::marshal_single(unsigned int, wl_interface const*, std::vector<wayland::detail::argument_t, std::allocator<wayland::detail::argument_t> > const&, unsigned int))
mold: error: undefined symbol: wl_display_dispatch_queue_pending
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::display_t::dispatch_queue_pending(wayland::event_queue_t const&) const)
mold: error: undefined symbol: wl_event_queue_destroy
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::event_queue_t::event_queue_t(wl_event_queue*))
mold: error: undefined symbol: wl_egl_window_resize
>>> referenced by wayland-egl.cpp
>>> /usr/local/lib/libwayland-egl++.a(wayland-egl.cpp.o):(wayland::egl_window_t::resize(int, int, int, int))
mold: error: undefined symbol: wl_array_copy
>>> referenced by wayland-util.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-util.cpp.o):(wayland::detail::argument_t::operator=(wayland::detail::argument_t const&))
>>> referenced by wayland-util.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-util.cpp.o):(wayland::array_t::array_t(wl_array*))
>>> referenced by wayland-util.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-util.cpp.o):(wayland::array_t::get(wl_array*) const)
>>> referenced 2 more times
mold: error: undefined symbol: wl_display_dispatch_pending
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::display_t::dispatch_pending() const)
mold: error: undefined symbol: wl_proxy_marshal
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::proxy_t::proxy_release())
mold: error: undefined symbol: wl_proxy_add_dispatcher
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::proxy_t::set_events(std::shared_ptr<wayland::detail::events_base_t>, int (*)(unsigned int, std::vector<wayland::detail::any, std::allocator<wayland::detail::any> > const&, std::shared_ptr<wayland::detail::events_base_t> const&)))
mold: error: undefined symbol: wl_proxy_marshal_array_constructor_versioned
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::proxy_t::marshal_single(unsigned int, wl_interface const*, std::vector<wayland::detail::argument_t, std::allocator<wayland::detail::argument_t> > const&, unsigned int))
mold: error: undefined symbol: wl_egl_window_destroy
>>> referenced by wayland-egl.cpp
>>> /usr/local/lib/libwayland-egl++.a(wayland-egl.cpp.o):(wayland::egl_window_t::egl_window_t(wayland::surface_t const&, int, int))
mold: error: undefined symbol: wl_cursor_theme_destroy
>>> referenced by wayland-cursor.cpp
>>> /usr/local/lib/libwayland-cursor++.a(wayland-cursor.cpp.o):(wayland::cursor_theme_t::cursor_theme_t(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, wayland::shm_t const&))
mold: error: undefined symbol: wl_display_flush
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::display_t::flush() const)
mold: error: undefined symbol: wl_display_roundtrip
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::display_t::roundtrip() const)
mold: error: undefined symbol: wl_display_cancel_read
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::read_intent::cancel())
mold: error: undefined symbol: wl_display_disconnect
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::proxy_t::proxy_release())
mold: error: undefined symbol: wl_proxy_create_wrapper
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::proxy_t::proxy_t(wayland::proxy_t const&, wayland::proxy_t::construct_proxy_wrapper_tag))
mold: error: undefined symbol: wl_proxy_set_user_data
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::proxy_t::c_dispatcher(void const*, void*, unsigned int, wl_message const*, wl_argument*))
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::proxy_t::marshal_single(unsigned int, wl_interface const*, std::vector<wayland::detail::argument_t, std::allocator<wayland::detail::argument_t> > const&, unsigned int))
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::proxy_t::proxy_t(wl_proxy*, wayland::proxy_t::wrapper_type, wayland::event_queue_t const&))
mold: error: undefined symbol: wl_proxy_get_user_data
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::proxy_t::c_dispatcher(void const*, void*, unsigned int, wl_message const*, wl_argument*))
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::proxy_t::proxy_t(wl_proxy*, wayland::proxy_t::wrapper_type, wayland::event_queue_t const&))
mold: error: undefined symbol: wl_log_set_handler_client
>>> referenced by wayland-client.cpp
>>> /usr/local/lib/libwayland-client++.a(wayland-client.cpp.o):(wayland::set_log_handler(std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)>))
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/kodi.dir/build.make:605: kodi.bin] Error 1
make[1]: *** [CMakeFiles/Makefile2:7685: CMakeFiles/kodi.dir/all] Error 2
make: *** [Makefile:146: all] Error 2Possible Fix
To Reproduce
Steps to reproduce the behavior:
#!/bin/bash
# file: kodi-building.sh
#
# download, configure, build and install Kodi Media Player from its source code
# https://github.com/xbmc/xbmc/blob/master/docs/README.Linux.md
echo
echo '+----------------------------------------------------------------------------------------+'
echo '| cd $HOME |'
echo '+----------------------------------------------------------------------------------------+'
cd $HOME
echo $PWD
if [ -e $HOME/kodi ]
then
# change to Kodi's source code directory
echo
echo '+----------------------------------------------------------------------------------------+'
echo '| cd $HOME/kodi |'
echo '+----------------------------------------------------------------------------------------+'
cd $HOME/kodi
echo $PWD
# update local copy of Kodi's current master branch
echo
echo '+----------------------------------------------------------------------------------------+'
echo '| git pull |'
echo '+----------------------------------------------------------------------------------------+'
git pull
else
# clone Kodi's current master branch
echo
echo '+----------------------------------------------------------------------------------------+'
echo '| git clone https://github.com/xbmc/xbmc kodi |'
echo '+----------------------------------------------------------------------------------------+'
git clone https://github.com/xbmc/xbmc kodi
# change to Kodi's source code directory
echo
echo '+----------------------------------------------------------------------------------------+'
echo '| cd $HOME/kodi |'
echo '+----------------------------------------------------------------------------------------+'
cd $HOME/kodi
echo $PWD
fi
# build and install crossguid
echo
echo '+----------------------------------------------------------------------------------------+'
echo '| sudo make -C tools/depends/target/crossguid PREFIX=/usr/local |'
echo '+----------------------------------------------------------------------------------------+'
sudo make -C tools/depends/target/crossguid PREFIX=/usr/local
# build and install flatbuffers
echo
echo '+----------------------------------------------------------------------------------------+'
echo '| sudo make -C tools/depends/target/flatbuffers PREFIX=/usr/local |'
echo '+----------------------------------------------------------------------------------------+'
sudo make -C tools/depends/target/flatbuffers PREFIX=/usr/local
# build and install libfmt
echo
echo '+----------------------------------------------------------------------------------------+'
echo '| sudo make -C tools/depends/target/fmt PREFIX=/usr/local |'
echo '+----------------------------------------------------------------------------------------+'
sudo make -C tools/depends/target/fmt PREFIX=/usr/local
# build and install libspdlog
echo
echo '+----------------------------------------------------------------------------------------+'
echo '| sudo make -C tools/depends/target/spdlog PREFIX=/usr/local |'
echo '+----------------------------------------------------------------------------------------+'
sudo make -C tools/depends/target/spdlog PREFIX=/usr/local
# build and install wayland-protocols
echo
echo '+----------------------------------------------------------------------------------------+'
echo '| sudo make -C tools/depends/target/wayland-protocols PREFIX=/usr/local |'
echo '+----------------------------------------------------------------------------------------+'
sudo make -C tools/depends/target/wayland-protocols PREFIX=/usr/local
# build and install waylandpp
echo
echo '+----------------------------------------------------------------------------------------+'
echo '| sudo make -C tools/depends/target/waylandpp PREFIX=/usr/local |'
echo '+----------------------------------------------------------------------------------------+'
sudo make -C tools/depends/target/waylandpp PREFIX=/usr/local
if [ ! -e $HOME/kodi-build ]
then
# create an out-of-source build directory
echo
echo '+----------------------------------------------------------------------------------------+'
echo '| mkdir $HOME/kodi-build |'
echo '+----------------------------------------------------------------------------------------+'
mkdir $HOME/kodi-build
fi
# change to the building directory
echo
echo '+----------------------------------------------------------------------------------------+'
echo '| cd $HOME/kodi-build |'
echo '+----------------------------------------------------------------------------------------+'
cd $HOME/kodi-build
echo $PWD
# configure build with any combination of the three (default is "x11 wayland gbm")
echo
echo '+----------------------------------------------------------------------------------------+'
echo '| cmake \ |'
echo '| ../kodi \ |'
echo '| -DCMAKE_INSTALL_PREFIX=/usr/localSource: xbmc/xbmc