Giter VIP home page Giter VIP logo

Comments (6)

arcslash avatar arcslash commented on June 19, 2024 1

You can compile the native swift module to the exact build by running, if you are running on real device,

./gradlew swiftklibNativeModuleIosArm64

If it's simulator

./gradlew swiftklibNativeModeuleIosSimulatorArm64

Task names might be different, check all tasks using

./gradlew :shared:tasks --all 

Might not be a exact fix, but seems like it's not getting compiled in the build - so have to do it separately.

Hope this might help.

from swift-klib-plugin.

markst avatar markst commented on June 19, 2024

Full output:

> Task :composeApp:swiftklibHelloSwiftIosSimulatorArm64 FAILED
error: 'swiftbuild': Invalid manifest (compiled with: ["/Applications/Xcode-14.3.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc", "-vfsoverlay", "/var/folders/p9/3bx5r6fx0_3grq0pp4rzkqnm0000gn/T/TemporaryDirectory.0vVABL/vfs.yaml", "-L", "/Applications/Xcode-14.3.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm/ManifestAPI", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/Applications/Xcode-14.3.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm/ManifestAPI", "-target", "arm64-apple-macosx12.0", "-sdk", "/Applications/Xcode-14.3.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.4.sdk", "-F", "/Applications/Xcode-14.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks", "-I", "/Applications/Xcode-14.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib", "-L", "/Applications/Xcode-14.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib", "-swift-version", "5", "-I", "/Applications/Xcode-14.3.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm/ManifestAPI", "-sdk", "/Applications/Xcode-14.3.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.4.sdk", "-package-description-version", "5.5.0", "{removed}/composeApp/build/swiftklib/HelloSwift/iosSimulatorArm64/swiftBuild/Package.swift", "-Xfrontend", "-disable-implicit-concurrency-module-import", "-Xfrontend", "-disable-implicit-string-processing-module-import", "-o", "/var/folders/p9/3bx5r6fx0_3grq0pp4rzkqnm0000gn/T/TemporaryDirectory.zdr69v/swiftbuild-manifest"])
<unknown>:0: warning: using sysroot for 'iPhoneSimulator' but targeting 'MacOSX'
<unknown>:0: error: unable to load standard library for target 'arm64-apple-macosx12.0'
error: Process 'command 'xcrun'' finished with non-zero exit value 1

from swift-klib-plugin.

markst avatar markst commented on June 19, 2024

Worth mentioning that it is possible to use swift build to build iOS targets.
https://forums.swift.org/t/use-swiftpm-to-build-ios-target/25436/13

For instance I can build my local swift package

mt@mt-imac MyLibrary % xcrun swift build -c release --arch arm64 -Xswiftc -sdk -Xswiftc `xcrun --sdk iphonesimulator --show-sdk-path` -Xswiftc -target -Xswiftc arm64-apple-ios11.0-simulator

Building for production...
Build complete! (0.15s)

Which imports UIKit:

import UIKit

public struct MyLibrary {
    public private(set) var text = "Hello, World!"

    public init() {
    }
}

from swift-klib-plugin.

markst avatar markst commented on June 19, 2024

Here's my Target Configuration:

kotlin {
    listOf(
        iosX64(),
        iosArm64(),
        iosSimulatorArm64()
    ).forEach { iosTarget ->
        iosTarget.compilations {
            val main by getting {
                cinterops {
                    create("HelloSwift")
                }
            }
        }
        iosTarget.binaries.framework {
            baseName = "ComposeApp"
            isStatic = true
        }
    }

from swift-klib-plugin.

markst avatar markst commented on June 19, 2024

seems I can get it to build if I try setting a high number for minMacos

minMacos = 99

and only defining the iosSimulatorArm64:

kotlin {
    listOf(
        iosSimulatorArm64()
    ).forEach { iosTarget ->

which works when syncing gradle.
however it appears to fail again when attempting to build a second time.

from swift-klib-plugin.

realcbnewham avatar realcbnewham commented on June 19, 2024

I get exactly the same problems, although mine is around the other way to your error message:

:0: warning: using sysroot for 'MacOSX' but targeting 'iPhone'

and I get problems such as:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System...

It wants to target MacOS and the suggested fixes (which they really aren't) do not change anything.

@markst did you find a solution?

from swift-klib-plugin.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.