Vendored libgit2-sys builds fail on Windows when `cargo --manifest-path` is a long UNC path

Aperta
#1,212 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
c, rust

Direzione di ricerca

Riproduci il problema con cargo build --manifest-path usando il percorso UNC lungo, quindi esamina i comandi del compilatore di libgit2-sys e libssh2-sys vendored e i relativi percorsi out/include. Confronta le build interessate 0.18.3/1.9.2 con le build precedenti 0.17.0/1.8.1; il lavoro è completato quando gli header generati vengono trovati ed entrambe le build vendored riescono da un percorso UNC lungo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Where "a long UNC path" is e.g. \\?\C:\...\some_project\Cargo.toml, which is the form emitted by std::path::Path::canonicalize on Windows.

Reproducing the error is very simple.

cargo init path_fun
cd path_fun
cargo add git2 --features vendored-libgit2
cargo build --manifest-path \\?\S:\...\path_fun\Cargo.toml
# replacing `S:\` with your drive, and `...` with a real path

The output is quite repetitive, yielding numerous lines similar to:

cargo:warning=ToolExecError: command did not execute successfully (status code exit code: 2): "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.44.35207\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-O1" "-Z7" "-Brepro" "-I" "\\\\?\\S:\\...\\target\\debug\\build\\libgit2-sys-7b3f8407131016e2\\out\\include" "-I" "libgit2/src/libgit2" "-I" "libgit2/src/util" "-I" "libgit2/deps/llhttp" "-I" "libgit2/deps/xdiff" "-I" "libgit2/deps/pcre" "-I" "\\\\?\\S:\\...\\target\\debug\\build\\libz-sys-f91fe522964cd50a\\out/include" "-W0" "-DGIT_REGEX_BUILTIN=1" "-DHAVE_STDINT_H=1" "-DHAVE_MEMMOVE=1" "-DNO_RECURSE=1" "-DNEWLINE=10" "-DPOSIX_MALLOC_THRESHOLD=10" "-DLINK_SIZE=2" "-DPARENS_NEST_LIMIT=250" "-DMATCH_LIMIT=10000000" "-DMATCH_LIMIT_RECURSION=MATCH_LIMIT" "-DMAX_NAME_SIZE=32" "-DMAX_NAME_COUNT=10000" "-DSTRSAFE_NO_DEPRECATE" "-DWIN32" "-D_WIN32_WINNT=0x0600" "-DSHA1DC_NO_STANDARD_INCLUDES=1" "-DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\"common.h\"" "-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"common.h\"" "-Fo\\\\?\\S:\\...\\target\\debug\\build\\libgit2-sys-7b3f8407131016e2\\out\\build\\43a19b30e9e69d8f-reader.o" "-c" "libgit2/src/libgit2\\reader.c"rebase.c
  S:\cargo\registry\src\index.crates.io-1949cf8c6b5b557f\libgit2-sys-0.18.3+1.9.2\libgit2\src\util\git2_util.h(11): fatal error C1083: Cannot open include file: 'git2_features.h': No such file or directory

The relevant sections, I believe, being Cannot open include file: 'git2_features.h': No such file or directory and "-I" "\\\\?\\S:\\...\\target\\debug\\build\\libgit2-sys-7b3f8407131016e2\\out\\include". Very notably, if I look in the ...\target\debug\build\libgit2-sys-7b3f8407131016e2\out\include I find git2_features.h. That leads me to imagine this is some dumb little shell expansion corner case.

I've confirmed this is reproducible (On My Machine™) in git2 v0.20.3 / libgit2-sys v0.18.3+1.9.2 through git2 v0.19.0 / libgit2-sys v0.17.0+1.8.1. (My CI systems have definitely built v0.19.0 just fine, but are bombing on v0.20.3, so I need to focus on fixing that issue.)

Note the same issue seems to be present in libssh2-sys v0.3.1, and depending on the resolved cargo build order, you might see Cannot open include file: 'libssh2.h' instead of git2_features.h with the above repro instructions. The libssh2-sys ToolExecError includes a mirrored "-I" "\\\\?\\S:\\...\\target\\debug\\build\\libssh2-sys-b28bdd3defa4ee0c\\out\\include" (almost) pointing to a directory that includes a libssh2.h. I didn't realize this until I was mostly done writing this issue and started seeing it out of my local repros. I can duplicate the report in the libssh2-sys github repo if that would be useful.

Thanks!

Lingua principale
Rust
Stelle
2.1k
Fork
470
Merge medio
2g 17h
PR unite (30g)
18

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rust-lang/git2-rs

Tutte le issue di rust-lang/git2-rs

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.