Libcurl Static Compilation

Source: Internet
Author: User
libcurl Static Compilation First, prepareCurl source code download, currently using the "Curl-curl-7_53_1.zip" version, the compiler uses VS2015 Second, compilingOpen the VS2015 Developer command prompt, and the CD enters the curl-curl-7_53_1/winbuild/directory vs. generate code there is a runtime option (Project Properties-Configuration Properties-C + +-code generation-Runtime)/MT and/MD (/MTD and/MDD is the corresponding version of Debug)
nmake/f makefile.vc mode=static vc=14 rtlibcfg=static

That is, if you compile with rtlibcfg=static this option, it is equivalent to compiling the/MT version of the Libcurl, otherwise/MD version of the completion of the Libcurl Static library will appear in the Builds directory including header files and Libcurl_ A.lib, what we need is builds/libcurl-vc14-x86-release-static the following include and Lib two folders three, configuration options

nmake/f makefile.vc mode=<static or dll> <options> where <options> is one or many of:vc=<6,7,8,9 ,10,11,12,14>-VC versions with_devel=<path>-Paths for the development files (SSL, zlib, etc. ) Defaults to sibbling directory Deps:..
                                 /deps libraries can be fetched at http://windows.php.net/downloads/php-sdk/deps/
  Uncompress them into the Deps folder. With_ssl=<dll or static>-enable OpenSSL support, DLL or static with_mbedtls=<dll or static>-enable M BEDTLS support, DLL or static with_cares=<dll or static>-Enable c-ares support, dll or static with_zlib=< DLL or static>-enable zlib support, DLL or static with_ssh2=<dll or static>-enable libSSH2 support, D      LL or static enable_sspi=<yes or no>-ENABLE SSPI support, defaults to Yes Enable_ipv6=<yes or no> -ENable IPv6, defaults to Yes Enable_idn=<yes or no>-ENABLE with Windows IDN APIs, defaults to Yes Requires Windows Vista or later, or installation from:https:// Www.microsoft.com/downloads/details.aspx? familyid=ad6158d7-ddba-416a-9109-07607425a815 Enable_winssl=<yes or no>-ENABLE native Windows SSL support, DE Faults to Yes Gen_pdb=<yes or no>-Generate program Database (debug symbols for release build) debug=& Lt;yes or no>-Debug builds machine=<x86 or x64>-Target architecture (default is x86)
Thin configuration
nmake/f makefile.vc mode=static vc=14 rtlibcfg=static enable_ipv6=no enable_winssl=no ENABLE_SSPI=no
Iv. Matters of noteNote the static library path and file name. Call Project note Code generation mode is MT。 Increase ws2_32.lib,wldap32.lib to solve TCP communication problems

Add predefined macros Building_libcurl and http_onlyto resolve an extern function declaration problem, otherwise a dynamic library function name.

Do not know why use curl_ststiclib macros not, version problem.

If the project uses VS2013 compilation, the following error occurs using the VS2015 call, and the Libcurl source code is compiled using the corresponding VS version. (VC12 corresponds to vs2013, VC14 corresponds to VS2015).

Error LNK2019: unresolved external symbols __iob_func the compile-Library problem and solution under XP the above method is not problematic in the Win7 and above system versions, but there is a problem with the dependencies on the XP system.
Pop-up missing Normaliz.dll library prompt, which causes the program to not open even if the Normaliz.dll Library is added, an interface locator error occurs. The root cause is still the two windows functions called in Libcurl:idntounicode, idntoascii encapsulated in Normaliz.dll , This library was not prepared for Windows XP at first, but only later after SP2. Workaround:
Modify the curl_folder\lib\idn_win32.c source code and recompile.
Reference Links: http://www.cnblogs.com/passedbylove/p/5979927.html To this step, however, there will still be problems with XP: Libcurl in the XP call report GetTickCount64 unresolved solution

Solution Link: http://blog.csdn.net/he_fly/article/details/53116180

"Summary based on the above steps" 1. Modify the Libcurl library in the curl_folder/lib/ directory idn_win32.c and config-win32.h source code. 2. Compile the Libcurl library, complete the compilation command as follows:

nmake/f makefile.vc mode=static vc=14 rtlibcfg=static enable_ipv6=no enable_winssl=no ENABLE_SSPI=no ENABLE_IDN=no

Enable_idn=no: The build library size is also reduced without using the Windows Raw Library. If the source code does not change, the library generated in this way cannot be compiled through the project. Reference link http://www.cnblogs.com/jkcx/p/6406706.html http://www.cnblogs.com/passedbylove/p/5979927. HTML http://blog.csdn.net/he_fly/article/details/53116180 Compile library download http://download.csdn.net/ download/amosfeng/10041408

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.