tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[bug] build windows-msvc ring v0.17.8

Open enri90 opened this issue 9 months ago • 2 comments

Describe the bug

The Windows build doesn't work for me, is it a bug?

pnpm tauri build --target x86_64-pc-windows-msvc

built in 6.85s
   Compiling tauri-plugin v2.0.0-beta.13
   Compiling tauri-build v2.0.0-beta.13
   Compiling ring v0.17.8
   Compiling unic-ucd-version v0.9.0
   Compiling regex-automata v0.4.6
   Compiling indexmap v1.9.3
   Compiling miniz_oxide v0.7.2
   Compiling crc32fast v1.4.0
   Compiling h2 v0.4.4
   Compiling crossbeam-utils v0.8.19
   Compiling winapi v0.3.9
   Compiling httparse v1.8.0
   Compiling fxhash v0.2.1
   Compiling uuid v1.8.0
   Compiling winapi-util v0.1.7
   Compiling selectors v0.22.0
   Compiling bitflags v2.5.0
   Compiling toml_datetime v0.6.3
   Compiling windows-version v0.1.1
   Compiling webview2-com-sys v0.30.0
   Compiling serde_spanned v0.6.5
   Compiling html5ever v0.26.0
   Compiling tower-service v0.3.2
   Compiling native-tls v0.2.11
   Compiling unicode-segmentation v1.11.0
   Compiling rustls v0.22.4
   Compiling winnow v0.5.40
   Compiling tower-layer v0.3.2
   Compiling thin-slice v0.1.1
   Compiling bitflags v1.3.2
   Compiling hashbrown v0.12.3
   Compiling tower v0.4.13
   Compiling regex v1.10.4
   Compiling same-file v1.0.6
   Compiling cfb v0.7.3
   Compiling crossbeam-channel v0.5.12
   Compiling flate2 v1.0.28
   Compiling unic-ucd-ident v0.9.0
   Compiling tauri v2.0.0-beta.17
   Compiling brotli-decompressor v2.5.1
   Compiling block-buffer v0.10.4
   Compiling toml_edit v0.20.2
   Compiling crypto-common v0.1.6
   Compiling fdeflate v0.3.4
   Compiling treediff v4.0.3
   Compiling phf_shared v0.11.2
   Compiling schannel v0.1.23
   Compiling hyper v1.3.1
   Compiling semver v1.0.22
The following warnings were emitted during compilation:
warning: [email protected]: ToolExecError: Command "cc" "-Oz" "--target=x86_64-pc-windows-msvc" "-ffunction-sections" "-fdata-sections" "-m64" "--target=x86_64-pc-windows-msvc" "-I" "include" "-I" "/Users/enri/test/src-tauri/target/x86_64-pc-windows-msvc/release/build/ring-c83c6e0dde466e7f/out" "-Wall" "-Wextra" "-fvisibility=hidden" "-std=c1x" "-Wall" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-g3" "-DNDEBUG" "-o" "/Users/enri/test/src-tauri/target/x86_64-pc-windows-msvc/release/build/ring-c83c6e0dde466e7f/out/a9af75d892b04b75-p256-nistz.o" "-c" "crypto/fipsmodule/ec/p256-nistz.c" with args cc did not execute successfully (status code exit status: 1).

error: failed to run custom build command for `ring v0.17.8`

Caused by:
  process didn't exit successfully: `/Users/enri/test/src-tauri/target/release/build/ring-d9a47b134cb3d173/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=RING_PREGENERATE_ASM
  cargo:rustc-env=RING_CORE_PREFIX=ring_core_0_17_8_
  OPT_LEVEL = Some("z")
  TARGET = Some("x86_64-pc-windows-msvc")
  HOST = Some("aarch64-apple-darwin")
  cargo:rerun-if-env-changed=CC_x86_64-pc-windows-msvc
  CC_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CC_x86_64_pc_windows_msvc
  CC_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  RUSTC_LINKER = Some("lld")
  cargo:rerun-if-env-changed=CROSS_COMPILE
  CROSS_COMPILE = None
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-pc-windows-msvc
  CFLAGS_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_pc_windows_msvc
  CFLAGS_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:warning=In file included from crypto/curve25519/curve25519.c:24:
  cargo:warning=In file included from crypto/curve25519/internal.h:20:
  cargo:warning=In file included from crypto/curve25519/../internal.h:115:
  cargo:warning=include/ring-core/check.h:27:11: fatal error: 'assert.h' file not found
  cargo:warning=# include <assert.h>
  cargo:warning=          ^~~~~~~~~~
  cargo:warning=1 error generated.
  exit status: 1
  cargo:warning=ToolExecError: Command "cc" "-Oz" "--target=x86_64-pc-windows-msvc" "-ffunction-sections" "-fdata-sections" "-m64" "--target=x86_64-pc-windows-msvc" "-I" "include" "-I" "/Users/enri/test/src-tauri/target/x86_64-pc-windows-msvc/release/build/ring-c83c6e0dde466e7f/out" "-Wall" "-Wextra" "-fvisibility=hidden" "-std=c1x" "-Wall" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-g3" "-DNDEBUG" "-o" "/Users/enri/test/src-tauri/target/x86_64-pc-windows-msvc/release/build/ring-c83c6e0dde466e7f/out/fad98b632b8ce3cc-curve25519.o" "-c" "crypto/curve25519/curve25519.c" with args cc did not execute successfully (status code exit status: 1).cargo:warning=In file included from crypto/fipsmodule/aes/aes_nohw.c:17:
  cargo:warning=In file included from crypto/fipsmodule/aes/../../internal.h:115:
  cargo:warning=include/ring-core/check.h:27:11: fatal error: 'assert.h' file not found
  cargo:warning=# include <assert.h>
  cargo:warning=          ^~~~~~~~~~
  cargo:warning=1 error generated.

  exit status: 1

thx

Reproduction

No response

Expected behavior

No response

Full tauri info output

tauri "info"


[✔] Environment
    - OS: Mac OS 14.2.1 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.78.0 (9b00956e5 2024-04-29)
    ✔ cargo: 1.78.0 (54d8815d0 2024-03-26)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 18.15.0
    - pnpm: 8.14.1
    - npm: 9.5.0
    - bun: 1.0.3

[-] Packages
    - tauri [RUST]: 2.0.0-beta.17
    - tauri-build [RUST]: 2.0.0-beta.13
    - wry [RUST]: 0.39.3
    - tao [RUST]: 0.27.1
    - @tauri-apps/api [NPM]: 2.0.0-beta.11
    - @tauri-apps/cli [NPM]: 2.0.0-beta.17

[-] App
    - build-type: bundle
    - CSP: default-src 'self' customprotocol: asset:
    - frontendDist: ../dist/client
    - devUrl: http://localhost:1421/
    - framework: React
    - bundler: Vite

Stack trace

No response

Additional context

No response

enri90 avatar May 12 '24 16:05 enri90

I don't think this should be a bug, this looks like your C environment isn't configured correctly

fu050409 avatar May 13 '24 11:05 fu050409

Does this also happen with a fresh create-tauri-app?

And how did you set up the cross platform compilation? Like this? https://tauri.app/v1/guides/building/cross-platform#experimental-build-windows-apps-on-linux-and-macos

FabianLars avatar May 13 '24 12:05 FabianLars

I didn't add this command

 --runner cargo-xwin

Is this guide obsolete? https://tauri.app/it/v1/guides/building/cross-platform/

but now he tells me this

✓ 6 HTML documents pre-rendered.
✓ built in 6.78s
   Compiling wry v0.39.3
   Compiling test v0.1.0 (/Users/enri/Desktop/test/test/src-tauri)
   Compiling tauri-runtime-wry v2.0.0-beta.14
