LizardByte / Sunshine

Self-hosted game stream host for Moonlight.
http://app.lizardbyte.dev/Sunshine/
GNU General Public License v3.0
17.99k stars 869 forks source link

Improve MacOS packaging #186

Closed ReenigneArcher closed 6 months ago

ReenigneArcher commented 2 years ago

Describe the Bug

The dmg packages are not use-able currently and therefore will not be included in release assets until this is resolved.

Known issues:

dyld[1028]: Library not loaded: /usr/local/opt/opus/lib/libopus.0.dylib
  Referenced from: /Users/reenignearcher/Downloads/sunshine-macos/Sunshine/usr/local/Sunshine.app/Contents/MacOS/sunshine-0.13.0
  Reason: tried: '/usr/local/opt/opus/lib/libopus.0.dylib' (no such file), '/usr/local/lib/libopus.0.dylib' (no such file), '/usr/lib/libopus.0.dylib' (no such file)
zsh: abort      ./sunshine

Expected Behavior

No response

Additional Context

We could set CPACK_BUNDLE_STARTUP_COMMAND similar to this project: https://github.com/MegaGlest/megaglest-source/blob/1e4441e0996c2045f29998a3fd9b2b7a6c2ad441/mk/macos/CMakeLists.txt#L43

The command points to this file: https://github.com/MegaGlest/megaglest-source/blob/develop/mk/macos/bundle_resources/MegaGlest.sh

Sunshine Host Operating System and Version

MacOS

Architecture

-

Sunshine Version

0.14.0

GPU Type

-

GPU Model

-

GPU Driver/Mesa Version

-

Capture Method (Linux Only)

-

ReenigneArcher commented 2 years ago

Can create a pkg and/or dmg using macports, but still missing the same libraries. Can also create a multipackage; however resulting pkg is ~400mb, which in my opinion is excessively large.

Dizzo786 commented 2 years ago

Can create a pkg and/or dmg using macports, but still missing the same libraries. Can also create a multipackage; however resulting pkg is ~400mb, which in my opinion is excessively large.

@ReenigneArcher Is it possible to share a link to the 400mb multipackage? I'm on a Monterey 12.5.1 where I cannot install Xcode and MacPorts.

ReenigneArcher commented 2 years ago

Sorry, but I think those builds are expired.

Dizzo786 commented 2 years ago

I can file a bug as well for this. Im getting Error: Port Sunshine not found when I follow the installation instruction for macOS. Im on Monterey 12.5.1, MacPorts 2.7.2 and XCode 13.4.1

ReenigneArcher commented 2 years ago

I can file a bug as well for this. Im getting Error: Port Sunshine not found when I follow the installation instruction for macOS. Im on Monterey 12.5.1, MacPorts 2.7.2 and XCode 13.4.1

I found a small typo in the instructions. If you copied and pasted the commands it would have shown an error prior to the error you showed.

I've updated the docs here: https://docs.lizardbyte.dev/projects/sunshine/en/latest/about/installation.html#portfile

Those instructions should work as I just tested them.

If those still don't work, then please share the output of these commands. cat /opt/local/etc/macports/sources.conf ls ~/ports/multimedia/sunshine/

Dizzo786 commented 2 years ago

I found a small typo in the instructions. If you copied and pasted the commands it would have shown an error prior to the error you showed.

I've updated the docs here: https://lizardbyte--330.org.readthedocs.build/projects/sunshine/en/330/about/installation.html#portfile

Those instructions should work as I just tested them.

If those still don't work, then please share the output of these commands. cat /opt/local/etc/macports/sources.conf ls ~/ports/multimedia/sunshine/

I was able to make it work and it paired great from mac to mac using Moonlight PC.

Link you shared has a typo. This line file://Users/<username>/ports should be file:////Users/<username>/ports.

Would it be possible to share the script to generate multipackage standalone pkg. I want to run sunshine on a mac where I can't install XCode.

ReenigneArcher commented 2 years ago

Link you shared has a typo.

Looks like we're both wrong... it should be file:///...

https://guide.macports.org/#development.local-repositories.

Would it be possible to share the script to generate multipackage standalone pkg.

I just used macports to create the package. If you already have macports installed and the sunshine port installed, it's quite easy. See here: https://guide.macports.org/#using.binaries.binary-packages

kid-syre commented 1 year ago

