macOS framework is unusable starting from 1.18.0
The following command works fine with 1.16.0, but fails with 1.18.0 and with latest master:
$ ccache cc -L/usr/lib test.c -o output.exe -O0 -fpermissive -Z -F/Library/Frameworks -framework gstreamer
ld: file not found: @rpath/lib/libgstnet-1.0.0.dylib for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Full clang invocation:
ccache cc -v -L/usr/lib test.c -o output.exe -O0 -fpermissive -Z -F/Library/Frameworks -framework gstreamer
Apple clang version 12.0.5 (clang-1205.0.22.11)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx11.0.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name test.c -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fno-strict-return -fno-rounding-math -munwind-tables -target-sdk-version=11.3 -fvisibility-inlines-hidden-static-local-var -target-cpu penryn -debugger-tuning=lldb -target-linker-version 650.9 -v -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.5 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -F/Library/Frameworks -I/usr/local/include -internal-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include -internal-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.5/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -O0 -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-extra-semi-stmt -Wno-misleading-indentation -Wno-quoted-include-in-framework-header -Wno-implicit-fallthrough -Wno-enum-enum-conversion -Wno-enum-float-conversion -Wno-elaborated-enum-base -fdebug-compilation-dir /Users/nirbheek -ferror-limit 19 -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fmax-type-align=16 -fcommon -fcolor-diagnostics -clang-vendor-feature=+disableNonDependentMemberExprInCurrentInstantiation -fno-odr-hash-protocols -mllvm -disable-aligned-alloc-awareness=1 -o /var/folders/d1/nzvfv38x5qg8qbklsnk1j9xh0000gn/T/test-1b1925.o -x c test.c
clang -cc1 version 12.0.5 (clang-1205.0.22.11) default target x86_64-apple-darwin20.6.0
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/Library/Frameworks (framework directory)
/usr/local/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.5/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
End of search list.
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -no_deduplicate -dynamic -arch x86_64 -platform_version macos 11.0.0 11.3 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -Z -o output.exe -L/usr/lib /var/folders/d1/nzvfv38x5qg8qbklsnk1j9xh0000gn/T/test-1b1925.o -framework gstreamer -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.5/lib/darwin/libclang_rt.osx.a -F/Library/Frameworks
ld: file not found: @rpath/lib/libgstnet-1.0.0.dylib for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The rpath entries look correct, though (see bottom):
Load command 43
cmd LC_RPATH
cmdsize 16
path . (offset 12)
Load command 44
cmd LC_RPATH
cmdsize 32
path @loader_path/.. (offset 12)
Load command 45
cmd LC_RPATH
cmdsize 32
path @executable_path/.. (offset 12)
Load command 46
cmd LC_RPATH
cmdsize 32
path @loader_path/../lib (offset 12)
Load command 47
cmd LC_RPATH
cmdsize 40
path @executable_path/../lib (offset 12)
Full `otool -l` output:
$ otool -l /Library/Frameworks/GStreamer.framework/GStreamer
/Library/Frameworks/GStreamer.framework/GStreamer:
Load command 0
cmd LC_SEGMENT_64
cmdsize 152
segname __TEXT
vmaddr 0x0000000000000000
vmsize 0x000000000000c000
fileoff 0
filesize 49152
maxprot 0x00000005
initprot 0x00000005
nsects 1
flags 0x0
Section
sectname __text
segname __TEXT
addr 0x000000000000c000
size 0x0000000000000000
offset 49152
align 2^0 (1)
reloff 0
nreloc 0
flags 0x80000400
reserved1 0
reserved2 0
Load command 1
cmd LC_SEGMENT_64
cmdsize 72
segname __LINKEDIT
vmaddr 0x000000000000c000
vmsize 0x0000000000004000
fileoff 49152
filesize 48
maxprot 0x00000001
initprot 0x00000001
nsects 0
flags 0x0
Load command 2
cmd LC_ID_DYLIB
cmdsize 96
name /Library/Frameworks/GStreamer.framework/Versions/1.0/lib/GStreamer (offset 24)
time stamp 1615860870 Tue Mar 16 07:44:30 2021
current version 0.0.0
compatibility version 0.0.0
Load command 3
cmd LC_DYLD_INFO_ONLY
cmdsize 48
rebase_off 0
rebase_size 0
bind_off 0
bind_size 0
weak_bind_off 0
weak_bind_size 0
lazy_bind_off 0
lazy_bind_size 0
export_off 0
export_size 0
Load command 4
cmd LC_SYMTAB
cmdsize 24
symoff 49160
nsyms 1
stroff 49176
strsize 24
Load command 5
cmd LC_DYSYMTAB
cmdsize 80
ilocalsym 0
nlocalsym 0
iextdefsym 0
nextdefsym 0
iundefsym 0
nundefsym 1
tocoff 0
ntoc 0
modtaboff 0
nmodtab 0
extrefsymoff 0
nextrefsyms 0
indirectsymoff 0
nindirectsyms 0
extreloff 0
nextrel 0
locreloff 0
nlocrel 0
Load command 6
cmd LC_UUID
cmdsize 24
uuid FF3B9063-C0A8-39BE-9464-69FCF3DFC63B
Load command 7
cmd LC_VERSION_MIN_MACOSX
cmdsize 16
version 10.11
sdk 11.1
Load command 8
cmd LC_SOURCE_VERSION
cmdsize 16
version 0.0
Load command 9
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgstnet-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 10
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgstbadaudio-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 11
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgsttranscoder-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 0.0.0
compatibility version 0.0.0
Load command 12
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgstallocators-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 13
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgstplayer-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 14
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgstinsertbin-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 15
cmd LC_REEXPORT_DYLIB
cmdsize 72
name @rpath/lib/libgstcodecparsers-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 16
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgstvulkan-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 17
cmd LC_REEXPORT_DYLIB
cmdsize 56
name @rpath/lib/libgstgl-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 18
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgstapp-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 19
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgstwebrtc-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 20
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgstcheck-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 21
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgstcontroller-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 22
cmd LC_REEXPORT_DYLIB
cmdsize 72
name @rpath/lib/libgstphotography-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 23
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgstsctp-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 0.0.0
compatibility version 0.0.0
Load command 24
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgstfft-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 25
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgstmpegts-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 26
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgstpbutils-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 27
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgstvideo-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 28
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgstrtsp-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 29
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgstsdp-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 30
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgstrtp-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 31
cmd LC_REEXPORT_DYLIB
cmdsize 56
name @rpath/lib/libgio-2.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 6201.6.0
compatibility version 6201.0.0
Load command 32
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgstriff-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 33
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgstaudio-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 34
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgstbase-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 35
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgsttag-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 36
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgstreamer-1.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1805.0.0
compatibility version 1805.0.0
Load command 37
cmd LC_REEXPORT_DYLIB
cmdsize 64
name @rpath/lib/libgobject-2.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 6201.6.0
compatibility version 6201.0.0
Load command 38
cmd LC_REEXPORT_DYLIB
cmdsize 56
name @rpath/lib/libglib-2.0.0.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 6201.6.0
compatibility version 6201.0.0
Load command 39
cmd LC_REEXPORT_DYLIB
cmdsize 56
name @rpath/lib/libintl.8.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 10.5.0
compatibility version 10.0.0
Load command 40
cmd LC_LOAD_DYLIB
cmdsize 56
name /usr/lib/libSystem.B.dylib (offset 24)
time stamp 2 Thu Jan 1 05:30:02 1970
current version 1292.60.1
compatibility version 1.0.0
Load command 41
cmd LC_FUNCTION_STARTS
cmdsize 16
dataoff 49152
datasize 8
Load command 42
cmd LC_DATA_IN_CODE
cmdsize 16
dataoff 49160
datasize 0
Load command 43
cmd LC_RPATH
cmdsize 16
path . (offset 12)
Load command 44
cmd LC_RPATH
cmdsize 32
path @loader_path/.. (offset 12)
Load command 45
cmd LC_RPATH
cmdsize 32
path @executable_path/.. (offset 12)
Load command 46
cmd LC_RPATH
cmdsize 32
path @loader_path/../lib (offset 12)
Load command 47
cmd LC_RPATH
cmdsize 40
path @executable_path/../lib (offset 12)
Maybe it's fixed by !680 (closed) ?