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

[MacOS] Pod install error saying a package requires higher minimum deployment target (but the app is already set) #120

Closed
yasinarik opened this issue Nov 30, 2021 · 7 comments

Comments

@yasinarik
Copy link

Hi @knopp!

First of all, I want to thank you for developing all of this. This is a huge achievement to be honest.

Problem

I am getting an error after cargo run command. It complains that I have to use an higher minimum deployment target bu I already set that.

What Have I Done?:

  • I am using a MacBook Pro (intel cpu), and the current MacOS version is: 10.15.5
  • I have successfully installed Rust, and run NativeShell Example from the repo. I tried every feature and it worked flawlessly.
  • I have copied .cargo, resources, src, build.rs, Cargo.toml, from App Template repo to my existing Flutter project folder.
  • The project is set to 10.15 on XCode application.
  • Also I make sure that it is MACOSX_DEPLOYMENT_TARGET = 10.15 by manually checking this file at: macos/Flutter/ephemeral/.symlinks/plugins/flutter_web_auth/example/macos/Runner.xcodeproj/project.pbxproj
  • I added the package nativeshell: ^0.1.10 into pubspec.yaml
  • By the way, I should say that I am using FVM (Flutter Version Manager). So I also refreshed the packages by fvm flutter pub get
  • I installed the pods by doing cd macos --> pod install
  • I have added a launch.json file in .vscode folder in order to use that Flutter: Attach to Process process.
  • Finally I ran cargo run and it generated lots of files into ./target folder. Then it gave this error below.

One of the packages I use depends on this package flutter_web_auth: ^0.3.1. Without using NativeShell, I can normally debug and release this app, like half an hour ago.

Error Log:

** Build failed with error **

  External Tool Failed!
  Status: ExitStatus(ExitStatus(256))
  Command: "pod" "install"
  Stderr:

  Stdout:
  Analyzing dependencies
  [!] CocoaPods could not find compatible versions for pod "flutter_web_auth":
    In Podfile:
      flutter_web_auth (from `/PATH_TO_APP/target/debug/build/app_template-c9e9887c415ba219/out/xcode/symlinks/flutter_web_auth/macos`)

  Specs satisfying the `flutter_web_auth (from `/PATH_TO_APP/target/debug/build/app_template-c9e9887c415ba219/out/xcode/symlinks/flutter_web_auth/macos`)` dependency were found, but they required a higher minimum deployment target.


  --- stderr
  thread 'main' panicked at 'explicit panic', build.rs:29:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@knopp
Copy link
Contributor

knopp commented Nov 30, 2021

Can you try setting MACOSX_DEPLOYMENT_TARGET as environment variable before running cargo run?

@yasinarik
Copy link
Author

Can you try setting MACOSX_DEPLOYMENT_TARGET as environment variable before running cargo run?

Surely, where can I find it? I just couldn't see. Thanks for replying this quick!

@knopp
Copy link
Contributor

knopp commented Nov 30, 2021

I mean just do

MACOSX_DEPLOYMENT_TARGET=10.15 cargo run

@knopp
Copy link
Contributor

knopp commented Nov 30, 2021

Btw. nativeshell flutter build is completely separate from "regular" flutter build. It doesn't do any with the files inside macos folder. The deployment target during build is taken from environment variable MACOSX_DEPLOYMENT_TARGET and it should be passed to the xcode build that builds pods.

@yasinarik
Copy link
Author

yasinarik commented Nov 30, 2021

I mean just do

MACOSX_DEPLOYMENT_TARGET=10.15 cargo run

After running it like this, it worked 🚀! Thanks a lot. Is there a way to make it permanent? Like storing that env variable? Because I think I have checked every possible place I find written MACOSX_DEPLOYMENT_TARGET yet it didn't work until a did your suggestion.


Btw. nativeshell flutter build is completely separate from "regular" flutter build.

Actually, I learnt that by reading other issues, etc. but I just wanted to test it anyways.

@knopp
Copy link
Contributor

knopp commented Nov 30, 2021

I think you should be able to call std::env::set_var("MACOSX_DEPLOYMENT_TARGET", "10.15") in build.rs before calling build_flutter().

@yasinarik
Copy link
Author

yasinarik commented Nov 30, 2021

I think you should be able to call std::env::set_var("MACOSX_DEPLOYMENT_TARGET", "10.15") in build.rs before calling build_flutter().

Yes, that also worked. Thanks a lot for spending your time! Just for a future reference, for any other reader, I am adding the code block below:
Changes made in this file: build.rs (See the line with comment *****--->)

fn build_flutter() -> BuildResult<()> {
    Flutter::build(FlutterOptions {
        // macos_extra_pods: &[
        //     "pod 'flutter_web_auth'",
        // ],
        ..Default::default()
    })?;

    if cfg!(target_os = "macos") {
        let options = AppBundleOptions {
            bundle_name: "Superlist.app".into(),
            bundle_display_name: "Superlist".into(),
            icon_file: "icons/AppIcon.icns".into(),
            ..Default::default()
        };
        let resources = MacOSBundle::build(options)?;
        resources.mkdir("icons")?;
        resources.link("resources/mac_icon.icns", "icons/AppIcon.icns")?;
    }

    Ok(())
}

fn main() {
    std::env::set_var("MACOSX_DEPLOYMENT_TARGET", "10.15"); // *****---> HERE GOES THE ENV
    if let Err(error) = build_flutter() {
        println!("\n** Build failed with error **\n\n{}", error);
        panic!();
    }
}

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

2 participants