Skip to content

Conversation

@PVermeer
Copy link
Contributor

@PVermeer PVermeer commented Sep 26, 2025

Description

Issues
I've found the following issues while testing the build system:

  • Builds do not fail anymore when systemd or udev is not found. Adding if(UDEV_FOUND) and if(SYSTEMD_FOUND) to:

    find_package(Systemd)
    find_package(Udev)
    if(UDEV_FOUND)
    install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/60-sunshine.rules"
    DESTINATION "${UDEV_RULES_INSTALL_DIR}")
    endif()
    if(SYSTEMD_FOUND)
    install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.service"
    DESTINATION "${SYSTEMD_USER_UNIT_INSTALL_DIR}")
    install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/60-sunshine.conf"
    DESTINATION "${SYSTEMD_MODULES_LOAD_DIR}")
    endif()

    will make the build silently fails if something changes to the build environment and thus will not install the associating files. I believe this change was made to allow builds on other init systems.

  • The newly added test that uses udevadm would silently not run when udev is missing when it should be there.

  • Some of the docker images that build the packages are failing on install or at runtime.

Goals

  • Docker and Fedora COPR build run from the Sunshine CI should fail on missing systemd/udev.
  • Docker images should not fail to install or run the package.

Changes

  • Added a flag in Cmake that sets SUNSHINE_CI. This can be used to check if the build is running in the Sunshine ci. Other possibilities could be to set something like SUNSHINE_NO_SYSTEMD or pass the init system. This is now used to fail the build if systemd/udev/udevadm is not found. I've als implemented it into the build script (--ci) and added it to the COPR build.

  • Added the missing packages for the Debian build. It now need *-dev packages to allow pkg-config to query it.

  • This project uses recent c++ syntax that requires an up-to-date compiler. Ubuntu-22 does not provide a recent enough compiler. This is added with a ppa:

    function add_test_ppa() {
    if [ "$ubuntu_test_repo" == 1 ]; then
    $package_install_command "software-properties-common"
    ${sudo_cmd} add-apt-repository ppa:ubuntu-toolchain-r/test -y
    fi
    This install also requires a newer libstdc++ library. If the user tries to run sunshine without updating their system with this ppa, it will give a runtime link error. So I tested a bit and the solution I could come up with is to static link this lib when the compiler is < 14 (56cd373).

  • Some of the debian-based builds also had a runtime error for missing the package libicu. This lib is versioning itself within its name... which is :(. This a unicode lib, I believe, so I would expect it to be there on almost all systems. To be sure I've added the debian-base distro versions (libicu76 | libicu74 | libicu70) to the deb package dependencies (e1286f6).

This fixed all the build / run issues with docker and the ci.

Notes
As a bonus I've added an extra info step to the docker builds. This prints all the relevant information about the package to debug faster.

Let me know what you think. Also I'm not sure about the --ci flag naming (maybe be more specific with naming it SYSTEMD something).

Issues Fixed or Closed

Fixes #4243

Roadmap Issues

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Unit tests have been added or updated for any new or modified functionality

AI Usage

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

@PVermeer
Copy link
Contributor Author

PVermeer commented Sep 26, 2025

@ReenigneArcher Started this PR to discuss furter.

Docker works differently with systemd (it doesn't work unless...) but it should work with the variable query that Sunshine does. I will look into it.

@PVermeer PVermeer force-pushed the build_failing_debian branch from cae4d3f to a100ccb Compare September 26, 2025 20:29
@sonarqubecloud
Copy link

@PVermeer PVermeer marked this pull request as ready for review September 28, 2025 12:22
@PVermeer PVermeer changed the title build(linux): fix failing build on Debian Trixie build(linux): fix build packages with systemd services and udev Sep 28, 2025
@PVermeer
Copy link
Contributor Author

@ReenigneArcher I've fixed the debian issue but came across some more issues. See updated op.

Copy link
Member

@ReenigneArcher ReenigneArcher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. There's a lot going on in this and probably should be broken up in multiple.

For starters I have moved the new dependencies to #4319 and added you as a co-author.

I'm not a huge fan of the ci argument. I like the idea of it, but it doesn't work in reality due to the large variation across linux distors. For example, I would love to have docs enabled for all ci builds, but it's just not super feasible due to different versions of doxygen that come with each distro.

More investigation might be needed on the libicu dependency. I think that's a dependency of boost actually?

I like the static link of libgcc. Maybe even for all builds (LizardByte/roadmap#17)

@PVermeer
Copy link
Contributor Author

PVermeer commented Oct 7, 2025

I've created PR #4321 to fix the ubuntu-22 build. I do agree that most of it should be static linked.

When looking into libicu on debian I've also noted that this comes from Boost. boost::locale Uses this and when I looked in the build structure of this module I could not found a way to also static link this besides creating or editing the build config of Boost. I don;t think they support this. We can omit it... but this is not recommended by Boost.

Besides that all other distros have this included in their base except for Debian (docker). The desktop versions of Debian all have this package installed so these should have no problems. I think the current solution is still the best (add it to package dependencies) so we can ensure it's there for at least the Debian based builds.

Concerning the ci argument I was not happy with this too. We can leave it out or have an other solution. I would just remove the if(SYSTEMD_FOUND) statements or replace the logic with a build flag NO_SYSTEMD because I do think it should fail in the CI and not get pushed to users on stable.

@ReenigneArcher
Copy link
Member

For libicu, is there a way to detect which version to use?

We can also put it into the else section of this block, since I believe it only applies when we static link boost.

if(NOT BOOST_USE_STATIC)
    set(CPACK_DEBIAN_PACKAGE_DEPENDS "\
                ${CPACK_DEBIAN_PACKAGE_DEPENDS}, \
                libboost-filesystem${Boost_VERSION}, \
                libboost-locale${Boost_VERSION}, \
                libboost-log${Boost_VERSION}, \
                libboost-program-options${Boost_VERSION}")
    set(CPACK_RPM_PACKAGE_REQUIRES "\
                ${CPACK_RPM_PACKAGE_REQUIRES}, \
                boost-filesystem >= ${Boost_VERSION}, \
                boost-locale >= ${Boost_VERSION}, \
                boost-log >= ${Boost_VERSION}, \
                boost-program-options >= ${Boost_VERSION}")
endif()

@PVermeer
Copy link
Contributor Author

PVermeer commented Oct 8, 2025

I think I found the issue with libicu.

# This should automatically figure out dependencies, doesn't work with the current config
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF)

Is this still nessecary? I only found an issue with the file package not installed. Turning this back on and adding file to the debian package list fixes all dependency issues. Just like in the COPR build it would automatically add all shared dependencies, including libicu.

Anyway if create PR #4323 with this build setup.

Alternative:
I found out that cmake provides a module for ICU (like `FindUdev``) FindICU . This could be used like this:

    find_package(ICU COMPONENTS uc data i18n REQUIRED)
    # ICU does not provide a minor / major version variable.
    string(REGEX MATCH "^[0-9]+" ICU_VERSION_MAJOR ${ICU_VERSION})
    # Debian-based distros have libicu versioned in the name.
    set(CPACK_DEBIAN_PACKAGE_DEPENDS "\
                ${CPACK_DEBIAN_PACKAGE_DEPENDS}, \
                libicu${ICU_VERSION_MAJOR}")
    # Fedora based distros provide a general package
    set(CPACK_RPM_PACKAGE_REQUIRES "\
                ${CPACK_RPM_PACKAGE_REQUIRES}, \
                libicu")

@PVermeer
Copy link
Contributor Author

PVermeer commented Oct 9, 2025

I've created the last PR #4325 for Fedora builds. I personally could never build sunshine properly on my own Fedora (docker) but with some changes implemented to the build script taken from the rpm spec I managed to make it work in docker.

Closing this because I think we got just about everything done.

@PVermeer PVermeer closed this Oct 9, 2025
@PVermeer PVermeer deleted the build_failing_debian branch October 9, 2025 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

System D unit not being created on clean install (Unit sunshine.service not found)

2 participants