tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
80.14k stars 2.38k forks source link

[bug] Getting 'The program can't start because `api-ms-win-crt-math-l1-1-0.dll` is missing from your computer' error #6800

Open ryg-git opened 1 year ago

ryg-git commented 1 year ago

Describe the bug

I am trying to install my tauri build on Windows 8.1 Pro VM which doesn't have internet connection and also doesn't have webview2 preinstalled. winver

As the VM doesn't have the internet connection I tried to build with offlineInstaller Install Mode

"windows": {
        "certificateThumbprint": null,
        "digestAlgorithm": "sha256",
        "timestampUrl": "",
        "webviewInstallMode": {
          "type": "offlineInstaller"
        }
}

but when I install the software I am getting this error dll-error

Also I tried with the fixedRuntime mode but I am getting the same issue.

"windows": {
        "certificateThumbprint": null,
        "digestAlgorithm": "sha256",
        "timestampUrl": "",
        "webviewInstallMode": {
          "type": "fixedRuntime",
          "path": "./Microsoft.WebView2.FixedVersionRuntime.111.0.1661.62.x64/"
        }
}

Reproduction

  1. Build windows build using fixedRuntime install mode or offlineInstaller mode.
  2. Install it on older version of windows 8.1 which doesn't have webview2 preinstalled.
  3. You will get the system error when you try to launch the software

Expected behavior

The windows build should run on older version of windows 8.1 too.

Platform and versions

> tauri "info"

Environment
  › OS: Windows 10.0.22621 X64
  › Webview2: 112.0.1722.58
  › MSVC: 
      - Visual Studio Community 2022
  › Node.js: 16.14.0
  › npm: 8.3.1
  › pnpm: Not installed!
  › yarn: 1.22.19
  › rustup: 1.25.2
  › rustc: 1.69.0
  › cargo: 1.69.0
  › Rust toolchain: stable-x86_64-pc-windows-msvc 

Packages
  › @tauri-apps/cli [NPM]: 1.2.3
  › @tauri-apps/api [NPM]: Not installed!
  › tauri [RUST]: 1.2.4,
  › tauri-build [RUST]: 1.2.1,
  › tao [RUST]: 0.15.8,
  › wry [RUST]: 0.23.4,

App
  › build-type: bundle
  › CSP: unset
  › distDir: ../dist
  › devPath: http://localhost:4200/
  › framework: Angular
  › bundler: Webpack

App directory structure
  ├─ .angular
  ├─ .git
  ├─ .github
  ├─ .vscode
  ├─ app
  ├─ build
  ├─ dist
  ├─ e2e
  ├─ node_modules
  ├─ release
  ├─ src
  └─ src-tauri


### Stack trace

_No response_

### Additional context

_No response_
FabianLars commented 1 year ago

Could you try version 109 for the fixed runtime approach? You can get it for example here https://github.com/westinyang/WebView2RuntimeArchive/releases/tag/109.0.1518.78 (note that this is unofficial but i didn't find anything official that works).

109 was the last version with support for windows 7 and 8. The online installer will automatically download 109 on these systems but the offline installer only bundles the latest version at the time of its download.

ryg-git commented 1 year ago

I tried the version 109 but I am getting the same error.

I checked the installed softwares in control panel but I didn't see the webview2 installed although the webview2 files are copied in installed folder.

FabianLars commented 1 year ago

The fixed runtime won't be installed and therefore won't show in the control panel.

I didn't find anything particular helpful on the internet either. It was either about updating the system (i'm not talking about upgrading to win10 but pulling the latest updates of win8.1), or manually installing vcredist (https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170#visual-studio-2015-2017-2019-and-2022).

Installing vcredist manually is generally not required for tauri apps so i wonder what's happening here.

WingHEX commented 11 months ago

tauri turn on static_vcruntime default while build will case dynamic link to crt-library will require api-ms-win-crt**.dll

https://github.com/tauri-apps/tauri/pull/4292

https://github.com/tauri-apps/tauri/blob/3303041c92a5b79840fa163a58c8102f5d6eb834/core/tauri-build/src/static_vcruntime.rs#LL14C1-L25C57.

my solution: 1、turn off static_vcruntime, add to Cargo.toml

[env]
STATIC_VCRUNTIME=false

2、add crt-static option,add to cargo./config

[target.'cfg(all(windows, target_env="msvc"))']
rustflags = [
    "-C", "target-feature=+crt-static"
]
lightbluestar commented 8 months ago

Download the api-ms-win-crt-math-l1-1-0.dll and Copy/Paste it into the Application folder (Sometimes Programs only use DLL files from within their Directories); https://www.sts-tutorial.com/download/api-ms-win-crt-math-l1-1-0