rpcs3 icon indicating copy to clipboard operation
rpcs3 copied to clipboard

[LLVM-18] Error compiling later master (92dd801)

Open MrDuartePT opened this issue 2 years ago • 8 comments

Quick summary

When compiling the latest master using LLVM-18 toolchain with or without lto produce this error:

[782/786] /usr/lib/llvm/18/bin/clang++ -DDATADIR=\"/usr/share/rpcs3\" -DECC_SHAMIR -DFP_MAX_BITS=8192 -DGCM_TABLE_4BIT -DHAVE_AESGCM -DHAVE_CHACHA -DHAVE_DH_DEFAULT_PARAMS -DHAVE_ECC -DHAVE_ENCRYPT_THEN_MAC -DHAVE_EXTENDED_MASTER -DHAVE_FAUDIO -DHAVE_FFDHE_2048 -DHAVE_HASHDRBG -DHAVE_LIBEVDEV -DHAVE_ONE_TIME_AUTH -DHAVE_POLY1305 -DHAVE_PTHREAD -DHAVE_QTDBUS -DHAVE_SNI -DHAVE_SUPPORTED_CURVES -DHAVE_THREAD_LS -DHAVE_TLS_EXTENSIONS -DHAVE_VULKAN -DHAVE_WRITE_DUP -DHAVE_X11 -DHAVE___UINT128_T -DLLVM_AVAILABLE -DMINIUPNP_STATICLIB -DNO_DSA -DNO_MD4 -DNO_PSK -DNO_RC4 -DOPENSSL_EXTRA -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_GUI_LIB -DQT_MULTIMEDIAWIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_SVGWIDGETS_LIB -DQT_SVG_LIB -DQT_WIDGETS_LIB -DSOUNDTOUCH_ALLOW_SSE -DSOUNDTOUCH_FLOAT_SAMPLES -DST_NO_EXCEPTION_HANDLING -DTFM_ECC256 -DUSE_FAST_MATH -DUSE_MULTICH_ALWAYS -DVK_USE_PLATFORM_WAYLAND_KHR -DWC_NO_ASYNC_THREADING -DWC_NO_HARDEN -DWITH_DISCORD_RPC -DWOLFSSL_ALT_CERT_CHAINS -DWOLFSSL_DES_ECB -DWOLFSSL_ENCRYPTED_KEYS -DWOLFSSL_NO_SHAKE128 -DWOLFSSL_SHA224 -DWOLFSSL_SHA3 -DWOLFSSL_SHA384 -DWOLFSSL_SHA512 -DWOLFSSL_SHAKE256 -DWOLFSSL_SYS_CA_CERTS -DWOLFSSL_USE_ALIGN -DWOLFSSL_X86_64_BUILD -DYAML_CPP_STATIC_DEFINE -DZLIB_CONST=1 -D_GNU_SOURCE -D_POSIX_THREADS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999_build/rpcs3/rpcs3_autogen/include -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/rpcs3 -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999 -I/usr/include/AL -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/SoundTouch/soundtouch/include -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/miniupnp/miniupnp/miniupnpc/include -I/usr/lib/llvm/18/include -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/asmjit/asmjit/src -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/GL -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/stblib/include -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/glslang/glslang/SPIRV/.. -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999_build/include -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/wolfssl/wolfssl -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999_build/3rdparty/wolfssl/wolfssl -I/usr/include/qt6/QtGui/6.7.0 -I/usr/include/qt6/QtGui/6.7.0/QtGui -I/usr/include/qt6/QtCore/6.7.0 -I/usr/include/qt6/QtCore/6.7.0/QtCore -I/usr/include/qt6/QtDBus/6.7.0 -I/usr/include/qt6/QtDBus/6.7.0/QtDBus -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/yaml-cpp/yaml-cpp/include -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/discord-rpc/include -isystem /usr/include/libevdev-1.0 -isystem /usr/include/libusb-1.0 -isystem /usr/include/qt6/QtWidgets -isystem /usr/include/qt6 -isystem /usr/include/qt6/QtCore -isystem /usr/lib64/qt6/mkspecs/linux-clang -isystem /usr/include/qt6/QtGui -isystem /usr/include/qt6/QtDBus -isystem /usr/include/qt6/QtConcurrent -isystem /usr/include/qt6/QtMultimedia -isystem /usr/include/qt6/QtNetwork -isystem /usr/include/qt6/QtMultimediaWidgets -isystem /usr/include/qt6/QtSvg -isystem /usr/include/qt6/QtSvgWidgets  -stdlib=libc++ -march=native -O2 -pipe -fdiagnostics-color=always -std=gnu++20 -pthread -Wall -fno-exceptions -fstack-protector -msse -msse2 -mcx16 -Werror=old-style-cast -Werror=sign-compare -Werror=reorder -Werror=return-type -Werror=overloaded-virtual -Werror=missing-noreturn -Werror=implicit-fallthrough -Wunused-parameter -Wignored-qualifiers -Wredundant-move -Wcast-qual -Wdeprecated-copy -Wtautological-compare -Wempty-body -Wredundant-decls -Wstrict-aliasing=1 -Werror=inconsistent-missing-override -Werror=delete-non-virtual-dtor -fconstexpr-steps=16777216 -Wno-unused-lambda-capture -Wno-unused-private-field -Wno-unused-command-line-argument -march=native -fPIC -MD -MT rpcs3/CMakeFiles/rpcs3.dir/Input/gui_pad_thread.cpp.o -MF rpcs3/CMakeFiles/rpcs3.dir/Input/gui_pad_thread.cpp.o.d -o rpcs3/CMakeFiles/rpcs3.dir/Input/gui_pad_thread.cpp.o -c /var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/rpcs3/Input/gui_pad_thread.cpp
FAILED: rpcs3/CMakeFiles/rpcs3.dir/Input/gui_pad_thread.cpp.o
/usr/lib/llvm/18/bin/clang++ -DDATADIR=\"/usr/share/rpcs3\" -DECC_SHAMIR -DFP_MAX_BITS=8192 -DGCM_TABLE_4BIT -DHAVE_AESGCM -DHAVE_CHACHA -DHAVE_DH_DEFAULT_PARAMS -DHAVE_ECC -DHAVE_ENCRYPT_THEN_MAC -DHAVE_EXTENDED_MASTER -DHAVE_FAUDIO -DHAVE_FFDHE_2048 -DHAVE_HASHDRBG -DHAVE_LIBEVDEV -DHAVE_ONE_TIME_AUTH -DHAVE_POLY1305 -DHAVE_PTHREAD -DHAVE_QTDBUS -DHAVE_SNI -DHAVE_SUPPORTED_CURVES -DHAVE_THREAD_LS -DHAVE_TLS_EXTENSIONS -DHAVE_VULKAN -DHAVE_WRITE_DUP -DHAVE_X11 -DHAVE___UINT128_T -DLLVM_AVAILABLE -DMINIUPNP_STATICLIB -DNO_DSA -DNO_MD4 -DNO_PSK -DNO_RC4 -DOPENSSL_EXTRA -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_GUI_LIB -DQT_MULTIMEDIAWIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_SVGWIDGETS_LIB -DQT_SVG_LIB -DQT_WIDGETS_LIB -DSOUNDTOUCH_ALLOW_SSE -DSOUNDTOUCH_FLOAT_SAMPLES -DST_NO_EXCEPTION_HANDLING -DTFM_ECC256 -DUSE_FAST_MATH -DUSE_MULTICH_ALWAYS -DVK_USE_PLATFORM_WAYLAND_KHR -DWC_NO_ASYNC_THREADING -DWC_NO_HARDEN -DWITH_DISCORD_RPC -DWOLFSSL_ALT_CERT_CHAINS -DWOLFSSL_DES_ECB -DWOLFSSL_ENCRYPTED_KEYS -DWOLFSSL_NO_SHAKE128 -DWOLFSSL_SHA224 -DWOLFSSL_SHA3 -DWOLFSSL_SHA384 -DWOLFSSL_SHA512 -DWOLFSSL_SHAKE256 -DWOLFSSL_SYS_CA_CERTS -DWOLFSSL_USE_ALIGN -DWOLFSSL_X86_64_BUILD -DYAML_CPP_STATIC_DEFINE -DZLIB_CONST=1 -D_GNU_SOURCE -D_POSIX_THREADS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999_build/rpcs3/rpcs3_autogen/include -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/rpcs3 -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999 -I/usr/include/AL -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/SoundTouch/soundtouch/include -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/miniupnp/miniupnp/miniupnpc/include -I/usr/lib/llvm/18/include -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/asmjit/asmjit/src -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/GL -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/stblib/include -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/glslang/glslang/SPIRV/.. -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999_build/include -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/wolfssl/wolfssl -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999_build/3rdparty/wolfssl/wolfssl -I/usr/include/qt6/QtGui/6.7.0 -I/usr/include/qt6/QtGui/6.7.0/QtGui -I/usr/include/qt6/QtCore/6.7.0 -I/usr/include/qt6/QtCore/6.7.0/QtCore -I/usr/include/qt6/QtDBus/6.7.0 -I/usr/include/qt6/QtDBus/6.7.0/QtDBus -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/yaml-cpp/yaml-cpp/include -I/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/discord-rpc/include -isystem /usr/include/libevdev-1.0 -isystem /usr/include/libusb-1.0 -isystem /usr/include/qt6/QtWidgets -isystem /usr/include/qt6 -isystem /usr/include/qt6/QtCore -isystem /usr/lib64/qt6/mkspecs/linux-clang -isystem /usr/include/qt6/QtGui -isystem /usr/include/qt6/QtDBus -isystem /usr/include/qt6/QtConcurrent -isystem /usr/include/qt6/QtMultimedia -isystem /usr/include/qt6/QtNetwork -isystem /usr/include/qt6/QtMultimediaWidgets -isystem /usr/include/qt6/QtSvg -isystem /usr/include/qt6/QtSvgWidgets  -stdlib=libc++ -march=native -O2 -pipe -fdiagnostics-color=always -std=gnu++20 -pthread -Wall -fno-exceptions -fstack-protector -msse -msse2 -mcx16 -Werror=old-style-cast -Werror=sign-compare -Werror=reorder -Werror=return-type -Werror=overloaded-virtual -Werror=missing-noreturn -Werror=implicit-fallthrough -Wunused-parameter -Wignored-qualifiers -Wredundant-move -Wcast-qual -Wdeprecated-copy -Wtautological-compare -Wempty-body -Wredundant-decls -Wstrict-aliasing=1 -Werror=inconsistent-missing-override -Werror=delete-non-virtual-dtor -fconstexpr-steps=16777216 -Wno-unused-lambda-capture -Wno-unused-private-field -Wno-unused-command-line-argument -march=native -fPIC -MD -MT rpcs3/CMakeFiles/rpcs3.dir/Input/gui_pad_thread.cpp.o -MF rpcs3/CMakeFiles/rpcs3.dir/Input/gui_pad_thread.cpp.o.d -o rpcs3/CMakeFiles/rpcs3.dir/Input/gui_pad_thread.cpp.o -c /var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/rpcs3/Input/gui_pad_thread.cpp
/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/rpcs3/Input/gui_pad_thread.cpp:58:13: error: use of undeclared identifier 'close'
   58 |                 int res = close(m_uinput_fd);
      |                           ^
