Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libssh2-sys dependency won't compile on windows #3984

Open
Zoybean opened this issue Jun 28, 2024 · 8 comments
Open

libssh2-sys dependency won't compile on windows #3984

Zoybean opened this issue Jun 28, 2024 · 8 comments

Comments

@Zoybean
Copy link

Zoybean commented Jun 28, 2024

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

  1. 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: 76ff35e
@ilyagr
Copy link
Collaborator

ilyagr commented Jun 28, 2024

According to https://martinvonz.github.io/jj/latest/install-and-setup/#windows, try installing with --features vendored-openssl. Or are you already doing that?

@Zoybean
Copy link
Author

Zoybean commented Jun 28, 2024

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

@ilyagr
Copy link
Collaborator

ilyagr commented Jun 28, 2024

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.

@ilyagr
Copy link
Collaborator

ilyagr commented Jun 28, 2024

Also, if you can definitely reproduce the problem with that option, you should edit the issue description and put it in.

@Zoybean
Copy link
Author

Zoybean commented Jun 30, 2024

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.

@thoughtpolice
Copy link
Collaborator

Regarding binaries of in-progress versions, see also: #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.

@Zoybean
Copy link
Author

Zoybean commented Jul 1, 2024

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?

@thoughtpolice
Copy link
Collaborator

thoughtpolice commented Jul 1, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants