tauri-apps / tauri

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

[bug] `cargo tauri build` fails on windows in WSL filesystem #8504

Closed phi-fell closed 6 months ago

phi-fell commented 6 months ago

Describe the bug

Building a project on windows in the WSL filesystem e.g. "\wsl$\Ubuntu..." or "\wsl.localhost\Ubuntu..." fails with: candle.exe : error CNDL0001 : Invalid URI: The hostname could not be parsed. and light.exe : error LGHT0001 : The system cannot find the path specified. (Exception from HRESULT: 0x80070003) respectively.

Moving the folder onto e.g. the C drive solves the issue.

I'm on Windows 11 home, WSL2, Ubuntu-22.04

Reproduction

(install rust, tauri-cli through cargo, and all prereqs on windows and ubuntu under wsl, install create-tauri-app through cargo on wsl)

Run cargo create-tauri-app in WSL (name: test, lang: rust/cargo, template: vanilla)

change the bundle identifier to test.identifier (or anything else valid other than com.tauri.dev)

(optional) test cargo tauri build, note that it works under WSL

navigate to the folder in windows (powershell), either via \\wsl$\Ubuntu-22.04\ or \\wsl.localhost\Ubuntu-22.04, run cargo tauri build, error occurs

(optional) copy and paste folder onto windows filesystem (e.g. C Drive), run cargo tauri build, error does not occur

Expected behavior

cargo tauri build should succeed.

Full tauri info output

WARNING: no lock files found, defaulting to npm

[✔] Environment
    - OS: Ubuntu 22.04 X64
    ✔ webkit2gtk-4.0: 2.42.3
    ✔ rsvg2: 2.52.5
    ✔ rustc: 1.75.0 (82e1608df 2023-12-21)
    ✔ cargo: 1.75.0 (1d8b05cdd 2023-11-20)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (environment override by RUSTUP_TOOLCHAIN)
    - node: 12.22.9
    - npm: 8.5.1

[-] Packages
    - tauri [RUST]: 1.5.4
    - tauri-build [RUST]: 1.5.1
    - wry [RUST]: 0.24.7
    - tao [RUST]: 0.16.5
    - tauri-cli [RUST]: 1.5.9
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli [NPM]: 1.5.9

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../src
    - devPath: ../src

Stack trace