/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/rpcs3/Input/gui_pad_thread.cpp:569:12: error: use of undeclared identifier 'write'; did you mean '_IO_cookie_io_functions_t::write'?
  569 |         int res = write(m_uinput_fd, &ie, sizeof(ie));
      |                   ^~~~~
      |                   _IO_cookie_io_functions_t::write
/usr/include/bits/types/cookie_io_functions_t.h:58:28: note: '_IO_cookie_io_functions_t::write' declared here
   58 |   cookie_write_function_t *write;       /* Write bytes.  */
      |                            ^
/var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/rpcs3/Input/gui_pad_thread.cpp:569:12: error: invalid use of non-static data member 'write'
  569 |         int res = write(m_uinput_fd, &ie, sizeof(ie));
      |                   ^~~~~
3 errors generated.

Details

Here are the flags I use to compile rpcs3 (using guru ebuild):

-DBUILD_SHARED_LIBS=OFF
-DUSE_PRECOMPILED_HEADERS=ON
-DUSE_SYSTEM_CURL=ON
-DUSE_SYSTEM_FFMPEG=ON
-DUSE_SYSTEM_FLATBUFFERS=ON
-DUSE_SYSTEM_LIBPNG=ON
-DUSE_SYSTEM_LIBUSB=ON
-DUSE_SYSTEM_PUGIXML=ON
-DUSE_SYSTEM_XXHASH=ON
-DUSE_SYSTEM_ZLIB=ON
-DUSE_DISCORD_RPC=ON
-DUSE_FAUDIO=ON
-DUSE_VULKAN=ON
-DWITH_LLVM=ON