The following warnings were emitted during compilation:

warning: [email protected]: Compiler family detection failed due to error: ToolExecError: Command "clang-cl" "-E" "/Users/enri/Desktop/test/test/src-tauri/target/x86_64-pc-windows-msvc/release/build/test-cef6f54061a54857/out/9847227335346682808detect_compiler_family.c" with args clang-cl did not execute successfully (status code exit status: 1).
warning: [email protected]: clang-cl: error: unsupported option '-x c'; did you mean '/TC' or '/TP'?

error: failed to run custom build command for `test v0.1.0 (/Users/enri/Desktop/test/test/src-tauri)`

Caused by:
  process didn't exit successfully: `/Users/enri/Desktop/test/test/src-tauri/target/release/build/test-ccb677ac1587f7ce/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=TAURI_CONFIG
  cargo:rerun-if-changed=tauri.conf.json
  cargo:rustc-cfg=desktop
  cargo:rustc-env=TAURI_ANDROID_PACKAGE_PREFIX=com_test-wb
  cargo:PERMISSION_FILES_PATH=/Users/enri/Desktop/test/test/src-tauri/target/x86_64-pc-windows-msvc/release/build/test-cef6f54061a54857/out/app-manifest/__app__-permission-files
  cargo:rerun-if-changed=capabilities
  cargo:rustc-env=TAURI_ENV_TARGET_TRIPLE=x86_64-pc-windows-msvc
  cargo:warning=Compiler family detection failed due to error: ToolExecError: Command "clang-cl" "-E" "/Users/enri/Desktop/test/test/src-tauri/target/x86_64-pc-windows-msvc/release/build/test-cef6f54061a54857/out/9847227335346682808detect_compiler_family.c" with args clang-cl did not execute successfully (status code exit status: 1).
  cargo:warning=clang-cl: error: unsupported option '-x c'; did you mean '/TC' or '/TP'?

  --- stderr


  error occurred: Command "clang-cl" "-nologo" "-MD" "-O1" "-Brepro" "-m64" "--target=x86_64-pc-windows-msvc" "-Wno-unused-command-line-argument" "-fuse-ld=lld-link" "/imsvc/Users/enri/Library/Caches/cargo-xwin/xwin/crt/include" "/imsvc/Users/enri/Library/Caches/cargo-xwin/xwin/sdk/include/ucrt" "/imsvc/Users/enri/Library/Caches/cargo-xwin/xwin/sdk/include/um" "/imsvc/Users/enri/Library/Caches/cargo-xwin/xwin/sdk/include/shared" "-I" "/Users/enri/Desktop/test/test/src-tauri/target/x86_64-pc-windows-msvc/release/build/test-cef6f54061a54857/out" "-xc" "-DRC_INVOKED" "-E" "--" "/Users/enri/Desktop/test/test/src-tauri/target/x86_64-pc-windows-msvc/release/build/test-cef6f54061a54857/out/resource.rc" with args clang-cl did not execute successfully (status code exit status: 1).


warning: build failed, waiting for other jobs to finish...
    Error failed to build app: failed to build app
clang --version
Homebrew clang version 18.1.5
Target: arm64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /opt/homebrew/opt/llvm/bin
clang-cl --version
Homebrew clang version 18.1.5
Target: arm64-pc-windows-msvc
Thread model: posix
InstalledDir: /opt/homebrew/opt/llvm/bin

enri90 avatar May 15 '24 15:05 enri90

Is this guide obsolete? https://tauri.app/it/v1/guides/building/cross-platform/

Yup, the translations weren't updated. The old guide can still work but you have to set up some CC env vars in some cases (don't ask me which ones, i can't remember).

Your new error apparently can be fixed by forcing llvm and clang to use v15 according to another user.

FabianLars avatar May 15 '24 15:05 FabianLars

Thank you. Solved with the following command

brew install llvm@15

enri90 avatar May 16 '24 12:05 enri90