I am trying to build libCurl x64 on Windows 8.1 x64 and I am having linker errors. I need to be able to do this as I need to create a 64 bit debug version of the library so that I can trace some strange FTP related protocol issues I am encountering.
The fundamental error output (trimmed for brevity) is as follows
1>------ Build started: Project: ZERO_CHECK, Configuration: Debug x64
...
2>C:\Users\jcoffey\main\extlibs\curl-7.35.0\lib\smtp.c(2174): warning C4267: '+=' : conversion from 'size_t' to 'long', possible loss of data 2> pingpong.c 2> rtsp.c 2> curl_threads.c 2> warnless.c 2> hmac.c 2> curl_rtmp.c 2> openldap.c 2> curl_gethostname.c 2> gopher.c 2> Generating Code... 2> Compiling... 2> idn_win32.c 2> http_negotiate_sspi.c 2> http_proxy.c 2> non-ascii.c 2> asyn-ares.c 2> asyn-thread.c 2> curl_gssapi.c 2> curl_ntlm.c 2> curl_ntlm_wb.c 2> curl_ntlm_core.c 2> curl_ntlm_msgs.c 2> curl_sasl.c 2> curl_multibyte.c 2> hostcheck.c 2> bundles.c 2> conncache.c 2> pipeline.c 2> dotdot.c 2> x509asn1.c 2> http2.c 2> Generating Code... 2> Compiling... 2> openssl.c 2> gtls.c 2> vtls.c 2> nss.c 2> qssl.c 2> polarssl.c 2> polarssl_threadlock.c 2> axtls.c 2> cyassl.c 2> curl_schannel.c 2> curl_darwinssl.c 2> gskit.c 2> Generating Code...
...
2>x64\Debug\file.obj : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' 3>------ Build started: Project: curl, Configuration: Debug x64 ------ 3> Building Custom Rule C:/Users/jcoffey/main/extlibs/curl-7.35.0/src/CMakeLists.txt
Please help - I have searched the forums and stackoverflow for something similar but to no avail. I was able to successfully build in x86 (win32) mode but I am having linkage errors when I target x64.
Step 1: Download latest CMake 2.8.12.2 & update the Windows PATH environment (in my case I am using the MINMGW32 bash shell prompt, but I get exactly the same linkage problems if I use the native visual studio 2013 x64 shell to run cmake from)
$ export PATH=$PATH:/c/Program\ Files\ (x86)/CMake\ 2.8/bin
verify that the path and version of Cmake on windows
$ cmake --version cmake version 2.8.12.2
Step 2: extract curl-7.35.0 into a folder c:\temp\curl-7.35.0" and make a parallel folder "c:\temp\curl-7.35.0\build".
Step 3: Change into the build folder and run Cmake targeting "Visual Studio 12" as the desired Visual Studio Solution/project combination to create
$ cmake -G "Visual Studio 12" ../curl-7.35.0
This produces a ton of output as follows, but it does also create a workable visual studio solution targeted for a machine type X86.
$ cmake -G "Visual Studio 12" ../curl-7.35.0 -- The C compiler identification is MSVC 18.0.21005.1 -- Check for working C compiler using: Visual Studio 12 -- Check for working C compiler using: Visual Studio 12 -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done CMake Warning at CMakeLists.txt:47 (message): the curl cmake build system is poorly maintained. Be aware
-- curl version=[7.35.0] -- Looking for getch in ws2_32; -- Looking for getch in ws2_32; - found -- Looking for getch in winmm;ws2_32 -- Looking for getch in winmm;ws2_32 - found -- Looking for cldap_open in wldap32 -- Looking for cldap_open in wldap32 - found -- Looking for idna_to_ascii_lz in idn;winmm;ws2_32 -- Looking for idna_to_ascii_lz in idn;winmm;ws2_32 - not found -- Looking for ldap_init in ldap;winmm;ws2_32 -- Looking for ldap_init in ldap;winmm;ws2_32 - not found -- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the sys tem variable OPENSSL_ROOT_DIR (missing: OPENSSL_LIBRARIES OPENSSL_INCLUDE_DIR)
-- Looking for include file ws2tcpip.h -- Looking for include file ws2tcpip.h - found -- Looking for include files ws2tcpip.h, winsock2.h -- Looking for include files ws2tcpip.h, winsock2.h - found -- Looking for 3 include files ws2tcpip.h, ..., stdio.h -- Looking for 3 include files ws2tcpip.h, ..., stdio.h - found -- Looking for 4 include files ws2tcpip.h, ..., windows.h -- Looking for 4 include files ws2tcpip.h, ..., windows.h - found -- Looking for 5 include files ws2tcpip.h, ..., winsock.h -- Looking for 5 include files ws2tcpip.h, ..., winsock.h - found -- Looking for 6 include files ws2tcpip.h, ..., sys/filio.h -- Looking for 6 include files ws2tcpip.h, ..., sys/filio.h - not found -- Looking for 6 include files ws2tcpip.h, ..., sys/ioctl.h -- Looking for 6 include files ws2tcpip.h, ..., sys/ioctl.h - not found -- Looking for 6 include files ws2tcpip.h, ..., sys/resource.h -- Looking for 6 include files ws2tcpip.h, ..., sys/resource.h - not found -- Looking for 8 include files ws2tcpip.h, ..., sys/uio.h -- Looking for 8 include files ws2tcpip.h, ..., sys/uio.h - not found -- Looking for 8 include files ws2tcpip.h, ..., sys/un.h -- Looking for 8 include files ws2tcpip.h, ..., sys/un.h - not found -- Looking for 9 include files ws2tcpip.h, ..., arpa/tftp.h -- Looking for 9 include files ws2tcpip.h, ..., arpa/tftp.h - not found -- Looking for 9 include files ws2tcpip.h, ..., assert.h -- Looking for 9 include files ws2tcpip.h, ..., assert.h - found -- Looking for 10 include files ws2tcpip.h, ..., crypto.h -- Looking for 10 include files ws2tcpip.h, ..., crypto.h - not found -- Looking for 10 include files ws2tcpip.h, ..., des.h -- Looking for 10 include files ws2tcpip.h, ..., des.h - not found -- Looking for 10 include files ws2tcpip.h, ..., err.h -- Looking for 10 include files ws2tcpip.h, ..., err.h - not found -- Looking for 10 include files ws2tcpip.h, ..., errno.h -- Looking for 10 include files ws2tcpip.h, ..., errno.h - found -- Looking for 12 include files ws2tcpip.h, ..., gssapi/gssapi.h -- Looking for 12 include files ws2tcpip.h, ..., gssapi/gssapi.h - not found -- Looking for 12 include files ws2tcpip.h, ..., gssapi/gssapi_generic.h -- Looking for 12 include files ws2tcpip.h, ..., gssapi/gssapi_generic.h - not f ound -- Looking for 12 include files ws2tcpip.h, ..., gssapi/gssapi_krb5.h -- Looking for 12 include files ws2tcpip.h, ..., gssapi/gssapi_krb5.h - not foun d -- Looking for 12 include files ws2tcpip.h, ..., idn-free.h -- Looking for 12 include files ws2tcpip.h, ..., idn-free.h - not found -- Looking for 12 include files ws2tcpip.h, ..., ifaddrs.h -- Looking for 12 include files ws2tcpip.h, ..., ifaddrs.h - not found -- Looking for 13 include files ws2tcpip.h, ..., krb.h -- Looking for 13 include files ws2tcpip.h, ..., krb.h - not found -- Looking for 13 include files ws2tcpip.h, ..., libgen.h -- Looking for 13 include files ws2tcpip.h, ..., libgen.h - not found -- Looking for 13 include files ws2tcpip.h, ..., libssh2.h -- Looking for 13 include files ws2tcpip.h, ..., libssh2.h - not found -- Looking for 13 include files ws2tcpip.h, ..., limits.h -- Looking for 13 include files ws2tcpip.h, ..., limits.h - found -- Looking for 14 include files ws2tcpip.h, ..., locale.h -- Looking for 14 include files ws2tcpip.h, ..., locale.h - found -- Looking for 15 include files ws2tcpip.h, ..., netinet/tcp.h -- Looking for 15 include files ws2tcpip.h, ..., netinet/tcp.h - not found -- Looking for 15 include files ws2tcpip.h, ..., pem.h -- Looking for 15 include files ws2tcpip.h, ..., pem.h - not found -- Looking for 15 include files ws2tcpip.h, ..., poll.h -- Looking for 15 include files ws2tcpip.h, ..., poll.h - not found -- Looking for 15 include files ws2tcpip.h, ..., rsa.h -- Looking for 15 include files ws2tcpip.h, ..., rsa.h - not found -- Looking for 17 include files ws2tcpip.h, ..., ssl.h -- Looking for 17 include files ws2tcpip.h, ..., ssl.h - not found -- Looking for 17 include files ws2tcpip.h, ..., stdbool.h -- Looking for 17 include files ws2tcpip.h, ..., stdbool.h - found -- Looking for 21 include files ws2tcpip.h, ..., stropts.h -- Looking for 21 include files ws2tcpip.h, ..., stropts.h - not found -- Looking for 22 include files ws2tcpip.h, ..., tld.h -- Looking for 22 include files ws2tcpip.h, ..., tld.h - not found -- Looking for 23 include files ws2tcpip.h, ..., stddef.h -- Looking for 23 include files ws2tcpip.h, ..., stddef.h - found -- Looking for 26 include files ws2tcpip.h, ..., ldap.h -- Looking for 26 include files ws2tcpip.h, ..., ldap.h - not found -- Looking for 26 include files ws2tcpip.h, ..., sys/utsname.h -- Looking for 26 include files ws2tcpip.h, ..., sys/utsname.h - not found -- Looking for 26 include files ws2tcpip.h, ..., idna.h -- Looking for 26 include files ws2tcpip.h, ..., idna.h - not found -- LDAP_H not found CURL_DISABLE_LDAP set ON -- LDAP needs to be enabled to support LDAPS -- Check size of size_t -- Check size of size_t - done -- Check size of ssize_t -- Check size of ssize_t - failed -- Check size of long long -- Check size of long long - done -- Check size of long -- Check size of long - done -- Check size of short -- Check size of short - done -- Check size of int -- Check size of int - done -- Check size of __int64 -- Check size of __int64 - done -- Check size of time_t -- Check size of time_t - done -- Looking for basename -- Looking for basename - not found -- Looking for strncmpi -- Looking for strncmpi - not found -- Looking for alarm -- Looking for alarm - not found -- Looking for CRYPTO_cleanup_all_ex_data -- Looking for CRYPTO_cleanup_all_ex_data - not found -- Looking for gethostbyname -- Looking for gethostbyname - found -- Looking for strtoll -- Looking for strtoll - found -- Looking for _strtoi64 -- Looking for _strtoi64 - found -- Looking for strerror_r -- Looking for strerror_r - not found -- Looking for siginterrupt -- Looking for siginterrupt - not found -- Looking for fork -- Looking for fork - not found -- Looking for freeaddrinfo -- Looking for freeaddrinfo - found -- Looking for freeifaddrs -- Looking for freeifaddrs - not found -- Looking for pipe -- Looking for pipe - not found -- Looking for ftruncate -- Looking for ftruncate - not found -- Looking for getprotobyname -- Looking for getprotobyname - found -- Looking for getrlimit -- Looking for getrlimit - not found -- Looking for idn_free -- Looking for idn_free - not found -- Looking for idna_strerror -- Looking for idna_strerror - not found -- Looking for tld_strerror -- Looking for tld_strerror - not found -- Looking for setlocale -- Looking for setlocale - found -- Looking for setrlimit -- Looking for setrlimit - not found -- Looking for fcntl -- Looking for fcntl - not found -- Looking for ioctl -- Looking for ioctl - not found -- Looking for setsockopt -- Looking for setsockopt - found -- Looking for inet_pton -- Looking for inet_pton - not found -- Performing Curl Test HAVE_FCNTL_O_NONBLOCK -- Performing Curl Test HAVE_FCNTL_O_NONBLOCK - Failed -- Performing Curl Test HAVE_IOCTLSOCKET -- Performing Curl Test HAVE_IOCTLSOCKET - Success -- Performing Curl Test HAVE_IOCTLSOCKET_CAMEL -- Performing Curl Test HAVE_IOCTLSOCKET_CAMEL - Failed -- Performing Curl Test HAVE_IOCTLSOCKET_CAMEL_FIONBIO -- Performing Curl Test HAVE_IOCTLSOCKET_CAMEL_FIONBIO - Success -- Performing Curl Test HAVE_IOCTLSOCKET_FIONBIO -- Performing Curl Test HAVE_IOCTLSOCKET_FIONBIO - Success -- Performing Curl Test HAVE_IOCTL_FIONBIO -- Performing Curl Test HAVE_IOCTL_FIONBIO - Failed -- Performing Curl Test HAVE_IOCTL_SIOCGIFADDR -- Performing Curl Test HAVE_IOCTL_SIOCGIFADDR - Failed -- Performing Curl Test HAVE_SETSOCKOPT_SO_NONBLOCK -- Performing Curl Test HAVE_SETSOCKOPT_SO_NONBLOCK - Failed -- Performing Curl Test HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID -- Performing Curl Test HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID - Failed -- Performing Curl Test HAVE_SOCKLEN_T -- Performing Curl Test HAVE_SOCKLEN_T - Success -- Performing Curl Test HAVE_BOOL_T -- Performing Curl Test HAVE_BOOL_T - Success -- Performing Curl Test HAVE_FILE_OFFSET_BITS -- Performing Curl Test HAVE_FILE_OFFSET_BITS - Failed -- Performing Curl Test HAVE_GLIBC_STRERROR_R -- Performing Curl Test HAVE_GLIBC_STRERROR_R - Failed -- Performing Curl Test HAVE_POSIX_STRERROR_R -- Performing Curl Test HAVE_POSIX_STRERROR_R - Failed -- Check size of curl_off_t -- Check size of curl_off_t - failed -- Check size of socklen_t -- Check size of socklen_t - done -- Performing Test curl_cv_recv -- Performing Test curl_cv_recv - Success -- Performing Test int recv(int, void *, size_t, int) (curl_cv_func_recv_test) -- Performing Test int recv(int, void *, size_t, int) (curl_cv_func_recv_test) - Success -- Performing Test curl_cv_send -- Performing Test curl_cv_send - Success -- Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_t est) -- Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_t est) - Success -- Performing Test HAVE_MSG_NOSIGNAL -- Performing Test HAVE_MSG_NOSIGNAL - Failed -- Performing Test HAVE_STRUCT_TIMEVAL -- Performing Test HAVE_STRUCT_TIMEVAL - Success -- Performing Test HAVE_POLL_FINE -- Performing Test HAVE_POLL_FINE - Failed -- Check size of sig_atomic_t -- Check size of sig_atomic_t - done -- Performing Test HAVE_SIG_ATOMIC_T_NOT_VOLATILE -- Performing Test HAVE_SIG_ATOMIC_T_NOT_VOLATILE - Success -- Check size of struct sockaddr_storage -- Check size of struct sockaddr_storage - failed CMake Warning (dev) at tests/CMakeLists.txt:1 (add_subdirectory): The source directory
C:/Users/jcoffey/main/extlibs/curl-7.35.0/tests/libtest
does not contain a CMakeLists.txt file.
CMake does not support this case but it used to work accidentally and is being allowed for compatibility.
Policy CMP0014 is not set: Input directories must have CMakeLists.txt. Run "cmake --help-policy CMP0014" for policy details. Use the cmake_policy command to set the policy and suppress this warning. This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at tests/CMakeLists.txt:2 (add_subdirectory):
The source directoryC:/Users/jcoffey/main/extlibs/curl-7.35.0/tests/server
does not contain a CMakeLists.txt file.
CMake does not support this case but it used to work accidentally and is being allowed for compatibility.
Policy CMP0014 is not set: Input directories must have CMakeLists.txt. Run "cmake --help-policy CMP0014" for policy details. Use the cmake_policy command to set the policy and suppress this warning. This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring done -- Generating done -- Build files have been written to: C:/Users/jcoffey/main/extlibs/curl-7.35.0-build
Step 4: Within Visual Studio change the target type to x64 using the configuration manager (where I had to select a new platform and I selected X64 and copied the settings from Win32). This is a pretty straight forward step that is used to target an X64 machine target, so as not to confuse, I have not included the step by step details here.
Step 5 Select the solution and rebuild all from Visual Studio 2013 and the output above will ensue.
Side note: Although I do not really need SSL for now, it would be nice to know how to tell CMake where the location of the LIBSSL things are located (I downloaded a package of pre-built libraries (both 32 and 64 bit including the SSL and other libraries) from http://www.confusedbycode.com/curl/, however these are release mode and I need to be able to debug libCurl to see what is going on with some strange problems I am encountering. I am a newbie when it comes to configuring CMake however it looks to be a really promising tool for those of us that target multiple platforms but prefer to develop on windows. It certainly is easier than the gnu autotools.