conda-forge / conda-forge/libssh2-feedstock

Standard library prefix on Windows

Open
#55 2 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
C
Stars
0
Forks
19
PR merge metrics
No merged PRs in 30d

Description

### Comment:

While working on a rust package using `libssh2` (see https://github.com/conda-forge/git-cliff-feedstock/pull/23#issuecomment-2695470356 and https://github.com/conda-forge/git-cliff-feedstock/pull/26, I found the windows build to fails with the following error:

```
2025-03-03T20:27:41.1180114Z │ │ Compiling shellexpand v3.1.0
2025-03-03T20:27:41.5021390Z │ │ Compiling clap_complete v4.5.42
2025-03-03T20:27:46.3974870Z │ │ Compiling git-cliff v2.8.0 (%SRC_DIR%\git-cliff)
2025-03-03T20:29:28.1082400Z │ │ error: linking with `link.exe` failed: exit code: 1181
2025-03-03T20:29:28.1086500Z │ │ |
2025-03-03T20:29:28.1106303Z │ │ = note: "link.exe" "/NOLOGO" "C:\\Users\\VSSADM~1\\AppData\\Local\\Temp\\rustcwkRGUL\\symbols.o" "D:\\bld\\bld\\rattler-build_git-cliff_1741033020\\work\\target\\release\\deps\\git_cliff_mangen.git_cliff_mangen.6e8f447f5cb8fa0b-cgu.0.rcgu.o" "C:\\Users\\VSSADM~1\\AppData\\Local\\Temp\\rustcwkRGUL\\libring-5fb22efb6a2f14bf.rlib" "C:\\Users\\VSSADM~1\\AppData\\Local\\Temp\\rustcwkRGUL\\libzstd_sys-cc4c6305e839ac5d.rlib" "C:\\Users\\VSSADM~1\\AppData\\Local\\Temp\\rustcwkRGUL\\liblibz_sys-d8bef90a48b67ef6.rlib" "C:\\Users\\VSSADM~1\\AppData\\Local\\Temp\\rustcwkRGUL\\libstd-aec24404b15c3c54.rlib" "D:\\bld\\bld\\rattler-build_git-cliff_1741033020\\build_env\\Library\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-4867bdd705ffd9c0.rlib" "D:\\bld\\bld\\rattler-build_git-cliff_1741033020\\build_env\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\windows_x86_64_msvc-0.48.5\\lib\\windows.0.48.5.lib" "D:\\bld\\bld\\rattler-build_git-cliff_1741033020\\build_env\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\windows_x86_64_msvc-0.52.6\\lib\\windows.0.52.0.lib" "D:\\bld\\bld\\rattler-build_git-cliff_1741033020\\build_env\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\windows_x86_64_msvc-0.52.6\\lib\\windows.0.52.0.lib" "D:\\bld\\bld\\rattler-build_git-cliff_1741033020\\build_env\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\windows_x86_64_msvc-0.52.6\\lib\\windows.0.52.0.lib" "D:\\bld\\bld\\rattler-build_git-cliff_1741033020\\build_env\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\windows_x86_64_msvc-0.52.6\\lib\\windows.0.52.0.lib" "D:\\bld\\bld\\rattler-build_git-cliff_1741033020\\build_env\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\windows_x86_64_msvc-0.52.6\\lib\\windows.0.52.0.lib" "D:\\bld\\bld\\rattler-build_git-cliff_1741033020\\build_env\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\windows_x86_64_msvc-0.52.6\\lib\\windows.0.52.0.lib" "bcrypt.lib" "advapi32.lib" "D:\\bld\\bld\\rattler-build_git-cliff_1741033020\\build_env\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\windows_x86_64_msvc-0.52.6\\lib\\windows.0.52.0.lib" "%PREFIX%/Library/lib\\git2.lib" "winhttp.lib" "rpcrt4.lib" "crypt32.lib" "ole32.lib" "ssh2.lib" "ws2_32.lib" "secur32.lib" "legacy_stdio_definitions.lib" "D:\\bld\\bld\\rattler-build_git-cliff_1741033020\\build_env\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\windows_x86_64_msvc-0.52.6\\lib\\windows.0.52.0.lib" "kernel32.lib" "kernel32.lib" "advapi32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "dbghelp.lib" "/defaultlib:msvcrt" "/NXCOMPAT" "/LIBPATH:D:\\bld\\bld\\rattler-build_git-cliff_1741033020\\build_env\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\windows_x86_64_msvc-0.52.6\\lib" "/LIBPATH:D:\\bld\\bld\\rattler-build_git-cliff_1741033020\\build_env\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\windows_x86_64_msvc-0.48.5\\lib" "/LIBPATH:%PREFIX%/Library/lib" "/LIBPATH:D:\\bld\\bld\\rattler-build_git-cliff_1741033020\\work\\target\\release\\build\\libz-sys-18d1b090c9903f34\\out\\lib" "/LIBPATH:D:\\bld\\bld\\rattler-build_git-cliff_1741033020\\work\\target\\release\\build\\libz-sys-18d1b090c9903f34\\out\\lib" "/LIBPATH:D:\\bld\\bld\\rattler-build_git-cliff_1741033020\\work\\target\\release\\build\\zstd-sys-5b06e39c3d566ca1\\out" "/LIBPATH:D:\\bld\\bld\\rattler-build_git-cliff_1741033020\\work\\target\\release\\build\\ring-7156394672e3d1a4\\out" "/OUT:D:\\bld\\bld\\rattler-build_git-cliff_1741033020\\work\\target\\release\\deps\\git_cliff_mangen.exe" "/OPT:REF,ICF" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NATVIS:D:\\bld\\bld\\rattler-build_git-cliff_1741033020\\build_env\\Library\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:D:\\bld\\bld\\rattler-build_git-cliff_1741033020\\build_env\\Library\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:D:\\bld\\bld\\rattler-build_git-cliff_1741033020\\build_env\\Library\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:D:\\bld\\bld\\rattler-build_git-cliff_1741033020\\build_env\\Library\\lib\\rustlib\\etc\\libstd.natvis"
2025-03-03T20:29:28.1453315Z │ │ = note: LINK : fatal error LNK1181: cannot open input file 'ssh2.lib'␍
2025-03-03T20:29:28.1457195Z │ │
```

Someone on Zulip spotted that the linker is looking for `ssh2.lib` while the library only contains `libssh2.lib`.

After adding `set "RUSTFLAGS=-l libssh2 %RUSTFLAGS%"` to the Windows build, everything works fine.

Doing a [GH search on conda-forge](https://github.com/search?q=org%3Aconda-forge%20CMAKE_SHARED_LIBRARY_PREFIX&type=code), we can see that a few feedstocks are setting manually `CMAKE_SHARED_LIBRARY_PREFIX` to either `"lib"` or `""`.

I am not sure which one is standard on Windows and/or conda-forge, and I am not sure whether there is a proper way to fix it (without having to do `set "RUSTFLAGS=-l libssh2 %RUSTFLAGS%"`).

There is no real actionable here and I only opened that ticket to let you know about the issue.

ping @conda-forge/libssh2

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.