Hi. I’ve got an issue upon deployment of simple SDL-based app on real iOS device.
I’m using cmake to generate xcode project. In XCode project I’m building and running app, but I’m getting crash right after its launch.
Here is how my cmake file looks like:
cmake_minimum_required(VERSION 3.10)
set(PROJECT_NAME SDL_RND)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_CXX_FLAGS "-std=c++14 ${CMAKE_CXX_FLAGS}")
set(MACOSX_BUNDLE_GUI_IDENTIFIER "myapp.sdl.rnd")
set(MACOSX_BUNDLE_BUNDLE_VERSION "0.0.1")
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "0.0.1")
macro (set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE)
set_property (TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_${XCODE_PROPERTY} ${XCODE_VALUE})
endmacro (set_xcode_property)
project(${PROJECT_NAME} VERSION 0.0.1)
file(GLOB_RECURSE SOURCES "${PROJECT_SOURCE_DIR}/package/src/*.cpp")
add_subdirectory(extern/SDL)
add_executable(${PROJECT_NAME} ${SOURCES})
set_target_properties(
${PROJECT_NAME} PROPERTIES
CXX_STANDART 14
CXX_STANDART_REQUIRED ON
)
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/package/include/)
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/extern/)
target_link_libraries(${PROJECT_NAME} SDL2 SDL2main)
set_xcode_property(${PROJECT_NAME} CODE_SIGN_IDENTITY "*****")
set_xcode_property(${PROJECT_NAME} DEVELOPMENT_TEAM "*****")
set_xcode_property(SDL2 CODE_SIGN_IDENTITY "*****")
set_xcode_property(SDL2 DEVELOPMENT_TEAM "*****")
~/extern folder contains only sdl folder with 2.0.18 sdl contents, ~/package folder contains only my cpp and hpp files.
Generation command:
cmake -G Xcode .. -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES="arm64"
After this I build for connected iphone 10 (iOS 15.2.1) with SDL_RND specified as a target. After resolving of untrusted author issue I’m trying to run app but gettings this crash:
ReportCrash ASI found [dyld] (sensitive) 'Library not loaded: @rpath/libSDL2-2.0d.dylib\
Referenced from: /private/var/containers/Bundle/Application/3CDEA049-C9C0-4427-A3E3-334827725541/SDL_RND.app/SDL_RND\
Reason: tried: '/usr/lib/system/introspection/libSDL2-2.0d.dylib' (no such file), '/Users/*****/Desktop/CMakeSDL/build/Debug/libSDL2-2.0d.dylib' (no such file), '/Users/*****/Desktop/CMakeSDL/build/Debug/libSDL2-2.0d.dylib' (no such file), '/usr/local/lib/libSDL2-2.0d.dylib' (no such file), '/usr/lib/libSDL2-2.0d.dylib' (no such file)'\
Actually I have libSDL2-2.0d.dylib next to SDL_RND.app in Debug folder, but seems like it was not copied to my device. Strange, but I’m not having same issue on iphonesimulator and everything works great there. Log with the part of logcat with crash info:
ios_crash_logcat.rtf (132.7 KB)
macOS Monterey 12.1, XCode 13.2.1
Will be very appreciated for any advices. Thanks.