Opened 3 years ago

Last modified 20 months ago

#64777 new defect

mpv 0.34.1: Xcode is required even for the precompiled binary

Reported by: dardo82 (Michele Venturi) Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.7.1
Keywords: highsierra Cc: Ionic (Mihai Moldovan), i0ntempest
Port: mpv

Description

MPV needs Xcode, otherwise it prints an error:

dyld: Library not loaded: @rpath/libswiftAVFoundation.dylib
  Referenced from: /opt/local/bin/mpv
  Reason: image not found

All the missing libraries are available in /usr/lib/swift,
but LC_RPATH (checked with otool -l $(which mpv))
points only to /opt/local/lib and the Xcode directory.

Is this issue caused by the way the port is built
or should it be fixed upstream instead of here?

Change History (6)

comment:1 Changed 3 years ago by Wowfunhappy (Jonathan)

See also, mailing list discussion: https://lists.macports.org/pipermail/macports-users/2022-March/050875.html

The OP is trying to install MPV on a machine that does not have Xcode installed. This should work because MPV is available from MacPorts as a binary archive.

OP, for the sake of completeness, are the Developer Command Line Tools installed?

comment:2 Changed 3 years ago by kencu (Ken)

BTW, it's pretty easy to add another search path to the rpath search paths.

Look up "-add_rpath" in the install_name_tool man page.

Then add one to where you have noted the libraries to be, using install_name_tool, to mpv

then you will get an idea how easy a fix may or may not be for MacPorts.

Version 0, edited 3 years ago by kencu (Ken) (next)

comment:3 Changed 3 years ago by dardo82 (Michele Venturi)

I have the CommandLineTools installed.


RPATH can be changed with command:
sudo install_name_tool -add_rpath /usr/lib/swift $(which mpv)

With the lib dir in RPATH I get this error:

dyld: Symbol not found: __T0So8NSWindowC5LevelV6AppKit01_cdD23NumericRawRepresentableAEWP
  Referenced from: /opt/local/bin/mpv
  Expected in: /usr/lib/swift/libswiftAppKit.dylib
 in /opt/local/bin/mpv
zsh: abort      mpv

that is similar to what is reported here:
https://github.com/mpv-player/mpv/issues/9714


The libraries are from a support package:

pkgutil --file-info /usr/lib/swift/libswiftAppKit.dylib
volume: /
path: /usr/lib/swift/libswiftAppKit.dylib

pkgid: com.apple.pkg.SwiftRuntimeForCommandLineTools
pkg-version: 10.2.0.0.1.1552586384
install-time: 1645223925
uid: 0
gid: 0
mode: 755

that can be downloaded here from Apple:
https://support.apple.com/kb/dl1998


The libraries in Xcode.app and /usr/lib/swift are different:

diff /usr/lib/swift/libswiftAppKit.dylib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/libswiftAppKit.dylib
Binary files /usr/lib/swift/libswiftAppKit.dylib and /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/libswiftAppKit.dylib differ


I use Xcode 9.4.1 plus Swift 4.1.2 now.
Let me know if you need other details.

Last edited 3 years ago by dardo82 (Michele Venturi) (previous) (diff)

comment:4 Changed 2 years ago by i0ntempest

Does the issue still exists on High Sierra? For me on Monterey I can see RPATH includes /usr/lib/swift.

comment:5 Changed 21 months ago by mrkapqa

Hello , i am having similar issue on HighSierra?

mpv
dyld: Symbol not found: __T0So8NSWindowC5LevelV6AppKit01_cdD23NumericRawRepresentableAEWP
  Referenced from: /opt/local/bin/mpv
  Expected in: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/libswiftAppKit.dylib
 in /opt/local/bin/mpv
Abort trap: 6

Last edited 21 months ago by mrkapqa (previous) (diff)

comment:6 Changed 20 months ago by mrkapqa

Hello , the issue occurs with Xcode 10.1 on MacOS HighSierra, downgrading Xcode to 9.4.1 solves the issue.

Note: See TracTickets for help on using tickets.