This is the version of software I am using:

dev-build/cmake:           3.29.2::gentoo
sys-devel/clang:           17.0.6::gentoo, 18.1.3::gentoo
sys-devel/gcc:             13.2.1_p20240210::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/lld:             18.1.3::gentoo
sys-devel/llvm:            17.0.6::gentoo, 18.1.3::gentoo
# (Part of LLVM is still present because of mesa)
# (Full emerge --info in log files)

And bellow is my compile flags: "-march=native -O3 -pipe -fdiagnostics-color=always -flto=thin"

Attach a log file

build-rpcs3.log.txt emerge_info.txt

Attach capture files for visual issues

No response

System configuration

OS: Gentoo 2.15 x86_64 Kernel: 6.8.2-gentoo-x86_64 Host: Legion 5 15ACH6H CPU: AMD Ryzen 7 5800H (16) @ 4,46 GHz GPU: AMD Radeon Vega Series / NVIDIA GeForce RTX 3070 Mobile RAM: 16GB

Other details

No response

MrDuartePT avatar Apr 13 '24 20:04 MrDuartePT

Clang 18.x issues are already reported upstream: https://github.com/llvm/llvm-project/issues/84634 Though the errors you reported are different

hcorion avatar Apr 14 '24 06:04 hcorion

It looks like gui_pad_thread.cpp is missing #include <unistd.h> under #ifdef __linux__ line 23.