Debug [globset] built glob set; 0 literals, 2 basenames, 0 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 0 regexes
       Debug [globset] glob converted to regex: Glob { glob: "**/npm-debug.log*", re: "(?-u)^(?:/?|.*/)npm\\-debug\\.log[^/]*$", opts: GlobOptions { case_insensitive: false, literal_separator: true, backslash_escape: true, empty_alternates: false }, tokens: Tokens([RecursivePrefix, Literal('n'), Literal('p'), Literal('m'), Literal('-'), Literal('d'), Literal('e'), Literal('b'), Literal('u'), Literal('g'), Literal('.'), Literal('l'), Literal('o'), Literal('g'), ZeroOrMore]) }
       Debug [globset] glob converted to regex: Glob { glob: "**/yarn-debug.log*", re: "(?-u)^(?:/?|.*/)yarn\\-debug\\.log[^/]*$", opts: GlobOptions { case_insensitive: false, literal_separator: true, backslash_escape: true, empty_alternates: false }, tokens: Tokens([RecursivePrefix, Literal('y'), Literal('a'), Literal('r'), Literal('n'), Literal('-'), Literal('d'), Literal('e'), Literal('b'), Literal('u'), Literal('g'), Literal('.'), Literal('l'), Literal('o'), Literal('g'), ZeroOrMore]) }
       Debug [globset] glob converted to regex: Glob { glob: "**/yarn-error.log*", re: "(?-u)^(?:/?|.*/)yarn\\-error\\.log[^/]*$", opts: GlobOptions { case_insensitive: false, literal_separator: true, backslash_escape: true, empty_alternates: false }, tokens: Tokens([RecursivePrefix, Literal('y'), Literal('a'), Literal('r'), Literal('n'), Literal('-'), Literal('e'), Literal('r'), Literal('r'), Literal('o'), Literal('r'), Literal('.'), Literal('l'), Literal('o'), Literal('g'), ZeroOrMore]) }
       Debug [globset] glob converted to regex: Glob { glob: "**/pnpm-debug.log*", re: "(?-u)^(?:/?|.*/)pnpm\\-debug\\.log[^/]*$", opts: GlobOptions { case_insensitive: false, literal_separator: true, backslash_escape: true, empty_alternates: false }, tokens: Tokens([RecursivePrefix, Literal('p'), Literal('n'), Literal('p'), Literal('m'), Literal('-'), Literal('d'), Literal('e'), Literal('b'), Literal('u'), Literal('g'), Literal('.'), Literal('l'), Literal('o'), Literal('g'), ZeroOrMore]) }
       Debug [globset] glob converted to regex: Glob { glob: "**/lerna-debug.log*", re: "(?-u)^(?:/?|.*/)lerna\\-debug\\.log[^/]*$", opts: GlobOptions { case_insensitive: false, literal_separator: true, backslash_escape: true, empty_alternates: false }, tokens: Tokens([RecursivePrefix, Literal('l'), Literal('e'), Literal('r'), Literal('n'), Literal('a'), Literal('-'), Literal('d'), Literal('e'), Literal('b'), Literal('u'), Literal('g'), Literal('.'), Literal('l'), Literal('o'), Literal('g'), ZeroOrMore]) }
       Debug [globset] glob converted to regex: Glob { glob: ".vscode/*", re: "(?-u)^\\.vscode/[^/]*$", opts: GlobOptions { case_insensitive: false, literal_separator: true, backslash_escape: true, empty_alternates: false }, tokens: Tokens([Literal('.'), Literal('v'), Literal('s'), Literal('c'), Literal('o'), Literal('d'), Literal('e'), Literal('/'), ZeroOrMore]) }
       Debug [globset] glob converted to regex: Glob { glob: "**/*.ntvs*", re: "(?-u)^(?:/?|.*/)[^/]*\\.ntvs[^/]*$", opts: GlobOptions { case_insensitive: false, literal_separator: true, backslash_escape: true, empty_alternates: false }, tokens: Tokens([RecursivePrefix, ZeroOrMore, Literal('.'), Literal('n'), Literal('t'), Literal('v'), Literal('s'), ZeroOrMore]) }
       Debug [globset] glob converted to regex: Glob { glob: "**/*.sw?", re: "(?-u)^(?:/?|.*/)[^/]*\\.sw[^/]$", opts: GlobOptions { case_insensitive: false, literal_separator: true, backslash_escape: true, empty_alternates: false }, tokens: Tokens([RecursivePrefix, ZeroOrMore, Literal('.'), Literal('s'), Literal('w'), Any]) }
       Debug [globset] built glob set; 1 literals, 6 basenames, 5 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 8 regexes
       Debug [globset] built glob set; 1 literals, 0 basenames, 0 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 0 regexes
       Debug [ignore::walk] ignoring \\wsl$\Ubuntu-22.04\home\phi\test\src-tauri\.gitignore: Ignore(IgnoreMatch(Hidden))
       Debug [ignore::walk] ignoring \\wsl$\Ubuntu-22.04\home\phi\test\src-tauri\target: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("\\\\wsl$\\Ubuntu-22.04\\home\\phi\\test\\src-tauri\\.gitignore"), original: "/target/", actual: "target", is_whitelist: false, is_only_dir: true })))
     Running [tauri_cli] Command `cargo  build --features custom-protocol --release`
   Compiling test v0.0.0 (\\wsl$\Ubuntu-22.04\home\phi\test\src-tauri)
    Finished release [optimized] target(s) in 28.70s
        Info [tauri_bundler::bundle::windows::msi::wix] Target: x64
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("product_name")], "product_name")))
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("upgrade_code")], "upgrade_code")))
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("manufacturer")], "manufacturer")))
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("version")], "version")))
       Debug [handlebars::render] Rendering helper: "if", params: [PathAndJson { relative_path: Some("allow_downgrades"), value: Context(Bool(true), ["allow_downgrades"]) }], hash: {}
       Debug [handlebars::render] Rendering helper: "if", params: [PathAndJson { relative_path: Some("banner_path"), value: Missing }], hash: {}
       Debug [handlebars::render] Rendering helper: "if", params: [PathAndJson { relative_path: Some("dialog_image_path"), value: Missing }], hash: {}
       Debug [handlebars::render] Rendering helper: "if", params: [PathAndJson { relative_path: Some("license"), value: Missing }], hash: {}
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("icon_path")], "icon_path")))
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("manufacturer")], "manufacturer")))
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("product_name")], "product_name")))
       Debug [handlebars::render] Rendering helper: "unless", params: [PathAndJson { relative_path: Some("license"), value: Missing }], hash: {}
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("product_name")], "product_name")))
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("product_name")], "product_name")))
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("manufacturer")], "manufacturer")))
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("product_name")], "product_name")))
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("product_name")], "product_name")))
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("product_name")], "product_name")))
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("manufacturer")], "manufacturer")))
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("product_name")], "product_name")))
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("path_component_guid")], "path_component_guid")))
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("app_exe_source")], "app_exe_source")))
       Debug [handlebars::render] Rendering helper: "each", params: [PathAndJson { relative_path: Some("binaries"), value: Context(Array [], ["binaries"]) }], hash: {}
       Debug [handlebars::render] Rendering helper: "if", params: [PathAndJson { relative_path: Some("enable_elevated_update_task"), value: Missing }], hash: {}
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("resources")], "resources")))
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("product_name")], "product_name")))
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("product_name")], "product_name")))
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("manufacturer")], "manufacturer")))
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("product_name")], "product_name")))
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("product_name")], "product_name")))
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("product_name")], "product_name")))
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("bundle_id")], "bundle_id")))
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("manufacturer")], "manufacturer")))
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("product_name")], "product_name")))
       Debug [handlebars::render] Rendering helper: "each", params: [PathAndJson { relative_path: Some("merge_modules"), value: Context(Array [], ["merge_modules"]) }], hash: {}
       Debug [handlebars::render] Rendering helper: "each", params: [PathAndJson { relative_path: Some("resource_file_ids"), value: Context(Array [], ["resource_file_ids"]) }], hash: {}
       Debug [handlebars::render] Rendering helper: "if", params: [PathAndJson { relative_path: Some("enable_elevated_update_task"), value: Missing }], hash: {}
       Debug [handlebars::render] Rendering helper: "each", params: [PathAndJson { relative_path: Some("binaries"), value: Context(Array [], ["binaries"]) }], hash: {}
       Debug [handlebars::render] Rendering helper: "each", params: [PathAndJson { relative_path: Some("component_group_refs"), value: Missing }], hash: {}
       Debug [handlebars::render] Rendering helper: "each", params: [PathAndJson { relative_path: Some("component_refs"), value: Missing }], hash: {}
       Debug [handlebars::render] Rendering helper: "each", params: [PathAndJson { relative_path: Some("feature_group_refs"), value: Missing }], hash: {}
       Debug [handlebars::render] Rendering helper: "each", params: [PathAndJson { relative_path: Some("feature_refs"), value: Missing }], hash: {}
       Debug [handlebars::render] Rendering helper: "each", params: [PathAndJson { relative_path: Some("merge_refs"), value: Missing }], hash: {}
       Debug [handlebars::render] Rendering helper: "if", params: [PathAndJson { relative_path: Some("install_webview"), value: Context(Bool(true), ["install_webview"]) }], hash: {}
       Debug [handlebars::render] Rendering helper: "if", params: [PathAndJson { relative_path: Some("download_bootstrapper"), value: Context(Bool(true), ["download_bootstrapper"]) }], hash: {}
       Debug [handlebars::render] Rendering value: Path(Relative(([Named("webview_installer_args")], "webview_installer_args")))
       Debug [handlebars::render] Rendering helper: "if", params: [PathAndJson { relative_path: Some("webview2_bootstrapper_path"), value: Missing }], hash: {}
       Debug [handlebars::render] Rendering helper: "if", params: [PathAndJson { relative_path: Some("webview2_installer_path"), value: Missing }], hash: {}
       Debug [handlebars::render] Rendering helper: "if", params: [PathAndJson { relative_path: Some("enable_elevated_update_task"), value: Missing }], hash: {}
     Running [tauri_bundler::bundle::windows::msi::wix] candle for "main.wxs"
     Running [tauri_bundler::bundle::common] Command `C:\Users\micro\AppData\Local\tauri/WixTools\candle.exe  -arch x64 main.wxs -dSourceDir=\\wsl$\Ubuntu-22.04\home\phi\test\src-tauri\target\release\test.exe`
Windows Installer XML Toolset Compiler version 3.11.2.4516
Copyright (c) .NET Foundation and contributors. All rights reserved.

main.wxs
candle.exe : error CNDL0001 : Invalid URI: The hostname could not be parsed.

Exception Type: System.UriFormatException

Stack Trace:
   at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
   at System.Uri..ctor(String uriString)
   at Microsoft.Tools.WindowsInstallerXml.Preprocessor.Process(String sourceFile, Hashtable variables)
   at Microsoft.Tools.WindowsInstallerXml.Tools.Candle.Run(String[] args)
       Error [tauri_cli] failed to bundle project: error running candle.exe

Additional context

No response

FabianLars commented 6 months ago

This is something internal to wix (the msi creation tool) completely outside of our control. That said, i'd consider this something that shouldn't be done either way since it would invalidate the whole target dir anyway (and in the past even caused compiler issues for me a few times).