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 app not built for older macOS versions #2732

Closed
probablykasper opened this issue Oct 11, 2021 · 11 comments
Closed

macOS app not built for older macOS versions #2732

probablykasper opened this issue Oct 11, 2021 · 11 comments

Comments

@probablykasper
Copy link
Member

Describe the bug

Building on a macos-latest GitHub action results in the app not working on macOS 10.15 Catalina, even with "minimumSystemVersion": "10":

You have macOS 10.15.7. The application requires macOS 11.0 or later.

Possibly related:

To Reproduce

This is the action I've used to build: https://github.com/probablykasper/mr-tagger/blob/444d69728071b7b1d55b3368fac759ef002f50b6/.github/workflows/publish.yml

Platform and Versions:

Details
Operating System - Mac OS, version 10.15.7 X64

Node.js environment
  Node.js - 14.16.0
  @tauri-apps/cli - 1.0.0-beta.10
  @tauri-apps/api - 1.0.0-beta.8

Global packages
  npm - 6.14.11
  yarn - 1.22.10

Rust environment
  rustc - 1.54.0
  cargo - 1.54.0

App directory structure
/node_modules
/src-tauri
/build
/.git
/src

App
  tauri.rs - 1.0.0-beta.8
  build-type - bundle
  CSP - default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'
  distDir - ../build
  devPath - http://localhost:5000
  framework - Svelte
@nothingismagick
Copy link
Sponsor Member

Someone once reported this:

It's not enough to set the minimumSystemVersion variable in the tauri.conf.json file. You have to create a cargo variable in the build.rs script. You can do it to simply add this line to the main function.

println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET=10.15");

It feels like there should be a more elegant way to do this though.

@probablykasper
Copy link
Member Author

Tried it for this one with MACOSX_DEPLOYMENT_TARGET=10.9 , and it does work on 10.15!

Maybe Tauri should set MACOSX_DEPLOYMENT_TARGET in build.rs by default?

On 10.9, it just closes immediately without any error message. Running MinVerTest.app/Contents/MacOS/MinVerTest gives this output:

thread 'main' panicked at 'Class with name WKWebViewConfiguration could not be found', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/wry-0.12.2/src/webview/wkwebview/mod.rs:199:34
note: run with 'RUST_BACKTRACE=1' environment variable to display a backtrace

Found out WKWebView is available in 10.10+, so that makes sense, but maybe there could be an error message somehow? And if Tauri only works macOS 10.10+ (?), then that should probably be documented.

@lucasfernog
Copy link
Member

If it only works on 10.10+ we should automatically set the flag. Do you guys agree @nothingismagick @wusyong @lemarier

@nothingismagick
Copy link
Sponsor Member

We should see if this has any side effects before just setting the flag.

@probablykasper
Copy link
Member Author

Tried running on 10.10:

2021-10-12 21:27:10.256 MinVerTest[490:7817] -[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:]: unrecognized selector sent to instance 0x7fc273452bf0 fatal runtime error: Rust cannot catch foreign exceptions Abort trap: 6

Assuming the issue is that setURLSchemeHandler is available for 10.13+ (URL scheme handling seems to still be possible before 10.13, but not using that method). This app doesn't register any URL schemes at all though.

@probablykasper
Copy link
Member Author

Seems to run fine on 10.13

@yakuv0
Copy link

yakuv0 commented Oct 22, 2021

out of curiosity since being unable to deploy the webview and display the app yet, does packaging on 10.10.5 has the issue of URL schemes mentioned earlier on this ticket?

@probablykasper
Copy link
Member Author

@yakuv0 The issue is Tauri is using a macOS API that's only available for 10.13+, so I'm guessing it would either fail to build or just cause the same issue to happen

@yakuv0
Copy link

yakuv0 commented Oct 25, 2021

@probablykasper it created an app and dmg , app launch on (mac osx mojave 10.14.6) and crashes on run (mac osx yosemite 10.10.5):

 Compiling app v0.1.0 (/path/to/project/src-tauri)
 Finished dev [unoptimized + debuginfo] target(s) in 3.44s
  Running `target/debug/app`
2021-10-25 14:53:39.594 app[2272:73970] -[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:]: unrecognized selector sent to instance 0x7fdaa3e49be0
fatal runtime error: Rust cannot catch foreign exceptions

build still get error on bundling project as i found a dmg file in /path/to/project/src-tauri/target/release/bundle/macos/rw.project_0.1.0_x64.dmg


build error: 
   Compiling tauri v1.0.0-beta.8
    Finished release [optimized] target(s) in 1m 34s
    Bundling project.app
    Bundling "/path/to/project/src-tauri/target/release/bundle/dmg/project_0.1.0_x64.dmg"
info: running bundle_dmg.sh
Error: failed to bundle project

Caused by:
    Shell Scripting Error:`error running bundle_dmg.sh, try running with --verbose to see command output`

 app:spawn Command "/path/to/project/node_modules/@tauri-apps/cli/bin/tauri-cli" failed with exit code: 1 +0ms

@probablykasper
Copy link
Member Author

@yakuv0 Yep, so the same issue. btw, putting your logs in code blocks would be nice

@probablykasper
Copy link
Member Author

probablykasper commented Nov 27, 2021

In case anyone stumbles upon this, Tauri should work on 10.13+ if you have a build.rs file like this:

fn main() {
  println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET=10.13");
  tauri_build::build();
}

I also have the tauri.bundle.macOS.minimumSystemVersion property in tauri.conf.json set to "10.13".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants