cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: static link libcurl with VS2010 causes crash

From: svante karlsson <saka_at_csi.se>
Date: Sun, 13 May 2012 10:53:30 +0200

I'm not sure it helps you but I build curl static like this with a bat
file. (I use cmake as my main build env)
It runs https posts just fine

I also have openssl inside my main project directory - you have to
change accordingly

one of the vsvars32.bat lines will fail depening on 32 or 64 bit win7,
and I think the nasm line is a leftover since I don't think curl uses
it.

#wget http://curl.haxx.se/download/curl-7.25.0.tar.gz
#gunzip curl-7.25.0.tar.gz
#tar -xvf curl-7.25.0.tar

set OPEN_SSL_VERSION=openssl-1.0.0d
call "C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\vsvars32.bat"
call "C:\Program Files (x86)\Microsoft Visual Studio
10.0\Common7\Tools\vsvars32.bat"
set PATH=%PATH%;"C:\Program Files\nasm"

cd curl-7.25.0
cd winbuild
SET INCLUDE=%INCLUDE%;..\..\%OPEN_SSL_VERSION%\include;..\include;..\..\%OPEN_SSL_VERSION%\include\openssl
SET LIB=%LIB%;..\..\%OPEN_SSL_VERSION%\out32dll
nmake /f makefile.vc mode=static VC=10 WITH_SSL=dll ENABLE_IDN=no DEBUG=yes
nmake /f makefile.vc mode=static VC=10 WITH_SSL=dll ENABLE_IDN=no DEBUG=no
cd ..
cd ..

you also need the following define before including curl.h
#define CURL_STATICLIB

finally I link with (CMAKE SYNTAX)
SET(CURL_PATH ${CMAKE_SOURCE_DIR}/libraries/curl-7.25.0)
SET(CURL_BUILDNAME libcurl-$(ConfigurationName)-static-ssl-dll-ipv6-sspi)
SET(CURL_LIB_PATH ${CURL_PATH}/builds/${CURL_BUILDNAME}/lib)
link_directories(${BOOST_PATH}/stage/lib ${OPENSSL_PATH}/lib
${CMAKE_SOURCE_DIR}/libraries/lib ${CURL_LIB_PATH}
${CRYPTOPP_LIB_PATH})

basically it boils down to
libraries\curl-7.25.0\builds\libcurl-debug-static-ssl-dll-ipv6-sspi\lib\libcurl_a_debug.lib
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-05-13