Sunshine icon indicating copy to clipboard operation
Sunshine copied to clipboard

MacOS - Compilation fails when using MacPorts for v0.23.1 on Mac M1 Pro

Open usman-receeve opened this issue 9 months ago • 13 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Is your issue described in the documentation?

  • [X] I have read the documentation

Is your issue present in the nightly release?

  • [X] This issue is present in the nightly release

Describe the Bug

The compilation build process failed on macOS Sonoma 14.3 This is the main.log

Expected Behavior

No response

Additional Context

No response

Host Operating System

macOS

Operating System Version

Sonoma 14.3

Architecture

64 bit

Sunshine commit or version

0.23.1

Package

macOS - Portfile

GPU Type

n/a

GPU Model

Apple M2

GPU Driver/Mesa Version

Apple M2

Capture Method (Linux Only)

No response

Config

n/a - Sunshine never compiles

Apps

No response

Relevant log output

:info:build clang: error: linker command failed with exit code 1 (use -v to see invocation)
:info:build make[2]: *** [tests/test_sunshine] Error 1
:info:build make[2]: Leaving directory `/opt/local/var/macports/build/_Users_usmanirale_ports_multimedia_sunshine/Sunshine/work/build'
:info:build make[1]: *** [tests/CMakeFiles/test_sunshine.dir/all] Error 2
:info:build make[1]: Leaving directory `/opt/local/var/macports/build/_Users_usmanirale_ports_multimedia_sunshine/Sunshine/work/build'
:info:build make: *** [all] Error 2
:info:build make: Leaving directory `/opt/local/var/macports/build/_Users_usmanirale_ports_multimedia_sunshine/Sunshine/work/build'
:info:build Command failed:  cd "/opt/local/var/macports/build/_Users_usmanirale_ports_multimedia_sunshine/Sunshine/work/build" && /usr/bin/make -j10 -w all VERBOSE=ON 
:info:build Exit code: 2
:error:build Failed to build Sunshine: command execution failed
:debug:build Error code: CHILDSTATUS 73900 2
:debug:build Backtrace: command execution failed
:debug:build     while executing
:debug:build "system {*}$notty {*}$callback {*}$nice $fullcmdstring"
:debug:build     invoked from within
:debug:build "command_exec -callback portprogress::target_progress_callback build"
:debug:build     (procedure "portbuild::build_main" line 10)
:debug:build     invoked from within
:debug:build "$procedure $targetname"
:error:build See /opt/local/var/macports/logs/_Users_usmanirale_ports_multimedia_sunshine/Sunshine/main.log for details.

usman-receeve avatar Apr 29 '24 13:04 usman-receeve

@usman-receeve from your main.log, it seems macports is trying to install as x86 and not arm, can you try installing like this and report back if anything changes?

sudo arch -arm64 port install sunshine

Hazer avatar May 13 '24 00:05 Hazer

We also fail on "warning", so this might be what you're facing.

:info:build /opt/local/var/macports/build/_Users_usmanirale_ports_multimedia_sunshine/Sunshine/work/Sunshine-0.23.1/src/platform/macos/av_audio.m:19:124: warning: 'AVCaptureDeviceTypeBuiltInMicrophone' is deprecated: first deprecated in macOS 14.0 [-Wdeprecated-declarations]
:info:build     AVCaptureDeviceDiscoverySession *discoverySession = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:@[AVCaptureDeviceTypeBuiltInMicrophone,
:info:build                                                                                                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:info:build                                                                                                                            AVCaptureDeviceTypeMicrophone
:info:build /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVCaptureDevice.h:575:38: note: 'AVCaptureDeviceTypeBuiltInMicrophone' has been explicitly marked deprecated here
:info:build AVF_EXPORT AVCaptureDeviceType const AVCaptureDeviceTypeBuiltInMicrophone API_DEPRECATED_WITH_REPLACEMENT("AVCaptureDeviceTypeMicrophone", macos(10.15, 14.0), ios(10.0, 17.0), macCatalyst(14.0, 17.0)) API_UNAVAILABLE(tvos, visionos) API_UNAVAILABLE(watchos);
:info:build                                      ^
:info:build /opt/local/var/macports/build/_Users_usmanirale_ports_multimedia_sunshine/Sunshine/work/Sunshine-0.23.1/src/platform/macos/av_audio.m:20:7: warning: 'AVCaptureDeviceTypeExternalUnknown' is deprecated: first deprecated in macOS 14.0 [-Wdeprecated-declarations]
:info:build       AVCaptureDeviceTypeExternalUnknown]
:info:build       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:info:build       AVCaptureDeviceTypeExternal
:info:build /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVCaptureDevice.h:563:38: note: 'AVCaptureDeviceTypeExternalUnknown' has been explicitly marked deprecated here
:info:build AVF_EXPORT AVCaptureDeviceType const AVCaptureDeviceTypeExternalUnknown API_DEPRECATED_WITH_REPLACEMENT("AVCaptureDeviceTypeExternal", macos(10.15, 14.0)) API_UNAVAILABLE(ios, macCatalyst, tvos, visionos) API_UNAVAILABLE(watchos);
:info:build                                      ^
:info:build [ 43%] Building CXX object CMakeFiles/sunshine.dir/src/platform/macos/display.mm.o
:info:build 2 warnings generated.

You can try changing this line in your portfile:

configure.args -DBUILD_WERROR=ON \

to

configure.args -DBUILD_WERROR=OFF \

I can't determine why you are getting those warnings though, and we don't get it in our CI... we both are using the same version of clang.

ReenigneArcher avatar May 13 '24 02:05 ReenigneArcher

We also fail on "warning", so this might be what you're facing.

Oh. That may help, still weird that's building on Rosetta instead of arm, from what I can tell from our logs our CI is building arm just ok, and there's no specific arch on portfile config. Even if the builds succeed, it shouldn't build for x86_64. Seems like an env issue to me.

I can't determine why you are getting those warnings though, and we don't get it in our CI... we both are using the same version of clang.

@ReenigneArcher We are getting them too, it has to do with macOS 14+ framework, just kinda hidden on the CI, line 7000 or something of the "Install Sunshine" logs, but for some reason, not found in "build logs". I'll open a PR later to tackle those warnings, they are not an issue yet, but will be.

Hazer avatar May 13 '24 13:05 Hazer

I've seen something similar to the main issue here, I think on discord.

I think that user had migrated their homebrew install from an x86_64 mac to an arm mac, and it was messing with things.

ReenigneArcher avatar May 13 '24 14:05 ReenigneArcher

I'm having an issue compiling using Homebrew on a M1 MacBook Pro. Should I start a new issue or add it here?

I've included the make file with the relevant error. It's complaining that: "symbol(s) not found for architecture arm64"

But when I check homebrew config, it says it's using arm architecture.

If I need to start a new issue, I can definitely do that. 02.make.txt

ArcusMG avatar May 31 '24 22:05 ArcusMG

I'm having an issue compiling using Homebrew on a M1 MacBook Pro. Should I start a new issue or add it here?

I've included the make file with the relevant error. It's complaining that: "symbol(s) not found for architecture arm64"

But when I check homebrew config, it says it's using arm architecture.

If I need to start a new issue, I can definitely do that. 02.make.txt

Same logs as yours. It seems that x86_64 Homebrew had messed up the openssl library search path in my m1 mac.

$ file /usr/local/opt/openssl/lib/libcrypto.dylib
/usr/local/opt/openssl/lib/libcrypto.dylib: Mach-O 64-bit dynamically linked shared library x86_64

I solved the issue by unlinking the x86_64 openssl library, and maybe you can link the library back after the compilation.

$ arch -x86_64 zsh
$ brew unlink openssl

BarryDeng avatar Jun 05 '24 10:06 BarryDeng

I'm having an issue compiling using Homebrew on a M1 MacBook Pro. Should I start a new issue or add it here? I've included the make file with the relevant error. It's complaining that: "symbol(s) not found for architecture arm64" But when I check homebrew config, it says it's using arm architecture. If I need to start a new issue, I can definitely do that. 02.make.txt

Same logs as yours. It seems that x86_64 Homebrew had messed up the openssl library search path in my m1 mac.

$ file /usr/local/opt/openssl/lib/libcrypto.dylib
/usr/local/opt/openssl/lib/libcrypto.dylib: Mach-O 64-bit dynamically linked shared library x86_64

I solved the issue by unlinking the x86_64 openssl library, and maybe you can link the library back after the compilation.

$ arch -x86_64 zsh
$ brew unlink openssl

I really appreciate the reply. Sadly, it doesn't look like that worked for me. I guess Homebrew is more messed up on this computer that I realized. This isn't my normal computer, I won't have access to that for a month or so. Guess I'll have to try again later.

ArcusMG avatar Jun 05 '24 16:06 ArcusMG

You shouldn't need to do this when using the brew formula, but this might help.

https://docs.lizardbyte.dev/projects/sunshine/en/latest/building/macos.html#homebrew

I have an idea to solve this though, through cmake.

ReenigneArcher avatar Jun 16 '24 21:06 ReenigneArcher

My fix made everything worse, lol: https://github.com/LizardByte/Sunshine/pull/2707

🤷‍♂️

ReenigneArcher avatar Jun 16 '24 22:06 ReenigneArcher

same issues on Apple Silicon M1, macOS 14.5 (23F79)

Dreamail avatar Jul 23 '24 11:07 Dreamail

This has mostly to do with Rosetta shenanigans. With that said, I really have no idea for macports, but for brew I want to try something.

I was wondering if finding the path of the brew dependency from inside brew, then forwarding it as an environment var to the compiler, yields better results, or even brew can't find the right one during install. If even brew can't find, I'm afraid it is a Rosetta/brew/ports issue and we can't do much.

@ReenigneArcher so technically speaking, I'm thinking in doing something like I do here: https://github.com/LizardByte/Sunshine/blob/aa2cf8e5a9266d53b0e3ac2d7255b6854dfb574f/packaging/sunshine.rb#L94-L97

And giving this path to the cmake, and maybe use it like you did in #2707, but ONLY with the path brew gave us, instead of having both potential paths there.

find_package(OpenSSL REQUIRED HINTS ${BREW_OPENSSL_PATH})

Hazer avatar Jul 25 '24 03:07 Hazer

Sounds good.

ReenigneArcher avatar Jul 25 '24 15:07 ReenigneArcher

In fact, I fix this issue by unlinking the x86 openssl library.

Dreamail avatar Jul 26 '24 02:07 Dreamail

Been forwarded here from other issue. Could I ask what is wrong about my particular setup? Pasting logs from make as well. 02 - kópia.txt

Pheggas avatar Sep 13 '24 13:09 Pheggas

Closing in favor of a consolidated issue: #3180

Please add any pertinent information to that issue.

ReenigneArcher avatar Sep 13 '24 13:09 ReenigneArcher