tidev / titanium-sdk

🚀 Native iOS and Android Apps with JavaScript
https://titaniumsdk.com/
Other
2.76k stars 1.21k forks source link

iOS: build error due to swift version conflict #14140

Open m1ga opened 4 weeks ago

m1ga commented 4 weeks ago

I have searched and made sure there are no existing issues for the issue I am filing

Description

I've simply created a new empty iOS module and tried to build it. When looking at the trace log I can see:

error: failed to build module 'TitaniumKit'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100)', while this compiler is 'Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)'). Please select a toolchain which matches the SDK.

Other users had similar issues when building iOS modules too. Is there a way to get rid of it without searching a matching Xcode version?

https://stackoverflow.com/questions/58654714/module-compiled-with-swift-5-1-cannot-be-imported-by-the-swift-5-1-2-compiler/58656323#58656323 might be a solution (if not already done)

Expected Behavior

build a module without Xcode/swift error

Actual behavior

error building

Reproducible sample

-

Steps to reproduce

Platform

iOS

SDK version you are using

12.5.0

Alloy version you are using

No response

m1ga commented 3 weeks ago

Ti 12.5.1 with Xcode 16.0 (16A242d) breaks build with

[TRACE] [xcode-dist] <module-includes>:1:9: note: in file included from <module-includes>:1:
[TRACE] [xcode-dist] #import "Headers/TitaniumKit.h"
[TRACE] [xcode-dist]         ^
[TRACE] [xcode-dist] /Users/miga/Library/Application Support/Titanium/mobilesdk/osx/12.5.1.GA/iphone/Frameworks/TitaniumKit.xcframework/ios-arm64/TitaniumKit.framework/Headers/TitaniumKit.h:17:9: error: 'TitaniumKit/TiBase.h' file not found
[TRACE] [xcode-dist] #import <TitaniumKit/TiBase.h>
[TRACE] [xcode-dist]         ^
[TRACE] [xcode-dist] /Users/miga/Library/Application Support/Titanium/mobilesdk/osx/12.5.1.GA/iphone/Frameworks/TitaniumKit.xcframework/ios-arm64/TitaniumKit.framework/Headers/TitaniumKit.h:17:9: note: did not find header 'TiBase.h' in framework 'TitaniumKit' (loaded from '/Users/miga/Library/Developer/Xcode/DerivedData/test_swift-eeqxqbbwfhibfhgudinbgmtmrojt/Build/Intermediates.noindex/ArchiveIntermediates/ComTestSwift/BuildProductsPath/Release-maccatalyst')
[TRACE] [xcode-dist] #import <TitaniumKit/TiBase.h>
[TRACE] [xcode-dist]         ^
[TRACE] [xcode-dist] /Users/miga/test_swift/ios/Classes/ComTestSwiftExampleProxy.swift:10:8: error: could not build Objective-C module 'TitaniumKit'
[TRACE] [xcode-dist] import TitaniumKit
[TRACE] [xcode-dist]        ^
[TRACE] [xcode-dist] SwiftCompile normal x86_64 Compiling\ ComTestSwiftExampleProxy.swift,\ ComTestSwiftModule.swift /Users/miga/test_swift/ios/Classes/ComTestSwiftExampleProxy.swift /Users/miga/test_swift/ios/Classes/ComTestSwiftModule.swift (in target 'ComTestSwift' from project 'test_swift')
AbdullahFaqeir commented 5 days ago

@m1ga I've already faced this and fixed it, give me this.