readdle / swift-android-toolchain

MIT License
435 stars 32 forks source link

compile error #64

Closed ximlu closed 3 months ago

ximlu commented 3 months ago

I created an empty project and introduced this library https://github.com/apple/swift-collections.git Causing errors when compiling to Android, I'm not sure where the problem is

/Applications/Scade.app/Contents/PlugIns/ScadeSDK.plugin/Contents/Resources/Libraries/scd/bin/scd "scade-build" "--scade-sdk" "/Applications/Scade.app/Contents/PlugIns/ScadeSDK.plugin/Contents/Resources/Libraries/ScadeSDK" "--android-sdk" "/Users/fangliao/Library/Android/sdk" "--path" "/Users/fangliao/Desktop/SwiftAndroidSample" "--output" "./Product" "--configuration" "Debug" "--platform" "android-x86_64" Build: SwiftAndroidSample - android-x86_64 Configure: SwiftAndroidSample - android-x86_64 -- Android: Targeting API '24' with architecture 'x86_64', ABI 'x86_64', and processor 'x86_64' -- Android: Selected unified Clang toolchain -- The C compiler identification is Clang 14.0.6 -- The CXX compiler identification is Clang 14.0.6 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /Users/fangliao/Library/Android/sdk/ndk/25.0.8775105/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /Users/fangliao/Library/Android/sdk/ndk/25.0.8775105/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found swift compiler: /Users/fangliao/Library/Developer/Scade/Toolchains/swift-android-compiler/5.10.1/usr/bin/swiftc -- Swift target triple: x86_64-none-linux-android24 -- Using user defined number of parallel jobs: 24 -- Performing Test LINKER_SUPPORTS_NO_START_STOP_GC -- Performing Test LINKER_SUPPORTS_NO_START_STOP_GC - Success -- Found swift compiler: /Users/fangliao/Library/Developer/Scade/Toolchains/swift-android-compiler/5.10.1/usr/bin/swiftc -- Swift target triple: x86_64-none-linux-android24 -- Java sources: -- Swift parallel jobs: 24 -- Using JAVA_HOME for gradle: /Applications/Android Studio.app/Contents/jbr/Contents/Home -- Configuring done -- Generating done -- Build files have been written to: /Users/fangliao/Desktop/SwiftAndroidSample/.build/android-x86_64 [ 1%] Generating SwiftAndroidSample-app-android/assets/assets_list.txt [ 1%] Built target SwiftAndroidSample-app-write-scripts-list warning: 'swiftandroidsample': found 1 file(s) which are unhandled; explicitly declare them as resources or exclude from the target /Users/fangliao/Desktop/SwiftAndroidSample/Sources/SwiftAndroidSample/main.page.svg Building for debugging... [1/28] Compiling InternalCollectionsUtilities _SortedCollection.swift [2/28] Compiling InternalCollectionsUtilities _UniqueCollection.swift [3/28] Compiling InternalCollectionsUtilities Debugging.swift [4/28] Compiling InternalCollectionsUtilities Specialize.swift [5/28] Compiling InternalCollectionsUtilities RandomAccessCollection+Offsets.swift [6/28] Compiling InternalCollectionsUtilities UnsafeBufferPointer+Extras.swift [7/28] Compiling InternalCollectionsUtilities UnsafeMutableBufferPointer+Extras.swift /Users/fangliao/Desktop/SwiftAndroidSample/.build/checkouts/swift-collections/Sources/InternalCollectionsUtilities/autogenerated/UnsafeMutableBufferPointer+Extras.swift:242:18: error: no exact matches in call to instance method 'initialize' let i = self.initialize(fromContentsOf: source) ^ /Users/fangliao/Desktop/SwiftAndroidSample/.build/checkouts/swift-collections/Sources/InternalCollectionsUtilities/autogenerated/UnsafeMutableBufferPointer+Extras.swift:181:15: note: candidate expects value of type 'UnsafeMutableBufferPointer<C.Element>' for parameter #1 (got 'C') public func initialize( ^ /Users/fangliao/Desktop/SwiftAndroidSample/.build/checkouts/swift-collections/Sources/InternalCollectionsUtilities/autogenerated/UnsafeMutableBufferPointer+Extras.swift:192:15: note: candidate expects value of type 'Slice<UnsafeMutableBufferPointer<C.Element>>' for parameter #1 (got 'C') public func initialize( ^ [8/28] Compiling InternalCollectionsUtilities Descriptions.swift [9/28] Compiling InternalCollectionsUtilities UnsafeMutableBufferPointer+SE-0370.swift [10/28] Compiling InternalCollectionsUtilities UnsafeMutablePointer+SE-0370.swift [11/28] Compiling InternalCollectionsUtilities UnsafeRawPointer extensions.swift [12/28] Compiling InternalCollectionsUtilities FixedWidthInteger+roundUpToPowerOfTwo.swift [13/28] Compiling InternalCollectionsUtilities UInt+reversed.swift [14/28] Compiling InternalCollectionsUtilities _UnsafeBitSet+Index.swift [15/28] Compiling InternalCollectionsUtilities Integer rank.swift [16/28] Compiling InternalCollectionsUtilities UInt+first and last set bit.swift [17/28] Compiling InternalCollectionsUtilities _UnsafeBitSet+_Word.swift [18/28] Compiling InternalCollectionsUtilities _UnsafeBitSet.swift make[3]: [CMakeFiles/SwiftAndroidSample-build-spm] Error 1 make[2]: [CMakeFiles/SwiftAndroidSample-build-spm.dir/all] Error 2 make[1]: [CMakeFiles/SwiftAndroidSample-app.dir/rule] Error 2 make: [SwiftAndroidSample-app] Error 2 Error: command '[/Users/fangliao/Desktop/SwiftAndroidSample/.build/android-x86_64] /Applications/Scade.app/Contents/PlugIns/ScadeSDK.plugin/Contents/Resources/Libraries/ScadeSDK/thirdparty/CMake.app/Contents/bin/cmake --build /Users/fangliao/Desktop/SwiftAndroidSample/.build/android-x86_64 --target SwiftAndroidSample-app' failed with exit code 2 ERROR: command '/Applications/Scade.app/Contents/PlugIns/ScadeSDK.plugin/Contents/Resources/Libraries/scd/bin/scd-5.9 scade-build --scade-sdk /Applications/Scade.app/Contents/PlugIns/ScadeSDK.plugin/Contents/Resources/Libraries/ScadeSDK --android-sdk /Users/fangliao/Library/Android/sdk --path /Users/fangliao/Desktop/SwiftAndroidSample --output ./Product --configuration Debug --platform android-x86_64' failed with exit code 1 Process finished with exit code: 1

Here is my configuration

// swift-tools-version:5.8

import PackageDescription import Foundation

let SCADE_SDK = ProcessInfo.processInfo.environment["SCADE_SDK"] ?? ""

let package = Package( name: "SwiftAndroidSample", platforms: [ .macOS(.v10_15), .iOS(.v13) ], products: [ .library( name: "SwiftAndroidSample", type: .dynamic, targets: [ "SwiftAndroidSample" ] ) ], dependencies: [ .package(url: "https://github.com/apple/swift-collections.git", from: "1.1.2"), ], targets: [ .target( name: "SwiftAndroidSample", dependencies: [ .product(name: "Collections", package: "swift-collections"), ], exclude: ["main.page"], swiftSettings: [ .unsafeFlags(["-F", SCADE_SDK], .when(platforms: [.macOS, .iOS])), .unsafeFlags(["-I", "(SCADE_SDK)/include"], .when(platforms: [.android])), ] ) ] )

andriydruk commented 3 months ago

Hello,

It seems like you are using SCADE (https://www.scade.io/). This repository is not associated with that project. For assistance, please reach out to their support team.

Thank you!