libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
9.41k stars 1.75k forks source link

error: Signing for "SDL2" requires a development team. #8205

Open matusfedorko opened 1 year ago

matusfedorko commented 1 year ago

Hi,

I am trying to build SDL 2 for iOS using cmake. First I cloned out the latest commit from the SDL2 branch and then I ran the following to configure build:

cmake -GXcode -S . -B ../sdl2_build/iOS -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64

And the following to build:

xcodebuild -project ../sdl2_build/iOS/SDL2.xcodeproj -target ALL_BUILD

Which produced the following output:

2023-09-05 21:24:24.558 xcodebuild[55313:5725471] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -project ../sdl2_build/iOS/SDL2.xcodeproj -target ALL_BUILD

User defaults from command line:
    IDEPackageSupportUseBuiltinSCM = YES

Computing target dependency graph and provisioning inputs

Create build description
Build description signature: e257e9728438b1f86def11f847cb9b47
Build description path: /Users/matus/programovanie/sdl2_build/iOS/build/XCBuildData/e257e9728438b1f86def11f847cb9b47.xcbuilddata

warning: Building targets in manual order is deprecated - check "Parallelize build for command-line builds" in the project editor, or set DISABLE_MANUAL_TARGET_ORDER_BUILD_WARNING in any of the targets in the current build to suppress this warning
note: Run script build phase 'Generate CMakeFiles/ZERO_CHECK' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'ZERO_CHECK' from project 'SDL2')
note: Run script build phase 'Generate CMakeFiles/sdl_headers_copy' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'sdl_headers_copy' from project 'SDL2')
/Users/matus/programovanie/sdl2_build/iOS/SDL2.xcodeproj: error: Signing for "SDL2" requires a development team. Select a development team in the Signing & Capabilities editor. (in target 'SDL2' from project 'SDL2')
note: Run script build phase 'CMake PostBuild Rules' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'SDL2' from project 'SDL2')
note: Run script build phase 'Generate CMakeFiles/ALL_BUILD' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'ALL_BUILD' from project 'SDL2')
** BUILD FAILED **

Notice the error: error: Signing for "SDL2" requires a development team. Select a development team in the Signing & Capabilities editor. (in target 'SDL2' from project 'SDL2')

What a I doing wrong ?

When I open the project in Xcode and build from Xcode, then the build succeeds. Why is it not working with xcodebuild ?

madebr commented 1 year ago

Does the problem also happen when you build with cmake --build ../sdl2_build/iOS?

This post suggests adding CODE_SIGNING_ALLOWED=NO to the build command.

Try configuring with -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=matusfedorko. docs

matusfedorko commented 1 year ago

Thanks for your reply. Unfortunately cmake --build ../sdl2_build/iOS behaves the same, same error. Using CODE_SIGNING_ALLOWED=NO with xcodebuild worked. Although I still wonder why there is this difference between building through Xcode and building through xcodebuild ? Anyways I ended up with a different solution still, I only build static library. I don't need shared library and the error happens only when building SDL as a shared library.

madebr commented 1 year ago

Does the configuration type matter? Does it also happen with Debug (-DCMAKE_BUILD_TYPE=Debug)?

Have you tried configuring with -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=matusfedork yet?

matusfedorko commented 1 year ago

Sorry for the slow reply. I tried -DCMAKE_BUILD_TYPE=Debug, but that makes no difference as it should. -GXCode is a multiconfig generator, so the it does not matter what is on the command line during configure step. Supplying development team still errored out, but with a different error this time :

error: No signing certificate "iOS Development" found: No "iOS Development" signing certificate matching team ID "matusfedorko" with a private key was found. (in target 'SDL2' from project 'SDL2')

I am sure I used a valid singing certificate and TeamID as I use it on other projects that compile successfully.

madebr commented 1 year ago

I guessed matusfedork for the development team name, perhaps another name fits better?

Does cmake --build ../sdl2_build/ios --config Release and cmake --build ../sdl2_build/ios --config Debug give the same result?

matusfedorko commented 1 year ago

Yes, I understood. Building both release/debug has the same outcome.