rust-lang / cargo

The Rust package manager
https://doc.rust-lang.org/cargo
Apache License 2.0
12.87k stars 2.43k forks source link

Cannot `cargo install --path .` #14072

Open notdanilo opened 5 months ago

notdanilo commented 5 months ago

Problem

cargo install --path cargo_repository fails with

error: failed to run custom build command for `libsqlite3-sys v0.28.0`                                                                                                                                         

Caused by:
  process didn't exit successfully: `D:\dev\3rd\rust-lang\cargo\target\release\build\libsqlite3-sys-fe66bbe32e9c3e02\build-script-build` (exit code: 1)
  --- stdout
  cargo:rerun-if-env-changed=LIBSQLITE3_SYS_USE_PKG_CONFIG
  cargo:include=C:\Users\dangu\.cargo\registry\src\index.crates.io-6f17d22bba15001f\libsqlite3-sys-0.28.0/sqlite3
  cargo:rerun-if-changed=sqlite3/sqlite3.c
  cargo:rerun-if-changed=sqlite3/wasm32-wasi-vfs.c
  cargo:rerun-if-env-changed=SQLITE_MAX_VARIABLE_NUMBER
  cargo:rerun-if-env-changed=SQLITE_MAX_EXPR_DEPTH
  cargo:rerun-if-env-changed=SQLITE_MAX_COLUMN
  cargo:rerun-if-env-changed=LIBSQLITE3_FLAGS
  TARGET = Some("x86_64-pc-windows-msvc")
  OPT_LEVEL = Some("3")
  HOST = Some("x86_64-pc-windows-msvc")
  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=HOST_CC
  HOST_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("cmpxchg16b,fxsr,sse,sse2,sse3")
  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=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  sqlite3.c
  C:\Users\dangu\.cargo\registry\src\index.crates.io-6f17d22bba15001f\libsqlite3-sys-0.28.0\sqlite3\sqlite3.c(244550) : fatal error C1001: Internal compiler error.
  (compiler file 'D:\a\_work\1\s\src\vctools\Compiler\Utc\src\p2\main.c', line 242)
   To work around this problem, try simplifying or changing the program near the locations listed above.
  If possible please provide a repro here: https://developercommunity.visualstudio.com
  Please choose the Technical Support command on the Visual C++
   Help menu, or open the Technical Support help file for more information

  --- stderr

  error occurred: Command "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.40.33807\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-O2" "-Brepro" "-DSQLITE_CORE" "-DSQLITE_DEFAULT_FOREIGN_KEYS=1" "-DSQLITE_ENABLE_API_ARMOR" "-DSQLITE_ENABLE_COLUMN_METADATA" "-DSQLITE_ENABLE_DBSTAT_VTAB" "-DSQLITE_ENABLE_FTS3" "-DSQLITE_ENABLE_FTS3_PARENTHESIS" "-DSQLITE_ENABLE_FTS5" "-DSQLITE_ENABLE_JSON1" "-DSQLITE_ENABLE_LOAD_EXTENSION=1" "-DSQLITE_ENABLE_MEMORY_MANAGEMENT" "-DSQLITE_ENABLE_RTREE" "-DSQLITE_ENABLE_STAT2" "-DSQLITE_ENABLE_STAT4" "-DSQLITE_SOUNDEX" "-DSQLITE_THREADSAFE=1" "-DSQLITE_USE_URI" "-DHAVE_USLEEP=1" "-D_POSIX_THREAD_SAFE_FUNCTIONS" "-DHAVE_ISNAN" "-FoD:\\dev\\3rd\\rust-lang\\cargo\\target\\release\\build\\libsqlite3-sys-4b1840bf8888fec0\\out\\0343851c9008f270-sqlite3.o" "-c" "sqlite3/sqlite3.c" with args cl.exe did not execute successfully (status code exit code: 0xc0000005).

warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo v0.82.0 (D:\dev\3rd\rust-lang\cargo)`, intermediate artifacts can be found at `D:\dev\3rd\rust-lang\cargo\target`.                                                             
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

Steps

cargo install --path cargo_repository

Possible Solution(s)

No response

Notes

cargo install --path cargo_repository --debug works though

Version

No response

heisen-li commented 5 months ago

@rustbot label +Command-install

weihanglo commented 5 months ago

Looks like it is an internal compiler error when building SQLite (something like this?) Is it reproducible with the following commands?

cargo new sqlitemsvc --lib
cd sqlitemsvc
cargo add libsqlite3-sys -F bundled
cargo b

You might need to either upgrade or downgrade your Visual Studio devtool, or switch to equivalent version we use in our Windows job on CI.

epage commented 5 months ago

So while not as relevant here, I want to be clear that, like #14071, one should not cargo install cargo