Hi there I'm trying to install Sunshine on a mac running El capitan but I get the Port sunshine not found error every time I try to install.

ReenigneArcher commented 1 year ago

El Capitan is not supported. Upgrade your OS.

iMonZ commented 1 year ago

Any news here?

I get this while starting:

dyld[42802]: Library not loaded: /usr/local/opt/boost/lib/libboost_locale-mt.dylib Referenced from: /usr/local/bin/sunshine-0.20.0 Reason: tried: '/usr/local/opt/boost/lib/libboost_locale-mt.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/boost/lib/libboost_locale-mt.dylib' (no such file), '/usr/local/opt/boost/lib/libboost_locale-mt.dylib' (no such file), '/usr/local/lib/libboost_locale-mt.dylib' (no such file), '/usr/lib/libboost_locale-mt.dylib' (no such file, not in dyld cache) fish: Job 1, 'sunshine' terminated by signal SIGABRT (Abort)

rzwitserloot commented 11 months ago

Mac builds are x64 only right now, which probably means its not usable on ARM macs due to library incompatibility issues.

A manual to get as far as I got:

brew install opus
sudo mkdir -p /usr/local/opt/opus/lib
sudo ln -s /opt/homebrew/Cellar/opus/1.4/lib/libopus.0.dylib /usr/local/opt/opus/lib

i.e. the mac is willing to emulate the x64 build, but is not willing to mix architectures.

There is a very promising link in this ticket, by @ReenigneArcher - https://lizardbyte--330.org.readthedocs.build/projects/sunshine/en/330/about/installation.html#portfile - but that link no longer works, unfortunately.

ReenigneArcher commented 11 months ago

Just use the portfile and be done with it.

https://docs.lizardbyte.dev/projects/sunshine/en/latest/about/installation.html#portfile

vukael39 commented 11 months ago

Hi @ReenigneArcher, I follow your guide to use macport and portfile. Tried v0.20.0, v0.19.1, and your suggestion build in (https://github.com/LizardByte/Sunshine/issues/1348#issuecomment-1701570544). That build has no boost180 Macports issue, but still not usable on ARM macs due to library incompatibility issues.

dyld[8266]: Library not loaded: /opt/local/lib/libopus.0.dylib
Referenced from: <0C19FBAA-29B7-3EB4-BDE3-B7446FF26290> /opt/local/bin/sunshine-0.18.3
Reason: tried: '/opt/local/lib/libopus.0.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/opt/local/lib/libopus.0.dylib' (no such file), '/opt/local/lib/libopus.0.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/usr/local/lib/libopus.0.dylib' (no such file), '/usr/lib/libopus.0.dylib' (no such file, not in dyld cache)
[1] 8266 abort sunshine
ReenigneArcher commented 11 months ago

Try nightly portfile

iMonZ commented 11 months ago

Try nightly portfile

Maybe it’s a great idea to switch to Homebrew. Postfile isn’t up to date anymore and I a pain to use in modern macOS Systems. Took me nearly an hour to figure out how to install it or set it up. While Homebrew installation itself works much more user friendly

vukael39 commented 11 months ago

Try nightly portfile

Thanks, I'll try that.

Try nightly portfile

Maybe it’s a great idea to switch to Homebrew. Postfile isn’t up to date anymore and I a pain to use in modern macOS Systems. Took me nearly an hour to figure out how to install it or set it up. While Homebrew works out of the box.

Did you use homebrew to solve problem?

Thank u both!

iMonZ commented 11 months ago

Why does Sunshine need Xorg libraries to compile? Isn't this completely legacy and unnecessary?

tqoo commented 11 months ago

Try nightly portfile

I can't find a nightly option anywhere. Where can I download the nightly Portfile?

iMonZ commented 11 months ago

Try nightly portfile

I can't find a nightly option anywhere. Where can I download the nightly Portfile?

https://github.com/LizardByte/Sunshine/blob/nightly/packaging/macos/Portfile

It's still compiling the dependencies for like 40 min... Thats why using MacPort isnt the best idea.

ReenigneArcher commented 11 months ago

Postfile isn’t up to date anymore

Yes it is... we build it on every single PR and push event, so often multiple times a day.

https://github.com/LizardByte/Sunshine/blob/nightly/packaging/macos/Portfile

That is NOT the portfile to use... that one is used to generate the portfile that we publish.

Links to downloads can be found on the website. https://app.lizardbyte.dev/Sunshine/

iMonZ commented 11 months ago

Postfile isn’t up to date anymore

Yes it is... we build it on every single PR and push event, so often multiple times a day.

https://github.com/LizardByte/Sunshine/blob/nightly/packaging/macos/Portfile

That is NOT the portfile to use... that one is used to generate the portfile that we publish.

Links to downloads can be found on the website. https://app.lizardbyte.dev/Sunshine/

Maybe it's a good idea to replace the release files for macOS from an DMG to a pkg installer DMG are only for .app files with an GUI which Sunshine isn't

ReenigneArcher commented 11 months ago

A PR would be welcomed as long as it addresses the linking issues. dmg and pkg will have the same linking problems.

https://github.com/LizardByte/Sunshine/pull/1141

Also, I think pkg and/or dmg will not be compatible with arm architecture. GitHub only gives us access to x86_64 runners so we can't compile on arm.

Setting up Sunshine for cross compilation is probably a completely separate topic.

vukael39 commented 11 months ago

Try nightly portfile

Nightly portfile worked and finish installation. Then I run sunshine command to load, another issue appear.

[2023:10:04:04:52:51]: Info: Sunshine version: 0.20.0
[2023:10:04:04:52:51]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2023:10:04:04:52:51]: Info: Trying encoder [videotoolbox]
[2023:10:04:04:52:51]: Info: SDR color coding [Rec. 601]
[2023:10:04:04:52:51]: Info: Color depth: 8-bit
[2023:10:04:04:52:51]: Info: Color range: [JPEG]
[2023:10:04:04:52:52]: Info: [h264_videotoolbox @ 0x132f09d70] This device does not support the AllowOpenGop option. Value ignored.
[1]    79603 segmentation fault  sudo sunshine

