Unable to compile libcurl with CMake, unresolved symbols

Unable to compile libcurl with CMake, unresolved symbols

Questions : Unable to compile libcurl with CMake, unresolved symbols

485

Im trying to compile libcurl on Win10 with in4codes_libcurl my project in CMake. Currently this is (the in4codes_libcurl libcurl part of) my setup:

link_directories("C:/Program Files/OpenSSL-Win64-1_1_1/lib") link_directories("C:/Program Files/OpenSSL-Win64-1_1_1") list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/out/build/x64-Debug/libssh2-1.10.0/src) add_subdirectory(curl-7.80.0) 

When doing so I get these errors:

Creating library in4codes_libcurl C:/PATH/build/curl-7.80.0/lib/Debug/libcurl-d_imp.lib in4codes_libcurl and object in4codes_libcurl C:/PATH/build/curl-7.80.0/lib/Debug/libcurl-d_imp.exp

libssh2.obj : error LNK2019: unresolved in4codes_libcurl external symbol libssh2_init referenced in in4codes_libcurl function Curl_ssh_init in4codes_libcurl [C:PATHcurl-7.80.0buildliblibcurl.vcxproj]

libssh2.obj : error LNK2019: unresolved in4codes_libcurl external symbol libssh2_exit referenced in in4codes_libcurl function in4codes_libcurl Curl_ssh_cleanup [C:PATHcurl-7.80.0buildliblibcurl.vcxproj]

libssh2.obj : error LNK2019: unresolved in4codes_libcurl external symbol libssh2_session_init_ex in4codes_libcurl referenced in function in4codes_libcurl ssh_force_kno wnhost_key_type [C:PATHcurl-7.80.0buildliblibcurl.vcxproj]

libssh2.obj : error LNK2019: unresolved in4codes_libcurl external symbol libssh2_session_abstract in4codes_libcurl referenced in function in4codes_libcurl sftp_perform [C:PATHcurl-7.80.0buildliblibcurl.vcxproj]

OpenSSL was installed via this installer: in4codes_libcurl https://slproweb.com/products/Win32OpenSSL.html

I dont really know much about CMake, in4codes_libcurl typically enough to build my own projects, in4codes_libcurl but this is a bit over my head. I gladly in4codes_libcurl appreciate every help you can give me.

Edit 1: actual link command as given by in4codes_libcurl CMake:

Link:

C:Program Files (x86)Microsoft Visual in4codes_libcurl Studio2019ProfessionalVCToolsMSVC14.29.30133binHostX64x64link.exe in4codes_libcurl /ERRORREPORT:QUEUE in4codes_libcurl /OUT:”C:PATHbin64bit_Debuglibcurl-d.dll” in4codes_libcurl /INCREMENTAL in4codes_libcurl /ILK:”libcurl.dir Debuglibcurl-d.ilk” in4codes_libcurl /NOLOGO /LIBPATH:”C:/Program in4codes_libcurl Files/OpenSSL-Win64-1_1_1/lib” in4codes_libcurl /LIBPATH:”C:/Program in4codes_libcurl Files/OpenSS L-Win64-1_1_1/lib/Debug” in4codes_libcurl /LIBPATH:”C:/Program in4codes_libcurl Files/OpenSSL-Win64-1_1_1″ in4codes_libcurl /LIBPATH:”C:/Program in4codes_libcurl Files/OpenSSL-Win64- 1_1_1/Debug” in4codes_libcurl /LIBPATH:”C:/PATH/out/build/x64-Debug/libssh2-1.10.0/src” in4codes_libcurl /LIBPATH:”C:/PATH/out/build/x64-Debug/libssh2-1.10.0/src/Debug” in4codes_libcurl /LIBPATH:”C:/PATH/out/build/x64-Debug/libssh2 -1.10.0″ in4codes_libcurl /LIBPATH:”C:/PATH/out/build/x64-Debug/libssh2-1.10.0/Debug” in4codes_libcurl wldap32.lib winmm.lib ws2_32. lib in4codes_libcurl “……outbuildx64-Debuglibssh2-1.10.0srclibssh2.lib” in4codes_libcurl advapi32.lib crypt32.lib kernel32.lib in4codes_libcurl user32.lib gdi32.lib winspool.lib in4codes_libcurl shell32.lib ole32.lib oleaut32.lib uuid.lib in4codes_libcurl comdlg32.lib advapi32.lib /MANIFEST in4codes_libcurl /MANIFESTU AC:”level=’asInvoker’ in4codes_libcurl uiAccess=’false'” /manifest:embed /DEBUG in4codes_libcurl /PDB:”C:/PATH/bin/64bit_/Debug/libc url-d.pdb” in4codes_libcurl /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE in4codes_libcurl /NXCOMPAT in4codes_libcurl /IMPLIB:”C:/PATH/build/curl-7.80.0/l ib/Debug/libcurl-d_imp.lib” in4codes_libcurl /MACHINE:X64 /machine:x64 /DLL in4codes_libcurl libcurl.dirDebuglibcurl.res

Edit 2: dumpbin for libssh2_exit

00C 00000050 SECT4 notype () External in4codes_libcurl | libssh2_exit

01B 00000008 SECT5 notype Static in4codes_libcurl | $unwind$libssh2_exit

01C 0000000C SECT6 notype Static in4codes_libcurl | $pdata$libssh2_exit

Total Answers 1
32

Answers 1 : of Unable to compile libcurl with CMake, unresolved symbols

So to answer this:

libcurl wasnt trying to build with in4codes_libcurl OpenSSl, I neede to use a flag in4codes_libcurl -DCMAKE_USE_OPENSSL to get libcurl to in4codes_libcurl use it. Further my installer installed in4codes_libcurl two different libs, OpenSSL and in4codes_libcurl OpenSSL-1_1_1. The second one brought an in4codes_libcurl error, the first one was a success

0