mpv-player / mpv-build

🔨 Helper scripts to compile mpv on Linux
http://mpv.io
403 stars 104 forks source link

Can't build libmpv with '-Wl,-Bsymbolic' option on Mac #216

Closed Pulck closed 1 year ago

Pulck commented 1 year ago

when I build with mpv_options "-Dlibmpv=true"

Main binary: /opt/homebrew/opt/python@3.10/bin/python3.10 Build Options: -Dbuildtype=release '-Dc_link_args='"'"'-Wl,-Bsymbolic'"'"'' -Dlibmpv=true Python system: Darwin The Meson build system Version: 0.63.3 Source dir: /Users/colick/Workspace/mpv-build/mpv Build dir: /Users/colick/Workspace/mpv-build/mpv/build Build type: native build Project name: mpv Project version: 0.35.0-UNKNOWN

Detecting compiler via: cc --version compiler returned <Popen: returncode: 0 args: ['cc', '--version']> compiler stdout: Apple clang version 14.0.0 (clang-1400.0.29.202) Target: arm64-apple-darwin22.3.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

compiler stderr:

Running command: cc -E -dM -

Detecting linker via: cc -Wl,--version -Wl,-Bsymbolic linker returned <Popen: returncode: 1 args: ['cc', '-Wl,--version', '-Wl,-Bsymbolic']> linker stdout:

linker stderr: ld: unknown option: --version clang: error: linker command failed with exit code 1 (use -v to see invocation)

Detecting Apple linker via: cc -Wl,-v -Wl,-Bsymbolic linker stdout:

linker stderr: @(#)PROGRAM:ld PROJECT:ld64-820.1 BUILD 20:07:05 Nov 7 2022 configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em Library search paths: /usr/local/lib /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib Framework search paths: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ ld: unknown option: -Bsymbolic clang: error: linker command failed with exit code 1 (use -v to see invocation)

Sanity testing C compiler: cc Is cross compiler: False. Sanity check compiler command line: cc sanitycheckc.c -o sanitycheckc.exe -Wl,-Bsymbolic Sanity check compile stdout:

Sanity check compile stderr: ld: unknown option: -Bsymbolic clang: error: linker command failed with exit code 1 (use -v to see invocation)

meson.build:1:0: ERROR: Compiler cc can not compile programs.

Pulck commented 1 year ago

I remove '-Wl,-Bsymbolic' option in scripts/mpv-config file, and compiled successfully. How can we perfectly solve this problem?

Dudemanguy commented 1 year ago

Sorry, I forgot about this. It seems like this flag is specific to ELF (i.e. .so) and not used by apple. So we should only be using it on linux/bsd platforms probably. Not sure what the best way of solving this atm is.