Could you give me a link if the issue is already mentioned? Thank you for your support.

ReenigneArcher commented 11 months ago

Another dev just mentioned they have fixed these issues. I'm sure they'll put up a PR soon.

iMonZ commented 11 months ago

Try nightly portfile

Nightly portfile worked and finish installation. Then I run sunshine command to load, another issue appear.

[2023:10:04:04:52:51]: Info: Sunshine version: 0.20.0
[2023:10:04:04:52:51]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2023:10:04:04:52:51]: Info: Trying encoder [videotoolbox]
[2023:10:04:04:52:51]: Info: SDR color coding [Rec. 601]
[2023:10:04:04:52:51]: Info: Color depth: 8-bit
[2023:10:04:04:52:51]: Info: Color range: [JPEG]
[2023:10:04:04:52:52]: Info: [h264_videotoolbox @ 0x132f09d70] This device does not support the AllowOpenGop option. Value ignored.
[1]    79603 segmentation fault  sudo sunshine

Could you give me a link if the issue is already mentioned? Thank you for your support.

h264_videotoolbox doesnt sound right. We need hevc instead of h264 on macOS

iMonZ commented 11 months ago

A PR would be welcomed as long as it addresses the linking issues. dmg and pkg will have the same linking problems.

1141

Also, I think pkg and/or dmg will not be compatible with arm architecture. GitHub only gives us access to x86_64 runners so we can't compile on arm.

Setting up Sunshine for cross compilation is probably a completely separate topic.

https://github.blog/2023-10-02-introducing-the-new-apple-silicon-powered-m1-macos-larger-runner-for-github-actions/

ReenigneArcher commented 11 months ago

Are you going to pay the bill?

vukael39 commented 11 months ago

Another dev just mentioned they have fixed these issues. I'm sure they'll put up a PR soon.

PR is pull request? So I need to wait for new update nightly portfile right? Thank you.

iMonZ commented 11 months ago

Are you going to pay the bill?

So cross compilation is the way we need to go?

vukael39 commented 11 months ago

Finally, I can successful running sunshine pretty well. I downloaded v0.19.1 Portfile and edit boost.version to 1.81. Thanks @ReenigneArcher for your support.

iMonZ commented 11 months ago

Has anyone got a working Homebrew formula?

ReenigneArcher commented 11 months ago

@iMonZ compiling yourself is not too difficult, probably your easiest path forward. https://docs.lizardbyte.dev/projects/sunshine/en/latest/building/build.html

rolfen commented 8 months ago

Can create a pkg and/or dmg using macports, but still missing the same libraries. Can also create a multipackage; however resulting pkg is ~400mb, which in my opinion is excessively large.

macports downloads about 900 megabytes of "distfiles" (then it fails to build).

So a ~400mb dmg would be an improvement.

@iMonZ compiling yourself is not too difficult, probably your easiest path forward. https://docs.lizardbyte.dev/projects/sunshine/en/latest/building/build.html

Thanks. Broken packages should be removed from distribution and/or installation documentation should be amended.

ReenigneArcher commented 8 months ago

@rolfen We build EVERY pull request in Macports before merging, so I have no idea what everyone's issue with it is.

Vertux commented 7 months ago

Maybe it’s a great idea to switch to Homebrew.

I would also favour Homebrew, MacPorts is not an option for me.

r-glebov commented 6 months ago

Who uses MacPorts? Homebrew is 99% of mac users. Tried to install sunshine, but there are no docs, nothing. Just .dmg file which doesn't do anything.

ReenigneArcher commented 6 months ago

dmg does not include runtime deps, that's documented in our docs: https://docs.lizardbyte.dev/projects/sunshine/en/latest/about/installation.html#dmg

r-glebov commented 6 months ago

dmg does not include runtime deps, that's documented in our docs: https://docs.lizardbyte.dev/projects/sunshine/en/latest/about/installation.html#dmg

Yes, now I see. I installed MacPorts on my Mac M1 and had some attempts to install Sunshine with Portfile, but no luck, some issues during compilation.

ReenigneArcher commented 6 months ago

Without more details, there's no way to help.

r-glebov commented 6 months ago

Without more details, there's no way to help.

the problem is that I have Homebrew installed with lots of software which I installed for my working projects. And macports can't coexist with Homebrew properly, they use the same folder to install packages. I spent several hours trying different approaches with Macports to install Sunshine, didn't work for me. Macports tried to build all the dependencies for quite a long time, and in the end it just errored with some incompatibility issues. Maybe it'll work for someone else with intel Mac or no Homebrew installation, but for me it was big waste of time just to try Sunshine, so I'll install Parsec and forget about it.

iMonZ commented 6 months ago

@iMonZ compiling yourself is not too difficult, probably your easiest path forward. https://docs.lizardbyte.dev/projects/sunshine/en/latest/building/build.html

I get errors all the time, I try to compile. And Macports doesn't work in general. I just installed MacPorts for Sunshine, and it mashed up my macOS installation. HomeBrew should work out of the box. So MacPorts should really be dropped in favor of HomeBrew. As you see most people have problems and I don't know any tool which is using MacPorts

Geczy commented 6 months ago

same issue, here's some details

➜  bin ./sunshine
dyld[8001]: Library not loaded: /usr/local/opt/miniupnpc/lib/libminiupnpc.17.dylib
  Referenced from: <85B924EC-D9A5-3F7C-B9DB-DCC7C7541A7C> /Applications/usr/bin/sunshine-0.22.0
  Reason: tried: '/usr/local/opt/miniupnpc/lib/libminiupnpc.17.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/miniupnpc/lib/libminiupnpc.17.dylib' (no such file), '/usr/local/opt/miniupnpc/lib/libminiupnpc.17.dylib' (no such file), '/usr/local/lib/libminiupnpc.17.dylib' (no such file), '/usr/lib/libminiupnpc.17.dylib' (no such file, not in dyld cache)
[1]    8001 abort      ./sunshine
r-glebov commented 6 months ago

@Geczy The problem is that after you fix the issue with one library you'll get the next one failed, and many more. Been there with my Mac M1

iMonZ commented 6 months ago

@Geczy The problem is that after you fix the issue with one library you'll get the next one failed, and many more. Been there with my Mac M1

I get the exact issue when I try to compile it. Wasted many GB of Librarys and Time...

ReenigneArcher commented 6 months ago

This is not a support thread. Please keep the discussion around the macOS dmg package.

fredsvanelli commented 6 months ago

MacOS Sonoma 14.2.1

~/ports:
$ cat /opt/local/etc/macports/sources.conf 

>
rsync://rsync.macports.org/macports/release/tarballs/ports.tar [default]
file:///Users/fred/ports

Then:

~/ports:
$ sudo port install sunshine                                                           

> Error: Port sunshine not found
ReenigneArcher commented 6 months ago

dmg is being dropped as part of #2222 in favor of homebrew