oltolm avatar Apr 14 '24 07:04 oltolm

It looks like gui_pad_thread.cpp is missing #include <unistd.h> under #ifdef __linux__ line 23.

Thanks for the reply I will try later, but seems to be that the problem: https://github.com/Tatsh/tatsh-overlay/issues/284 The guru overlay dosen't have that patch.

MrDuartePT avatar Apr 14 '24 09:04 MrDuartePT

Why not added to the file:

#ifdef __linux__
(....)
   #if __clang_major__ == 18
   #include <unistd.h>
   #endif
(...)

MrDuartePT avatar Apr 14 '24 17:04 MrDuartePT

Well this time only fail the linker (LLD), but could be because I using LTO, let me try without it.

MrDuartePT avatar Apr 14 '24 17:04 MrDuartePT

FWIW compiling RPCS3 with LTO doesn't produce useable binaries (on either gcc or clang) due to different compiler bugs, see here: https://github.com/RPCS3/rpcs3/issues/2959

hcorion avatar Apr 14 '24 19:04 hcorion

Even without lto I having problems with linking:

FAILED: bin/rpcs3
: && /usr/lib/llvm/18/bin/clang++ -stdlib=libc++ -march=native -O3 -pipe -fdiagnostics-color=always -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -latomic -Wl,--undefined-version    -Wl,--exclude-libs,ALL -no-pie rpcs3/CMakeFiles/rpcs3.dir/rpcs3_autogen/mocs_compilation.cpp.o rpcs3/CMakeFiles/rpcs3.dir/display_sleep_control.cpp.o rpcs3/CMakeFiles/rpcs3.dir/headless_application.cpp.o rpcs3/CMakeFiles/rpcs3.dir/main.cpp.o rpcs3/CMakeFiles/rpcs3.dir/main_application.cpp.o rpcs3/CMakeFiles/rpcs3.dir/rpcs3_version.cpp.o rpcs3/CMakeFiles/rpcs3.dir/stb_image.cpp.o rpcs3/CMakeFiles/rpcs3.dir/stdafx.cpp.o rpcs3/CMakeFiles/rpcs3.dir/Input/basic_keyboard_handler.cpp.o rpcs3/CMakeFiles/rpcs3.dir/Input/basic_mouse_handler.cpp.o rpcs3/CMakeFiles/rpcs3.dir/Input/ds3_pad_handler.cpp.o rpcs3/CMakeFiles/rpcs3.dir/Input/ds4_pad_handler.cpp.o rpcs3/CMakeFiles/rpcs3.dir/Input/dualsense_pad_handler.cpp.o rpcs3/CMakeFiles/rpcs3.dir/Input/evdev_joystick_handler.cpp.o rpcs3/CMakeFiles/rpcs3.dir/Input/evdev_gun_handler.cpp.o rpcs3/CMakeFiles/rpcs3.dir/Input/gui_pad_thread.cpp.o rpcs3/CMakeFiles/rpcs3.dir/Input/hid_pad_handler.cpp.o rpcs3/CMakeFiles/rpcs3.dir/Input/keyboard_pad_handler.cpp.o rpcs3/CMakeFiles/rpcs3.dir/Input/mm_joystick_handler.cpp.o rpcs3/CMakeFiles/rpcs3.dir/Input/pad_thread.cpp.o rpcs3/CMakeFiles/rpcs3.dir/Input/raw_mouse_handler.cpp.o rpcs3/CMakeFiles/rpcs3.dir/Input/sdl_pad_handler.cpp.o rpcs3/CMakeFiles/rpcs3.dir/Input/skateboard_pad_handler.cpp.o rpcs3/CMakeFiles/rpcs3.dir/Input/xinput_pad_handler.cpp.o -o bin/rpcs3  -Wl,-rpath,/usr/lib/llvm/18/lib64:  rpcs3/Emu/librpcs3_emu.a  rpcs3/rpcs3qt/librpcs3_ui.a  -lhidapi-hidraw  3rdparty/wolfssl/wolfssl/libwolfssl.a  -lrt  /usr/lib64/libSM.so  /usr/lib64/libICE.so  /usr/lib64/libX11.so  /usr/lib64/libXext.so  -ldl  rpcs3/Emu/librpcs3_emu.a  -L/usr/lib64  -levdev  -ludev  /usr/lib64/libflatbuffers.so  -lFAudio  /usr/lib64/libopenal.so  -lcubeb  3rdparty/SoundTouch/libsoundtouch.a  3rdparty/miniupnp/miniupnp/miniupnpc/libminiupnpc.a  /usr/lib/llvm/18/lib64/libLLVM.so.18.1+libcxx  3rdparty/asmjit/libasmjit.a  -lc  /usr/lib64/libavcodec.so  /usr/lib64/libavformat.so  /usr/lib64/libavutil.so  /usr/lib64/libswscale.so  /usr/lib64/libswresample.so  /usr/lib64/libGLU.so  /usr/lib64/libGLX.so  /usr/lib64/libOpenGL.so  3rdparty/glslang/glslang/SPIRV/libSPIRV.a  3rdparty/glslang/glslang/glslang/libMachineIndependent.a  3rdparty/glslang/glslang/OGLCompilersDLL/libOGLCompiler.a  3rdparty/glslang/glslang/glslang/OSDependent/Unix/libOSDependent.a  3rdparty/glslang/glslang/glslang/libGenericCodeGen.a  /lib64/libvulkan.so  /usr/lib64/libGLEW.so  /usr/lib64/libxxhash.so  /var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/discord-rpc/lib/libdiscord-rpc-linux.a  /usr/lib64/libQt6Concurrent.so.6.7.0  /usr/lib64/libQt6MultimediaWidgets.so.6.7.0  /usr/lib64/libQt6Multimedia.so.6.7.0  /usr/lib64/libQt6Network.so.6.7.0  /usr/lib64/libQt6SvgWidgets.so.6.7.0  /usr/lib64/libQt6Svg.so.6.7.0  /usr/lib64/libQt6Widgets.so.6.7.0  /usr/lib64/libQt6Gui.so.6.7.0  /usr/lib64/libQt6DBus.so.6.7.0  /usr/lib64/libQt6Core.so.6.7.0  /usr/lib64/libGLX.so  /usr/lib64/libOpenGL.so  /usr/lib64/libusb-1.0.so  3rdparty/wolfssl/wolfssl/libwolfssl.a  -lm  /usr/lib64/libcurl.so  /usr/lib64/libz.so  3rdparty/yaml-cpp/yaml-cpp/libyaml-cpp.a  /usr/lib64/libpugixml.so  /usr/lib64/libpng.so  3rdparty/rtmidi/rtmidi/librtmidi.a  /usr/lib64/libasound.so && cd /var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999_build/rpcs3 && /usr/bin/cmake -E copy_directory /var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/bin/Icons /var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999_build/bin/Icons && cd /var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999_build/rpcs3 && /usr/bin/cmake -E copy_directory /var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/bin/GuiConfigs /var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999_build/bin/GuiConfigs && cd /var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999_build/rpcs3 && /usr/bin/cmake -E copy_directory /var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/bin/git /var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999_build/bin/git
ld.lld: error: undefined symbol: std::chrono::_V2::system_clock::now()
>>> referenced by discord_rpc.cpp:124 (/home/buildkite-agent/buildslow/buildkite-agent-stg-1-1-5/discord/discord-rpc/src/discord_rpc.cpp:124)
>>>               discord_rpc.cpp.o:(UpdateReconnectTime()) in archive /var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/discord-rpc/lib/libdiscord-rpc-linux.a
>>> referenced by discord_rpc.cpp:139 (/home/buildkite-agent/buildslow/buildkite-agent-stg-1-1-5/discord/discord-rpc/src/discord_rpc.cpp:139)
>>>               discord_rpc.cpp.o:(Discord_UpdateConnection()) in archive /var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/discord-rpc/lib/libdiscord-rpc-linux.a
>>> referenced by discord_rpc.cpp:72 (/home/buildkite-agent/buildslow/buildkite-agent-stg-1-1-5/discord/discord-rpc/src/discord_rpc.cpp:72)
>>>               discord_rpc.cpp.o:(__cxx_global_var_init.3) in archive /var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/discord-rpc/lib/libdiscord-rpc-linux.a
>>> referenced 2 more times

ld.lld: error: undefined symbol: std::condition_variable::condition_variable()
>>> referenced by discord_rpc.cpp:78 (/home/buildkite-agent/buildslow/buildkite-agent-stg-1-1-5/discord/discord-rpc/src/discord_rpc.cpp:78)
>>>               discord_rpc.cpp.o:(IoThreadHolder::IoThreadHolder()) in archive /var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/discord-rpc/lib/libdiscord-rpc-linux.a

ld.lld: error: undefined symbol: std::condition_variable::~condition_variable()
>>> referenced by discord_rpc.cpp:110 (/home/buildkite-agent/buildslow/buildkite-agent-stg-1-1-5/discord/discord-rpc/src/discord_rpc.cpp:110)
>>>               discord_rpc.cpp.o:(IoThreadHolder::~IoThreadHolder()) in archive /var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/discord-rpc/lib/libdiscord-rpc-linux.a
>>> referenced by discord_rpc.cpp:110 (/home/buildkite-agent/buildslow/buildkite-agent-stg-1-1-5/discord/discord-rpc/src/discord_rpc.cpp:110)
>>>               discord_rpc.cpp.o:(IoThreadHolder::~IoThreadHolder()) in archive /var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/discord-rpc/lib/libdiscord-rpc-linux.a

ld.lld: error: undefined symbol: std::thread::join()
>>> referenced by discord_rpc.cpp:106 (/home/buildkite-agent/buildslow/buildkite-agent-stg-1-1-5/discord/discord-rpc/src/discord_rpc.cpp:106)
>>>               discord_rpc.cpp.o:(IoThreadHolder::Stop()) in archive /var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/discord-rpc/lib/libdiscord-rpc-linux.a

