Closed PVermeer closed 8 months ago
Did some digging to understand cmake variable definitions because of: https://github.com/LizardByte/Sunshine/blob/6cdb7f7d032f075aac16eaae810dd1663923015a/cmake/packaging/linux.cmake#L10-L14
set(_LIBDIR_DEFAULT "lib")
# Override this default 'lib' with 'lib64' iff:
# - we are on Linux system but NOT cross-compiling
# - we are NOT on debian
# - we are NOT building for conda
# - we are on a 64 bits system
# reason is: amd64 ABI: https://github.com/hjl-tools/x86-psABI/wiki/X86-psABI
# For Debian with multiarch, use 'lib/${CMAKE_LIBRARY_ARCHITECTURE}' if
# CMAKE_LIBRARY_ARCHITECTURE is set (which contains e.g. "i386-linux-gnu"
# and CMAKE_INSTALL_PREFIX is "/usr"
# See http://wiki.debian.org/Multiarch
I did some research and this should work: systemd
# Find systemd service dirs
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(SYSTEMD "systemd")
endif()
if (SYSTEMD_FOUND)
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE}
--variable=systemd_user_unit_dir systemd
OUTPUT_VARIABLE SYSTEMD_USER_UNIT_INSTALL_DIR)
string(REGEX REPLACE "[ \t\n]+" "" SYSTEMD_USER_UNIT_INSTALL_DIR
"${SYSTEMD_USER_UNIT_INSTALL_DIR}")
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE}
--variable=systemd_system_unit_dir systemd
OUTPUT_VARIABLE SYSTEMD_SYSTEM_UNIT_INSTALL_DIR)
string(REGEX REPLACE "[ \t\n]+" "" SYSTEMD_SYSTEM_UNIT_INSTALL_DIR
"${SYSTEMD_SYSTEM_UNIT_INSTALL_DIR}")
mark_as_advanced(SYSTEMD_USER_UNIT_INSTALL_DIR SYSTEMD_SYSTEM_UNIT_INSTALL_DIR)
endif ()
udev
# Find udev rules dir
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(UDEV "udev")
endif()
if (UDEV_FOUND)
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE}
--variable=udevdir udev
OUTPUT_VARIABLE UDEV_RULE_INSTALL_DIR)
string(REGEX REPLACE "[ \t\n]+" "" UDEV_RULE_INSTALL_DIR
"${UDEV_RULE_INSTALL_DIR}")
set(UDEV_RULE_INSTALL_DIR "${UDEV_RULE_INSTALL_DIR}/rules.d")
mark_as_advanced(UDEV_RULE_INSTALL_DIR)
endif ()
I could make a PR to test this out.
I could make a PR to test this out.
PR would be welcomed
Had a short convo with @ReenigneArcher. We may want to consider adding support to detect the init system of the user's system. Other linux distros use alternative init systems like runit, dinit, openrc, s6, etc.
That is a good point.
I have no knowledge about other init systems but for now we could easily check if systemd is used with SYSTEMD_FOUND
and only run https://github.com/LizardByte/Sunshine/blob/78ed91af5cf56bd0e0195c66048064876e285761/cmake/packaging/linux.cmake#L16-L17 if its found.
Same goes for udev.
I'm using runit
, so I could help with that.
We would need specific files for different init system.
E.g. The runit
service for udevd
is a simple sh
script.
[eric@m3tis ~]$ cat /etc/runit/sv/udevd/run
#!/bin/sh
udevadm control --exit
exec udevd
I thought about it a little more and it makes no sense in de context of this fix. The fix was only meant to fix some paths when building the deb and rpm files in the docker containers. Can you explain a little more what you want to accomplish?
Some more questions that I have are:
I think for other init systems we could write different 'FindX' files, their respective install files and probable some new docker containers if they need to be tested / released. But does LizardByte want to maintain all of this?
Other option, that i could think of, is to add cmake options (variables) for other init systems.
But I really have no idea of what needs to be changed.
@PVermeer essentially, the build now fails if systemd is not found. I think your suggestion here is a decent one to at least allow Sunshine to build. https://github.com/LizardByte/Sunshine/issues/2038#issuecomment-1937096448
Yeah @ReenigneArcher,
Just write an 'if' statement around the systemd lines and it should build. I wouldn't advise in production since it would not throw en error.
if (SYSTEMD_FOUND)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.service"
DESTINATION "${SYSTEMD_USER_UNIT_INSTALL_DIR}")
endif ()
Always happy to help :)
Is there an existing issue for this?
Is your issue described in the documentation?
Is your issue present in the nightly release?
Describe the Bug
After fresh install of latest nightly:
Some debugging revealed that some rpm install paths are changed to
/usr/lib64/
from/usr/lib/
:Scriptlet seems fine:
I dont know if this is intentional but at least the service is not detected by systemd.
Expected Behavior
To be able to enable and start the service and udev rules to be applied.
Additional Context
No response
Host Operating System
Linux
Operating System Version
Fedora 39 Gnome up to date
Architecture
64 bit
Sunshine commit or version
sunshine-0.21.0.b94f8c0b5037d8b5cac8da51c363b263429a49cc
Package
Linux - rpm
GPU Type
AMD
GPU Model
RX 6650XT
GPU Driver/Mesa Version
23.3.3
Capture Method (Linux Only)
KMS
Config
Apps
Relevant log output