Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOS: Compilation of SDL and satellite libraries #5665

Closed
1bsyl opened this issue May 16, 2022 · 5 comments
Closed

IOS: Compilation of SDL and satellite libraries #5665

1bsyl opened this issue May 16, 2022 · 5 comments

Comments

@1bsyl
Copy link
Contributor

1bsyl commented May 16, 2022

I have this very simple script:
ios_build_libs.sh.txt

That helps me to re-build all SDL, SDL_image, SDL_mixer and SDL_ttf libraries in release, debug,device,simulator. for iOS or tvOS. In one command.
Now, it fails with mysterious messages. see below. (it may not be relevant).

I see that the "scheme" a now more homogeneous. For SDL the are "Static Library-iOS" or "-TV". But no differentiation for other libraries. Is this ok ?
Same thing for "framework" scheme: there is a "Framework-iOS" scheme for SDL. And only "Framework"for other libs.

I wonder which scheme should be used to build for ios. Thanks.

It seems this script should be legitimate to run correctly since it only triggers the Xcode build. with some parameter. Any help is appreciated :)

/Users/s/Library/Developer/Xcode/DerivedData/SDL-dgdwwfogariedibsiqbkveftrenw/Build/Intermediates.noindex/SDL.build/Debug-iphonesimulator/Framework-iOS.build/Objects-normal/i386/SDL_surface.dia:1:1: warning: Could not read serialized diagnostics file: error("Failed to open diagnostics file") (in target 'Framework-iOS' from project 'SDL')

,,,

note: Building targets in dependency order
warning: Traditional headermap style is no longer supported; please migrate to using separate headermaps and set 'ALWAYS_SEARCH_USER_PATHS' to NO. (in target 'Framework' from project 'SDL_ttf')
/Users/s/release/Release_SDL_IOS/SDL_ttf/Xcode/SDL_ttf.xcodeproj: error: Building for iOS, but the linked framework 'SDL2.framework' was built for macOS. (in target 'Framework' from project 'SDL_ttf')
** BUILD FAILED **

@kambala-decapitator
Copy link
Contributor

it's difficult to say what's causing the error without seeing full compile output.

haven't seen any issues when building static library target, you can check my script here: https://github.com/kambala-decapitator/vcmi-ios-depends/blob/main/build_depends.sh#L171

@slouken
Copy link
Collaborator

slouken commented Aug 3, 2022

You might just need to clean before running this script?

@gbgames
Copy link
Contributor

gbgames commented Sep 2, 2022

@kambala-decapitator Have you tried your script with SDL2_image v2.6.2? Your script references v2.0.5. I believe v2.0.5 still uses Xcode-iOS which does not exist anymore in the latest versions.

My own similar xcodebuild command fails when building the simulator version with

error: ApplicationServices is not available when building for iOS Simulator. (in target 'Static Library' from project 'SDL_image')

And when building for an iOS device:

error: ApplicationServices is not available when building for iOS. (in target 'Static Library' from project 'SDL_image')

It's not the same error as @1bsyl, but it seems related in that SDL_image seems to want to build the iOS project as a Mac project, unless we are building it wrong? ApplicationServices is for MacOS, not for iOS.

My original xcodebuild command:

xcodebuild -scheme "Static Library" -configuration Release -sdk iphoneos SKIP_INSTALL=NO BUILD_DIR=build/SDL2_image-iphoneos

And I tried this change based partly on @kambala-decapitator's script:

xcodebuild -target "Static Library" -configuration Release -sdk iphonesimulator ENABLE_BITCODE=NO IPHONEOS_DEPLOYMENT_TARGET=10.0 PLATFORM=iOS BUILD_DIR=build/SDL2_image-iphonesimulator

And when I check what schemes/targets are available, there isn't anything iOS-specific, so I don't know how else to build it as an iOS project unless I specify the SDK, which doesn't seem to impact how the library's Xcode project knows what to depend upon.

xcodebuild -version

Xcode 12.4
Build version 12D4e

xcodebuild -list shows:

Targets:
        Framework
        Static Library
        Create DMG

Schemes:
        avif
        Create DMG
        dav1d
        dav1d-16bit
        dav1d-8bit
        Framework
        jxl
        Static Library
        webp

@kambala-decapitator
Copy link
Contributor

@gbgames if I recall correctly, Xcode project has been changed to multi-platform support, but unfortunately it requires Xcode 13 (you use 12.4 as I see)

you can also build with CMake and https://github.com/leetal/ios-cmake

@1bsyl
Copy link
Contributor Author

1bsyl commented Sep 3, 2022

I fixed my script:
ios_build_libs.sh.txt

It seems I have to "force" the PLATFORM variable so that the HEADER_SEARCH_PATHS is correct.
eg: adding 'PLATFORM=iOS' to the xcodebuild command line.

@1bsyl 1bsyl closed this as completed Sep 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants