Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Has anyone been able to get Sunshine to build on Fedora-based distros? #267

Closed
thatsysadmin opened this issue Nov 17, 2021 · 22 comments
Closed

Comments

@thatsysadmin
Copy link

thatsysadmin commented Nov 17, 2021

Are there any instructions on how to build Sunshine for Fedora 35/RHEL derivatives? Thanks!

I tried to build Sunshine on F34 a while ago, but gave up. If I recall, it seemed like it wanted a specific version of GCC.

@thatsysadmin thatsysadmin changed the title Has anyone been able to get this working on Fedora-based distros? Has anyone been able to get Sunshine to build on Fedora-based distros? Nov 17, 2021
@ReenigneArcher
Copy link

Are there any instructions on how to build Sunshine for Fedora 35/RHEL derivatives? Thanks!

I tried to build Sunshine on F34 a while ago, but gave up. If I recall, it seemed like it wanted a specific version of GCC.

I don't know what is different between F33 and F35, but have you seen this? #50 (comment)

@thatsysadmin
Copy link
Author

thatsysadmin commented Nov 19, 2021

I did see it.

Instead of using gcc-10, I just used gcc as a replacement. same for g++.
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ ..

When I run make , it stops at linking the executable with a wall of errors.

@ReenigneArcher
Copy link

I guess you are trying to build this yourself because the .deb packages don't work?

If so, I built Sunshine as an AppImage. I think it will work on Fedora, but I haven't tested it myself. https://github.com/RetroArcher/sunshine.build/releases

@ProjectSynchro
Copy link

I did see it.

Instead of using gcc-10, I just used gcc as a replacement. same for g++. cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ ..

When I run make , it stops at linking the executable with a wall of errors.