ld.lld: error: undefined symbol: std::thread::_M_start_thread(std::shared_ptr<std::thread::_Impl_base>)
>>> referenced by thread:135 (/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/thread:135)
>>>               discord_rpc.cpp.o:(std::thread::thread<IoThreadHolder::Start()::'lambda'()>(IoThreadHolder::Start()::'lambda'()&&)) in archive /var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/discord-rpc/lib/libdiscord-rpc-linux.a

ld.lld: error: undefined symbol: std::__throw_system_error(int)
>>> referenced by mutex:506 (/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/mutex:506)
>>>               discord_rpc.cpp.o:(std::unique_lock<std::mutex>::lock()) in archive /var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/discord-rpc/lib/libdiscord-rpc-linux.a
>>> referenced by mutex:508 (/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/mutex:508)
>>>               discord_rpc.cpp.o:(std::unique_lock<std::mutex>::lock()) in archive /var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/discord-rpc/lib/libdiscord-rpc-linux.a
>>> referenced by mutex:138 (/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/mutex:138)
>>>               discord_rpc.cpp.o:(std::mutex::lock()) in archive /var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/discord-rpc/lib/libdiscord-rpc-linux.a
>>> referenced 1 more times

ld.lld: error: undefined symbol: std::condition_variable::notify_all()
>>> referenced by discord_rpc.cpp:99 (/home/buildkite-agent/buildslow/buildkite-agent-stg-1-1-5/discord/discord-rpc/src/discord_rpc.cpp:99)
>>>               discord_rpc.cpp.o:(IoThreadHolder::Notify()) in archive /var/tmp/portage/games-emulation/rpcs3-9999/work/rpcs3-9999/3rdparty/discord-rpc/lib/libdiscord-rpc-linux.a
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

Seems to be the discord-rpc implementation

Compiler flags:

COMMON_FLAGS="-march=native -O3 -pipe -fdiagnostics-color=always"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="-stdlib=libc++ ${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"

LDFLAGS="-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -latomic -Wl,--undefined-version"

Edit: after checking with LTO the error is the same, so it not a LTO problem is the discord rpc implementation

MrDuartePT avatar Apr 14 '24 19:04 MrDuartePT

FWIW compiling RPCS3 with LTO doesn't produce useable binaries (on either gcc or clang) due to different compiler bugs, see here: #2959

I retry compiling with LTO and DUSE_DISCORD_RPC=OFF and it linked just fine. So something is off with discord_rpc and lld-18

MrDuartePT avatar Apr 14 '24 20:04 MrDuartePT

FWIW compiling RPCS3 with LTO doesn't produce useable binaries (on either gcc or clang) due to different compiler bugs, see here: #2959

I retry compiling with LTO and DUSE_DISCORD_RPC=OFF and it linked just fine.

So something is off with discord_rpc and lld-18

@Megamouse I don't think this will solve the discord_rpc error (https://github.com/RPCS3/rpcs3/issues/15448#issuecomment-2054171034) But I can open a new issue reference that.

MrDuartePT avatar Apr 20 '24 19:04 MrDuartePT