rust-lang / cc-rs

Rust library for build scripts to compile C/C++ code into a Rust library
https://docs.rs/cc
Apache License 2.0
1.77k stars 427 forks source link

error: failed to run custom build command for `libnghttp2-sys v0.1.9+1.58.0` #1044

Closed sandersbasket closed 2 months ago

sandersbasket commented 2 months ago

how to fix problem? i need compile rust + tauri to NSIS, but i have error, console output: i have build tools and rustup, cargo and another modules for compile, but have error....

cargo tauri build --target=aarch64-pc-windows-msvc --bundles nsis 
   Compiling libz-sys v1.1.15
   Compiling libnghttp2-sys v0.1.9+1.58.0
error: failed to run custom build command for `libz-sys v1.1.15`

Caused by:
  process didn't exit successfully: `C:\Users\fazuq\Desktop\activiy-orders\МАРАТ ПИДАРАС\launcher-test\src-tauri\target\release\build\libz-sys-9ac9a6744d3a3b6f\build-script-build` (exit code: 1)
  --- stdout
  cargo:rerun-if-env-changed=LIBZ_SYS_STATIC
  cargo:rerun-if-changed=build.rs
  note, vcpkg did not find zlib: Could not find library in Vcpkg tree package zlib is not installed for vcpkg triplet arm64-windows-static
  TARGET = Some("aarch64-pc-windows-msvc")
  OPT_LEVEL = Some("3")
  HOST = Some("x86_64-pc-windows-msvc")
  cargo:rerun-if-env-changed=CC_aarch64-pc-windows-msvc
  CC_aarch64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CC_aarch64_pc_windows_msvc
  CC_aarch64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("crt-static,neon")
  DEBUG = Some("false")
  cargo:rerun-if-env-changed=CFLAGS_aarch64-pc-windows-msvc
  CFLAGS_aarch64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_pc_windows_msvc
  CFLAGS_aarch64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  running: "cl.exe" "-nologo" "-MT" "-O2" "-Brepro" "-I" "src/zlib" "-FoC:\\Users\\fazuq\\Desktop\\activiy-orders\\МАРАТ ПИДАРАС\\launcher-test\\src-tauri\\target\\aarch64-pc-windows-msvc\\release\\build\\libz-sys-8fe3ae308a669f1c\\out\\lib\\src/zlib/adler32.o" "-c" "src/zlib/adler32.c"

  --- stderr

  error occurred: Failed to find tool. Is `cl.exe` installed? (see https://github.com/rust-lang/cc-rs#compile-time-requirements for help)

warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `libnghttp2-sys v0.1.9+1.58.0`

Caused by:
  process didn't exit successfully: `C:\Users\fazuq\Desktop\activiy-orders\МАРАТ ПИДАРАС\launcher-test\src-tauri\target\release\build\libnghttp2-sys-4f1916e0f7e477e3\build-script-build` (exit code: 1)
  --- stdout
  TARGET = Some("aarch64-pc-windows-msvc")
  OPT_LEVEL = Some("3")
  HOST = Some("x86_64-pc-windows-msvc")
  cargo:rerun-if-env-changed=CC_aarch64-pc-windows-msvc
  CC_aarch64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CC_aarch64_pc_windows_msvc
  CC_aarch64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("crt-static,neon")
  DEBUG = Some("false")
  cargo:rerun-if-env-changed=CFLAGS_aarch64-pc-windows-msvc
  CFLAGS_aarch64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_pc_windows_msvc
  CFLAGS_aarch64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  running: "cl.exe" "-nologo" "-MT" "-O2" "-Brepro" "-I" "nghttp2/lib/includes" "-I" "C:\\Users\\fazuq\\Desktop\\activiy-orders\\МАРАТ ПИДАРАС\\launcher-test\\src-tauri\\target\\aarch64-pc-windows-msvc\\release\\build\\libnghttp2-sys-9358d81d0a9df3a2\\out\\i\\include" "-DNGHTTP2_STATICLIB" "-DHAVE_NETINET_IN" "-DHAVE_TIME_H" "-Dssize_t=int64_t" "-FoC:\\Users\\fazuq\\Desktop\\activiy-orders\\МАРАТ ПИДАРАС\\launcher-test\\src-tauri\\target\\aarch64-pc-windows-msvc\\release\\build\\libnghttp2-sys-9358d81d0a9df3a2\\out\\i\\lib\\nghttp2/lib/sfparse.o" "-c" "nghttp2/lib/sfparse.c"

  --- stderr

  error occurred: Failed to find tool. Is `cl.exe` installed? (see https://github.com/rust-lang/cc-rs#compile-time-requirements for help)

       Error failed to build app: failed to build app
NobodyXu commented 2 months ago

cl.exe is not found, did you install the msvc?

sandersbasket commented 2 months ago

cl.exe is not found, did you install the msvc?

yeah

image image

sandersbasket commented 2 months ago

maybe it's build.rs file?

fn main() {
  let mut windows = tauri_build::WindowsAttributes::new();
  windows = windows.app_manifest(r#"
  <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <security>
            <requestedPrivileges>
                <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
            </requestedPrivileges>
        </security>
    </trustInfo>
  </assembly>
  "#);
  let attrs =  tauri_build::Attributes::new().windows_attributes(windows);
  tauri_build::try_build(attrs).expect("failed to run build script");
}

upd: i checked, it's not about him

NobodyXu commented 2 months ago

Did you install msvc toolchain for arm?

I think it might need to install separately, when cross compiling arm on x64.

sandersbasket commented 2 months ago

Did you install msvc toolchain for arm?

I think it might need to install separately, when cross compiling arm on x64.

honestly, I tried everything at all, installing rustc, MS VC, and so on, you can links or resources, what exactly do you need to install? I think I tried everything)

NobodyXu commented 2 months ago

I'm not sure about that, cc @thomcc I think you might know how to do?

thomcc commented 2 months ago

It should be in the MSVC installer, a checkbox you choose the ARM and ARM64 build tools for C++ in the individual components tab.

ChrisDenton commented 2 months ago

Awhile back I wrote a walkthrough for rustup which included installing individual components (though with the UI in English).

The difference here is that on the "Individual Components" tab you need to search for "ARM64/ARM64EC" the latest MSVC build tools for ARM64 should be near or at the top.

screenshot ![arm64](https://github.com/rust-lang/cc-rs/assets/4459874/072bf5c9-d247-4de8-ab36-3466367ae3ef)
sandersbasket commented 2 months ago

Awhile back I wrote a walkthrough for rustup which included installing individual components (though with the UI in English).

The difference here is that on the "Individual Components" tab you need to search for "ARM64/ARM64EC" the latest MSVC build tools for ARM64 should be near or at the top.

screenshot

YEAAAAHHHH!! FIXED!!!

NobodyXu commented 2 months ago

That's good to hear, I will close this issue as completed : )