libssh2 / libssh2

the SSH library

Home Page:https://libssh2.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Comfile error

sidreco214 opened this issue · comments

Describe the bug
My cmd log is below

wget https://libssh2.org/download/libssh2-1.11.0.tar.gz
tar -zxvf libssh2-1.11.0.tar.gz
del libssh2-1.11.0.tar.gz
cd libssh2-1.11.0
mkdir build
cd build
cmake .. -G Ninja
-- The C compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: D:/2.Program/winlibs-x86_64-posix-seh-gcc-12.2.0-llvm-15.0.7-mingw-w64ucrt-10.0.0-r4/mingw64/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Performing Test OPT_Wdouble_promotion
-- Performing Test OPT_Wdouble_promotion - Success
-- Performing Test OPT_Wenum_conversion
-- Performing Test OPT_Wenum_conversion - Success
-- Performing Test OPT_Wunused_const_variable
-- Performing Test OPT_Wunused_const_variable - Success
-- Picky compiler options: -W -pedantic -Wbad-function-cast -Wconversion -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-long-long -Wno-multichar -Wpointer-arith -Wshadow -Wsign-compare -Wundef -Wunused -Wwrite-strings -Wcast-align -Wdeclaration-after-statement -Wempty-body -Wendif-labels -Wfloat-equal -Wignored-qualifiers -Wno-format-nonliteral -Wno-sign-conversion -Wno-system-headers -Wstrict-prototypes -Wtype-limits -Wvla -Wmissing-parameter-type -Wold-style-declaration -Wstrict-aliasing=3 -Wno-pedantic-ms-format -Wformat=2 -Warray-bounds=2 -ftree-vrp -Wduplicated-cond -Wnull-dereference -fdelete-null-pointer-checks -Wshift-negative-value -Wshift-overflow=2 -Walloc-zero -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=1 -Wrestrict -Warith-conversion -Wdouble-promotion -Wenum-conversion -Wunused-const-variable
-- Found OpenSSL: D:/3.Code/OpenSSL-Win64/lib/libcrypto.lib (found version "3.1.2")
-- Found libcrypto DLL: D:/3.Code/OpenSSL-Win64/bin/libcrypto-3-x64.dll
-- Found libssl DLL: D:/3.Code/OpenSSL-Win64/bin/libssl-3-x64.dll
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-- The following features have been enabled:

  • Static library, creating libssh2 static library
  • Shared library, creating libssh2 shared library (.so/.dll)

-- The following OPTIONAL packages have been found:

  • OpenSSL

-- The following features have been disabled:

  • Logging, Logging of execution with debug trace
  • Compression, using zlib for compression

-- The following OPTIONAL packages have not been found:

  • ZLIB

-- Configuring done
-- Generating done
-- Build files have been written to: D:/3.Code/libssh2-1.11.0/build
D:\3.Code\libssh2-1.11.0\build>ninja all
[49/151] Linking C shared library src\libssh2.dll
FAILED: src/libssh2.dll src/libssh2.dll.a
cmd.exe /C "cd . && D:\2.Program\winlibs-x86_64-posix-seh-gcc-12.2.0-llvm-15.0.7-mingw-w64ucrt-10.0.0-r4\mingw64\bin\gcc.exe -Wall -W -pedantic -Wbad-function-cast -Wconversion -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-long-long -Wno-multichar -Wpointer-arith -Wshadow -Wsign-compare -Wundef -Wunused -Wwrite-strings -Wcast-align -Wdeclaration-after-statement -Wempty-body -Wendif-labels -Wfloat-equal -Wignored-qualifiers -Wno-format-nonliteral -Wno-sign-conversion -Wno-system-headers -Wstrict-prototypes -Wtype-limits -Wvla -Wmissing-parameter-type -Wold-style-declaration -Wstrict-aliasing=3 -Wno-pedantic-ms-format -Wformat=2 -Warray-bounds=2 -ftree-vrp -Wduplicated-cond -Wnull-dereference -fdelete-null-pointer-checks -Wshift-negative-value -Wshift-overflow=2 -Walloc-zero -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=1 -Wrestrict -Warith-conversion -Wdouble-promotion -Wenum-conversion -Wunused-const-variable -shared -o src\libssh2.dll -Wl,--out-implib,src\libssh2.dll.a -Wl,--major-image-version,1,--minor-image-version,0 src/CMakeFiles/libssh2_shared.dir/agent.c.obj src/CMakeFiles/libssh2_shared.dir/bcrypt_pbkdf.c.obj src/CMakeFiles/libssh2_shared.dir/channel.c.obj src/CMakeFiles/libssh2_shared.dir/comp.c.obj src/CMakeFiles/libssh2_shared.dir/crypt.c.obj src/CMakeFiles/libssh2_shared.dir/crypto.c.obj src/CMakeFiles/libssh2_shared.dir/global.c.obj src/CMakeFiles/libssh2_shared.dir/hostkey.c.obj src/CMakeFiles/libssh2_shared.dir/keepalive.c.obj src/CMakeFiles/libssh2_shared.dir/kex.c.obj src/CMakeFiles/libssh2_shared.dir/knownhost.c.obj src/CMakeFiles/libssh2_shared.dir/mac.c.obj src/CMakeFiles/libssh2_shared.dir/misc.c.obj src/CMakeFiles/libssh2_shared.dir/packet.c.obj src/CMakeFiles/libssh2_shared.dir/pem.c.obj src/CMakeFiles/libssh2_shared.dir/publickey.c.obj src/CMakeFiles/libssh2_shared.dir/scp.c.obj src/CMakeFiles/libssh2_shared.dir/session.c.obj src/CMakeFiles/libssh2_shared.dir/sftp.c.obj src/CMakeFiles/libssh2_shared.dir/transport.c.obj src/CMakeFiles/libssh2_shared.dir/userauth.c.obj src/CMakeFiles/libssh2_shared.dir/userauth_kbd_packet.c.obj src/CMakeFiles/libssh2_shared.dir/version.c.obj src/CMakeFiles/libssh2_shared.dir/libssh2.rc.obj D:/3.Code/OpenSSL-Win64/lib/libssl.lib D:/3.Code/OpenSSL-Win64/lib/libcrypto.lib -lcrypt32 -lbcrypt -lws2_32 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
d:/2.program/winlibs-x86_64-posix-seh-gcc-12.2.0-llvm-15.0.7-mingw-w64ucrt-10.0.0-r4/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: internal error: aborting at ../../ld/ldlang.c:527 in compare_section
d:/2.program/winlibs-x86_64-posix-seh-gcc-12.2.0-llvm-15.0.7-mingw-w64ucrt-10.0.0-r4/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: please report this bug
collect2.exe: error: ld returned 1 exit status
[52/151] Building C object tests/CMakeFiles/runner.dir/openssh_fixture.c.obj
ninja: build stopped: subcommand failed.

Expected behavior
Could you explain me how to build this project?

Version (please complete the following information):

  • OS and version: Windows 10
  • libssh2 version: 1.11.0
  • crypto backend and version: OpenSSL 3.1.2

Additional context
Before this, I installed OpenSSL in C:\Program Files. But I met "cc1.exe: fatal error: files/openssl-win64/include: no such file or directory". So I delete it and reinstall new one at D:\3.Code

You're using a mingw/llvm-based toolchain with MSVC OpenSSL static libs. That might be the reason for the ld internal error.

Thanks for your help. I build it successfuly with msvc + ninja.