Hmm I get this as well, normally errors like that lead me to think of ld attempting to link 32 bit libs to a 64 bit binary.. (although in this case that doesn't seem to be the case.)

I installed the following packages on Fedora to get CMake initially happy:
(I have RPMFusion configured for both CUDA and FFMPEG)

sudo dnf install cmake gcc gcc-c++ openssl-devel libavdevice ffmpeg-devel boost-devel boost-static pulseaudio-libs-devel opus-devel libevdev-devel \
                 libXtst-devel libX11-devel libXrandr-devel libXfixes-devel libxcb-devel \
                 libdrm-devel libcap-devel \
                 wayland-devel \
                 xorg-x11-drv-nvidia-cuda-libs xorg-x11-drv-nvidia-cuda

Initially I get this output:

[ 61%] Linking CXX executable sunshine
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/11/../../../libpulse.so when searching for -lpulse
/usr/bin/ld: skipping incompatible /lib/libpulse.so when searching for -lpulse
/usr/bin/ld: skipping incompatible /usr/lib/libpulse.so when searching for -lpulse
/usr/bin/ld: cannot find -lpulse
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/11/../../../libpulse.so when searching for -lpulse
/usr/bin/ld: skipping incompatible /lib/libpulse.so when searching for -lpulse
/usr/bin/ld: skipping incompatible /usr/lib/libpulse.so when searching for -lpulse
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/sunshine.dir/build.make:610: sunshine] Error 1
make[1]: *** [CMakeFiles/Makefile2:156: CMakeFiles/sunshine.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

I messed with the build system a bit (see this patch: pulseaudio-patch.txt) to see if I could get cmake to link the right libraries and I seem to get a bit further (I think).

I get this when linking:

[100%] Linking CXX executable sunshine
/usr/bin/ld: CMakeFiles/sunshine.dir/sunshine/platform/linux/audio.cpp.o: undefined reference to symbol 'pa_context_disconnect@@PULSE_0'
/usr/bin/ld: /usr/lib64/libpulse.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/sunshine.dir/build.make:609: sunshine] Error 1
make[1]: *** [CMakeFiles/Makefile2:156: CMakeFiles/sunshine.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

Which means for some reason Fedora's version of PulseAudio doesn't include this function? This could be why ld is considering that library incompatible.

Currently Fedora packages PulseAudio 15, do any Ubuntu distros package that version to test if it's just down to Fedora's version being weird?

@ReenigneArcher
Copy link

Currently Fedora packages PulseAudio 15, do any Ubuntu distros package that version to test if it's just down to Fedora's version being weird?

Ubuntu 21.10 uses the same version. https://packages.ubuntu.com/impish/pulseaudio

20.04LTS uses version 13.99

@thatsysadmin
Copy link
Author

thatsysadmin commented Dec 17, 2021

@ReenigneArcher
No dice.
sudo ./sunshine.AppImage

Setting $HOME to /tmp/MicrosoftEdgeDownloads/28e426ac-45f5-4d03-b329-5c9f87a27daa/sunshine_linux/sunshine/sunshine.AppImage.home
Setting $XDG_CONFIG_HOME to /tmp/MicrosoftEdgeDownloads/28e426ac-45f5-4d03-b329-5c9f87a27daa/sunshine_linux/sunshine/sunshine.AppImage.config
./sunshine.AppImage: symbol lookup error: /lib64/libgio-2.0.so.0: undefined symbol: g_module_open_full

@ReenigneArcher
Copy link

@thatsysadmin might be an issue with AppImage in general.

I found these similar issues when searching for g_module_open_full

And a possible solution that I will look into (seems I need to package this is a bit differently) https://bbs.archlinux.org/viewtopic.php?pid=1994258#p1994258

@michalzxc
Copy link

Fedora 35:

sudo dnf group install "Development Tools"
sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
sudo dnf install -y openssl-devel ffmpeg-devel boost-devel boost-static.x86_64 pulseaudio-libs-devel opus-devel libXtst-devel libX11-devel libXfixes-devel libevdev-devel libxcb-devel cmake
sudo dnf install libXcursor-devel libXrandr-devel libXinerama-devel libXi-devel mesa-libGL-devel
git clone https://github.com/loki-47-6F-64/sunshine.git --recurse-submodules
cd sunshine/
mkdir build
cd build/
cmake ..
make

Could you make a official package?

@ReenigneArcher
Copy link

sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
sudo dnf install -y openssl-devel ffmpeg-devel boost-devel boost-static.x86_64 pulseaudio-libs-devel opus-devel libXtst-devel libX11-devel libXfixes-devel libevdev-devel libxcb-devel cmake
sudo dnf install libXcursor-devel libXrandr-devel libXinerama-devel libXi-devel mesa-libGL-devel

I'm looking into automating the build on Fedora, Thanks!

@ProjectSynchro
Copy link

Currently Fedora packages PulseAudio 15, do any Ubuntu distros package that version to test if it's just down to Fedora's version being weird?

Ubuntu 21.10 uses the same version. https://packages.ubuntu.com/impish/pulseaudio

20.04LTS uses version 13.99

Just tested building sunshine in a Ubuntu 21.10 docker container and was able to link without issues. There appears to be some issue with Fedora's distribution of PulseAudio..

@michalzxc
Copy link

Fedora is using fork of pusleaudio PipeWire, it works without issue with Sunshine for me 🤔

@ReenigneArcher
Copy link

I've now successfully built sunshine in Fedora 33 and 35 using docker. Still researching how to make an rpm package file.

Required dependencies from my testing are below.

Fedora 33 (https://github.com/ReenigneArcher/Sunshine/runs/4577019646?check_suite_focus=true#step:4:196)

    dnf -y update && \
    dnf -y group install "Development Tools" && \
    dnf -y install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm && \
    dnf -y install \
        boost-devel \
        boost-static.x86_64 \
        cmake \
        ffmpeg-devel \
        libevdev-devel \
        libxcb-devel \
        libX11-devel \
        libXfixes-devel \
        libXrandr-devel \
        libXtst-devel \
        openssl-devel \
        opus-devel \
        pulseaudio-libs-devel \
    && dnf clean all \
    && rm -rf /var/cache/yum

Fedora 35 (https://github.com/ReenigneArcher/Sunshine/runs/4577019666?check_suite_focus=true#step:4:192)

    dnf -y update && \
    dnf -y group install "Development Tools" && \
    dnf -y install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm && \
    dnf -y install \
        boost-devel \
        boost-static.x86_64 \
        cmake \
        ffmpeg-devel \
        gcc-c++ \
        libevdev-devel \
        libxcb-devel \
        libX11-devel \
        libXcursor-devel \
        libXfixes-devel \
        libXinerama-devel \
        libXi-devel \
        libXrandr-devel \
        libXtst-devel \
        mesa-libGL-devel \
        openssl-devel \
        opus-devel \
        pulseaudio-libs-devel \
    && dnf clean all \
    && rm -rf /var/cache/yum

@ProjectSynchro
Copy link

I've now successfully built sunshine in Fedora 33 and 35 using docker. Still researching how to make an rpm package file.

Required dependencies from my testing are below.

Fedora 33 (https://github.com/ReenigneArcher/Sunshine/runs/4577019646?check_suite_focus=true#step:4:196)

    dnf -y update && \
    dnf -y group install "Development Tools" && \
    dnf -y install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm && \
    dnf -y install \
        boost-devel \
        boost-static.x86_64 \
        cmake \
        ffmpeg-devel \
        libevdev-devel \
        libxcb-devel \
        libX11-devel \
        libXfixes-devel \
        libXrandr-devel \
        libXtst-devel \
        openssl-devel \
        opus-devel \
        pulseaudio-libs-devel \
    && dnf clean all \
    && rm -rf /var/cache/yum

Fedora 35 (https://github.com/ReenigneArcher/Sunshine/runs/4577019666?check_suite_focus=true#step:4:192)

    dnf -y update && \
    dnf -y group install "Development Tools" && \
    dnf -y install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm && \
    dnf -y install \
        boost-devel \
        boost-static.x86_64 \
        cmake \
        ffmpeg-devel \
        gcc-c++ \
        libevdev-devel \
        libxcb-devel \
        libX11-devel \
        libXcursor-devel \
        libXfixes-devel \
        libXinerama-devel \
        libXi-devel \
        libXrandr-devel \
        libXtst-devel \
        mesa-libGL-devel \
        openssl-devel \
        opus-devel \
        pulseaudio-libs-devel \
    && dnf clean all \
    && rm -rf /var/cache/yum

Interesting, I wonder what is installed that causes it to link correctly in Fedora's docker image as opposed to on a Workstation install..

Fedora is using fork of pusleaudio PipeWire, it works without issue with Sunshine for me 🤔

This application still links to the pulseaudio library and is a pulseaudio application. pulseaudio-pipewire is essentially a layer that interprets calls to the pulseaudio API and instructs pipewire how to configure itself with it's API.

@thatsysadmin
Copy link
Author

thatsysadmin commented Dec 24, 2021

@ProjectSynchro
Tried to build it today on Workstation with mesa-libGL-devel installed as of writing this comment and it seems to work; I think I was just missing that. It seems like that was the only thing I was missing.

EDIT: When running it I got an access denied error when it tried to connect to "Pulseaudio". Might have to check SELinux.

@michalzxc
Copy link

I have default selinux and it works. I had to manually change Sink tho - autodetection didn't catch it

[root@thebeast ~]# getenforce
Enforcing
[michal@thebeast ~]$ pactl info | grep Sink
Default Sink: alsa_output.usb-Generic_USB_Audio-00.iec958-stereo

@ProjectSynchro
Copy link

@ProjectSynchro Tried to build it today on Workstation with mesa-libGL-devel installed as of writing this comment and it seems to work; I think I was just missing that. It seems like that was the only thing I was missing.

EDIT: When running it I got an access denied error when it tried to connect to "Pulseaudio". Might have to check SELinux.

It looks like I was running into multi-arch dependency hell.. After checking through and ensuring I've got the 64bit libs installed, I could link correctly.

Seems I wasn't too far off in #267 (comment)

@ReenigneArcher
Copy link

We have Dockerfiles in SunshineStream's Sunshine repo that build fedora 33 and 35 now. If anyone wants to contribute on packaging into an rpm that would be welcome. https://github.com/SunshineStream/Sunshine/tree/master/scripts

@thatsysadmin
Copy link
Author

thatsysadmin commented Jan 22, 2022

@ReenigneArcher Haven't got any experience in RPM packaging. I could try, but when I cloned the repo as of today, cmake complains. Seems like same commit between 29 days ago and today. Was able to build it 29 days ago.
Do you know if cmake pulls the dependencies when I run it?

CMake Error at CMakeLists.txt:14 (add_subdirectory):
  add_subdirectory given source "third-party/moonlight-common-c/enet" which
  is not an existing directory.


CMake Error at CMakeLists.txt:15 (add_subdirectory):
  The source directory

    /home/CD SUN/Desktop/sunshine/third-party/Simple-Web-Server

  does not contain a CMakeLists.txt file.


CMake Error at CMakeLists.txt:21 (add_subdirectory):
  add_subdirectory given source "third-party/miniupnp/miniupnpc" which is not
  an existing directory.

EDIT: clarity

@ProjectSynchro Tried to build it today on Workstation with mesa-libGL-devel installed as of writing this comment and it seems to work; I think I was just missing that. It seems like that was the only thing I was missing.

EDIT: When running it I got an access denied error when it tried to connect to "Pulseaudio". Might have to check SELinux.

@ReenigneArcher
Copy link

@thatsysadmin

Haven't got any experience in RPM packaging. I could try, but when I cloned the repo as of today, cmake complains. Seems like same commit between 29 days ago and today. Was able to build it 29 days ago. Do you know if cmake pulls the dependencies when I run it?

Note: It's a different repo than Loki's (this one), as we don't have any ability to maintain Loki's repo. Doesn't appear that you've ever forked it. The scripts in the link I posted build in docker.

@thatsysadmin
Copy link
Author

No I cloned Loki's to my local machine.

@thatsysadmin
Copy link
Author

thatsysadmin commented Mar 12, 2022

@ReenigneArcher
I know it's been a while, got backlogged with other stuff. But I'm going to see if I can try my hand at building an RPM package in a couple of days using the SunshineStream/Sunshine repo. I'm aware you suggested cpack in LizardByte/Sunshine#7 , but I don't have any experience in cmake/cpack, so I might try my hand in writing a script that uses rpmbuild to build a package. I'm not sure if that's acceptable for a PR though.

One more thing, is there an option to temporarily build without the CUDA toolkit on NVIDIA systems? I'm having trouble with getting the CUDA toolkit on my machine in check for NVENC support so CMake is spitting out a can't find toolkit error. I don't want to worry about NVENC right now.

EDIT: Forget it. I forked the repo and the cmake command worked. Maybe it was because it was not my own fork. Whatever it was, it works now.

@thatsysadmin
Copy link
Author

Future people:

Moving this to LizardByte/Sunshine#7

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

No branches or pull requests

4 participants