Am trying to learn SDL2
using Xcode Version 13.3.1
on macOS Monterey 12.3.1
Followed these steps:
-
Downloaded/ran the
dmg
file and moved the extractedSDL2.framework
top-level folder into/Library/Frameworks
-
Inside Xcode, made
Command line
project, specifying C++ as the language. -
Inside Xcode’s General tab, I added
SDL2.framework
underFrameworks and Libraries
and chose forEmbed
asDo Not Embed
-
Inside Xcode’s Build Settings, under
Search Paths / Framework Search Paths
– I added the appropriate${inherited}
and${PROJECT_DIR}
(both set tonon-recursive
).
Now, when I try to build
the project (even if I copy some introductory code, which is, for a small window rendering via an online tutorial), I get the following error:
dyld`__abort_with_payload:
0x10005a0d4 <+0>: movl $0x2000209, %eax ; imm = 0x2000209
0x10005a0d9 <+5>: movq %rcx, %r10
0x10005a0dc <+8>: syscall
-> 0x10005a0de <+10>: jae 0x10005a0e8 ; <+20>
0x10005a0e0 <+12>: movq %rax, %rdi
0x10005a0e3 <+15>: jmp 0x100017150 ; cerror_nocancel
0x10005a0e8 <+20>: retq
0x10005a0e9 <+21>: nop
0x10005a0ea <+22>: nop
0x10005a0eb <+23>: nop
dyld[22494]: Library not loaded: @rpath/SDL2.framework/Versions/A/SDL2
Referenced from: /Users/pnwlover/Library/Developer/Xcode/DerivedData/hello_sdl-buacbgrhmffapiexkmaxsewyxqvl/Build/Products/Debug/hello_sdl
Reason: tried: '/Users/pnwlover/Library/Developer/Xcode/DerivedData/hello_sdl-buacbgrhmffapiexkmaxsewyxqvl/Build/Products/Debug/SDL2.framework/Versions/A/SDL2' (no such file), '/Library/Frameworks/SDL2.framework/Versions/A/SDL2' (code signature in <AEE63968-5A4B-3298-93A8-8AB781F92E22> '/Library/Frameworks/SDL2.framework/Versions/A/SDL2' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs), '/System/Library/Frameworks/SDL2.framework/Versions/A/SDL2' (no such file)
(lldb)
What am I possibly doing wrong?
2
Answers
Check steps:
Make sure the
SDL2.framework
is correctly imported into the project.From the log information you provided,the
@rpath/SDL2.framework/Versions/A/SDL2
runtime path may be incorrect.Inside Xcode`s Build Settings, find the
Runpath Search Paths
option, add the real path ofSDL2
, or useinstall_name_tool
to modify/add the path ofSDL2.framework
.For me it worked by making sure I embed and sign the SDL framework.