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

[bug] compile the Plugin using sysroot for 'iPhoneOS' but targeting 'MacOSX' #10717

Closed
rdlabo opened this issue Aug 21, 2024 · 4 comments · Fixed by #10718
Closed

[bug] compile the Plugin using sysroot for 'iPhoneOS' but targeting 'MacOSX' #10717

rdlabo opened this issue Aug 21, 2024 · 4 comments · Fixed by #10718
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@rdlabo
Copy link
Contributor

rdlabo commented Aug 21, 2024

Describe the bug

swift-rs run with producing the wrong target:
Brendonovich/swift-rs#49

When compiling Objective-C, certain code (such as requestLocation and kCLAuthorizationStatusAuthorizedWhenInUse for location information not supported by MacOS) will stop the build with an error.


Note: This can be corrected by adding the following to Cargo.toml. This is a patch created by guillemcordoba.

[patch.crates-io]
swift-rs = { git = "https://github.com/guillemcordoba/swift-rs", branch = "main" }

Reproduction

I had this happen when I loaded Stripe with the plugin SPM.

// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "tauri-plugin-stripe-payment",
    platforms: [
        .iOS(.v13),
    ],
    products: [
        // Products define the executables and libraries a package produces, and make them visible to other packages.
        .library(
            name: "tauri-plugin-stripe-payment",
            type: .static,
            targets: ["tauri-plugin-stripe-payment"]),
    ],
    dependencies: [
        .package(name: "Tauri", path: "../.tauri/tauri-api"),
        .package(url: "https://github.com/stripe/stripe-ios-spm", .upToNextMajor(from: "23.0.0"))
    ],
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages this package depends on.
        .target(
            name: "tauri-plugin-stripe-payment",
            dependencies: [
                .byName(name: "Tauri"),
                .product(name: "StripePaymentSheet", package: "stripe-ios-spm"),
                .product(name: "StripeApplePay", package: "stripe-ios-spm"),
            ],
            path: "Plugin")
    ]
)

Expected behavior

No response

Full tauri info output

[✔] Environment
    - OS: Mac OS 14.4.1 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.80.1 (3f5fd8dd4 2024-08-06)
    ✔ cargo: 1.80.1 (376290515 2024-07-16)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 22.6.0
    - pnpm: 8.9.0
    - yarn: 1.17.3
    - npm: 10.8.2

[-] Packages
    - tauri [RUST]: 2.0.0-rc.3
    - tauri-build [RUST]: 2.0.0-rc.3
    - wry [RUST]: 0.42.0
    - tao [RUST]: 0.29.0
    - tauri-cli [RUST]: 2.0.0-alpha.7
    - @tauri-apps/api [NPM]: 2.0.0-rc.1
    - @tauri-apps/cli [NPM]: 2.0.0-rc.3

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - bundler: Rollup

[-] iOS
    - Developer Teams: ****************


### Stack trace

_No response_

### Additional context

_No response_
@rdlabo rdlabo added status: needs triage This issue needs to triage, applied to new issues type: bug labels Aug 21, 2024
@lucasfernog
Copy link
Member

interesting.. I think I couldn't fix this issue so I added #9843 instead.. if this fixes the issue I also found, that would be amazing

@rdlabo
Copy link
Contributor Author

rdlabo commented Aug 23, 2024

Thank you. I tried a couple of packages and the compilation worked fine. However, on iOS, I cannot access the Resource and the process itself does not work (e.g. image assets).

@lucasfernog I don't understand xcodebuild well, but does access to resources seem to work here? I would be glad to get some tips.

@lucasfernog
Copy link
Member

can you share an example to reproduce the issue?

@rdlabo
Copy link
Contributor Author

rdlabo commented Aug 23, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants