jj
jj copied to clipboard
libssh2-sys dependency won't compile on windows
Description
I've regularly compiled from source before (though on a different win10 computer). Currently, though, the libssh2-sys dependency is failing to compile. I've tried compiling the both ssh2-rs repo (which uses 0.3.0 of the sys crate) and the libssh2-sys crate (at 0.3.0) directly with no apparent issue, so I suspect the failure is somehow tied to jj.
Steps to Reproduce the Problem
cargo install --locked --bin jj jj-cli --features vendored-openssl
Expected Behavior
jj installs successfully
Actual Behavior
The following warnings were emitted during compilation:
warning: [email protected]: ToolExecError: Command "C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\VC\\Tools\\MSVC\\14.40.33807\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-O2" "-Brepro" "-I" "C:\\redacted\\Repositories\\Program_Sources\\jj\\target\\release\\build\\libssh2-sys-ded426dd75c5c457\\out\\include" "-I" "libssh2/src" "-I" "libssh2/win32" "-I" "C:\\redacted\\Repositories\\Program_Sources\\jj\\target\\release\\build\\libz-sys-a0ac929a610bcef1\\out/include" "-DHAVE_LONGLONG" "-DLIBSSH2_WIN32" "-DLIBSSH2_WINCNG" "-DLIBSSH2_DH_GEX_NEW" "-DLIBSSH2_HAVE_ZLIB" "-FoC:\\redacted\\Repositories\\Program_Sources\\jj\\target\\release\\build\\libssh2-sys-ded426dd75c5c457\\out\\build\\903bc623e643396f-wincng.o" "-c" "libssh2/src/wincng.c" with args cl.exe did not execute successfully (status code exit code: 2).
error: failed to run custom build command for `libssh2-sys v0.3.0`
Caused by:
process didn't exit successfully: `C:\redacted\Repositories\Program_Sources\jj\target\release\build\libssh2-sys-d4d64422b0d336c7\build-script-build` (exit code: 1)
--- stdout
cargo:rerun-if-env-changed=LIBSSH2_SYS_USE_PKG_CONFIG
cargo:include=C:\redacted\Repositories\Program_Sources\jj\target\release\build\libssh2-sys-ded426dd75c5c457\out\include
cargo:root=C:\redacted\Repositories\Program_Sources\jj\target\release\build\libssh2-sys-ded426dd75c5c457\out
cargo:rerun-if-env-changed=DEP_Z_INCLUDE
cargo:rerun-if-env-changed=DEP_OPENSSL_INCLUDE
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
agent.c
bcrypt_pbkdf.c
blowfish.c
channel.c
comp.c
crypt.c
global.c
hostkey.c
keepalive.c
kex.c
knownhost.c
mac.c
misc.c
packet.c
pem.c
exit code: 0
exit code: 0
exit code: 0
exit code: 0
exit code: 0
exit code: 0
exit code: 0
exit code: 0
exit code: 0
publickey.c
scp.c
session.c
sftp.c
transport.c
userauth.c
userauth_kbd_packet.c
agent_win.c
wincng.c
libssh2/src/session.c(519): warning C4068: unknown pragma 'GCC'
libssh2/src/session.c(520): warning C4068: unknown pragma 'GCC'
libssh2/src/session.c(568): warning C4068: unknown pragma 'GCC'
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared\ntstatus.h(1): warning C4821: Unable to determine Unicode encoding type, please save the file with signature (BOM)
libssh2/src/wincng.c(2578): error C2065: 'STATUS_NOT_SUPPORTED': undeclared identifier
libssh2/src/wincng.c(2596): error C2065: 'STATUS_NOT_SUPPORTED': undeclared identifier
libssh2/src/wincng.c(2625): error C2065: 'STATUS_NOT_SUPPORTED': undeclared identifier
exit code: 0
exit code: 0
exit code: 0
exit code: 0
exit code: 0
exit code: 0
exit code: 0
exit code: 0
exit code: 0
exit code: 0
exit code: 0
exit code: 0
exit code: 0
exit code: 0
exit code: 2
cargo:warning=ToolExecError: Command "C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\VC\\Tools\\MSVC\\14.40.33807\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-O2" "-Brepro" "-I" "C:\\redacted\\Repositories\\Program_Sources\\jj\\target\\release\\build\\libssh2-sys-ded426dd75c5c457\\out\\include" "-I" "libssh2/src" "-I" "libssh2/win32" "-I" "C:\\redacted\\Repositories\\Program_Sources\\jj\\target\\release\\build\\libz-sys-a0ac929a610bcef1\\out/include" "-DHAVE_LONGLONG" "-DLIBSSH2_WIN32" "-DLIBSSH2_WINCNG" "-DLIBSSH2_DH_GEX_NEW" "-DLIBSSH2_HAVE_ZLIB" "-FoC:\\redacted\\Repositories\\Program_Sources\\jj\\target\\release\\build\\libssh2-sys-ded426dd75c5c457\\out\\build\\903bc623e643396f-wincng.o" "-c" "libssh2/src/wincng.c" with args cl.exe did not execute successfully (status code exit code: 2).
--- stderr
fatal: not a git repository (or any of the parent directories): .git
error occurred: Command "C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\VC\\Tools\\MSVC\\14.40.33807\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-O2" "-Brepro" "-I" "C:\\redacted\\Repositories\\Program_Sources\\jj\\target\\release\\build\\libssh2-sys-ded426dd75c5c457\\out\\include" "-I" "libssh2/src" "-I" "libssh2/win32" "-I" "C:\\redacted\\Repositories\\Program_Sources\\jj\\target\\release\\build\\libz-sys-a0ac929a610bcef1\\out/include" "-DHAVE_LONGLONG" "-DLIBSSH2_WIN32" "-DLIBSSH2_WINCNG" "-DLIBSSH2_DH_GEX_NEW" "-DLIBSSH2_HAVE_ZLIB" "-FoC:\\redacted\\Repositories\\Program_Sources\\jj\\target\\release\\build\\libssh2-sys-ded426dd75c5c457\\out\\build\\903bc623e643396f-wincng.o" "-c" "libssh2/src/wincng.c" with args cl.exe did not execute successfully (status code exit code: 2).
error: failed to compile `jj-cli v0.18.0 (C:\redacted\Repositories\Program_Sources\jj\cli)`, intermediate artifacts can be found at `C:\redacted\Repositories\Program_Sources\jj\target`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
Specifications
- Platform: Windows 10
- Version: 76ff35eba45e763b83041e3e769e521956faf65d
According to https://martinvonz.github.io/jj/latest/install-and-setup/#windows, try installing with --features vendored-openssl. Or are you already doing that?
I was - I'd tried with and without that feature and got the same error, so I omitted it when typing the issue, forgetting it was in the explicit installation instructions for windows
I see. One thing you could attempt is to figure out how your setup is different from the CI (https://github.com/martinvonz/jj/actions/runs/9706008935/job/26788998456). I have a Windows 11 VM I could try this in; perhaps somebody running actual Windows can try to reproduce the problem.
Also, if you can definitely reproduce the problem with that option, you should edit the issue description and put it in.
Looks like I can compile it on my home (windows 10) pc with or without the relevant feature, so it's definitely something about my work pc. I might just wait till the next jj release and get a pre-built binary.
Regarding binaries of in-progress versions, see also: https://github.com/martinvonz/jj/issues/2544 which I can maybe tack a whack at implementing. Then you could go download a binary immediately from the latest commit on main, which would be great. We now run builds on all pushes actually, so we should probably just build binaries from everything all the time.
Oh that would be perfect for me actually. I don't suppose there's any way to grab one of those binaries before #3999 merges?
You can find some binaries on the main branch of my fork, which I've been using to test that PR; they're temporary and will expire, so grab them while they're hot: https://github.com/thoughtpolice/jj/actions/workflows/build-binaries.yml (Click on the latest green build and then scroll down to the "Artifacts" section)
I suspect it will get merged today though at the latest, since it's pretty straightforward.
I think this dependency is gone now, if I'm reading Cargo.lock correctly.