binary package. This document describes how to compile, build and install
curl and libcurl from source code.
+Building from git
+=================
+
+ If you get your code off a git repository, see the GIT-INFO file in the
+ root directory for specific instructions on how to proceed.
+
UNIX
====
A normal unix installation is made in three or four steps (after you've
You probably need to be root when doing the last command.
- If you have checked out the sources from the CVS repository, read the
- CVS-INFO on how to proceed.
+ If you have checked out the sources from the git repository, read the
+ GIT-INFO on how to proceed.
Get a full listing of all available configure options by invoking it like:
./configure --disable-thread
- To build curl with kerberos4 support enabled, curl requires the krb4 libs
- and headers installed. You can then use a set of options to tell
- configure where those are:
-
- --with-krb4-includes[=DIR] Specify location of kerberos4 headers
- --with-krb4-libs[=DIR] Specify location of kerberos4 libs
- --with-krb4[=DIR] where to look for Kerberos4
-
- In most cases, /usr/athena is the install prefix and then it works with
-
- ./configure --with-krb4=/usr/athena
-
If you're a curl developer and use gcc, you might want to enable more
debug options with the --enable-debug option.
default. But if you want to alter it, you can select how to deal with
each individual library.
- To build with GnuTLS support instead of OpenSSL for SSL/TLS, note that
- you need to use both --without-ssl and --with-gnutls.
+ To build with GnuTLS for SSL/TLS, use both --without-ssl and
+ --with-gnutls.
- To build with yassl support instead of OpenSSL or GnuTLS, you must build
- yassl with its OpenSSL emulation enabled and point to that directory root
- with configure --with-ssl.
+ To build with Cyassl for SSL/TLS, use both --without-ssl and
+ --with-cyassl.
- To build with NSS support instead of OpenSSL for SSL/TLS, note that
- you need to use both --without-ssl and --with-nss.
+ To build with NSS for SSL/TLS, use both --without-ssl and --with-nss.
+
+ To build with PolarSSL for SSL/TLS, use both --without-ssl and
+ --with-polarssl.
+
+ To build with axTLS for SSL/TLS, use both --without-ssl and --with-axtls.
To get GSSAPI support, build with --with-gssapi and have the MIT or
Heimdal Kerberos 5 packages installed.
To get support for SCP and SFTP, build with --with-libssh2 and have
libssh2 0.16 or later installed.
-
+
+ To get Metalink support, build with --with-libmetalink and have the
+ libmetalink packages installed.
+
SPECIAL CASES
-------------
Some versions of uClibc require configuring with CPPFLAGS=-D_GNU_SOURCE=1
first to rebuild every single library your app uses as well as your
app using the debug multithreaded dynamic C runtime.
+ If you get linkage errors read section 5.7 of the FAQ document.
+
+
MingW32
-------
If you have any problems linking libraries or finding header files, be sure
to verify that the provided "Makefile.m32" files use the proper paths, and
- adjust as necessary. It is also possible to override these paths with
+ adjust as necessary. It is also possible to override these paths with
environment variables, for example:
- set ZLIB_PATH=c:\zlib-1.2.3
- set OPENSSL_PATH=c:\openssl-0.9.8k
- set LIBSSH2_PATH=c:\libssh2-1.1
+ set ZLIB_PATH=c:\zlib-1.2.8
+ set OPENSSL_PATH=c:\openssl-0.9.8y
+ set LIBSSH2_PATH=c:\libssh2-1.4.3
ATTENTION: if you want to build with libssh2 support you have to use latest
version 0.17 - previous versions will NOT work with 7.17.0 and later!
If you want to enable LDAPS support then set LDAPS=1.
- - optional MingW32-built OpenlDAP SDK available from:
+ - optional MingW32-built OpenLDAP SDK available from:
http://www.gknw.net/mirror/openldap/
- optional recent Novell CLDAP SDK available from:
http://developer.novell.com/ndk/cldap.htm
MSVC 6 caveats
--------------
- If you use MSVC 6 it is required that you use the February 2003 edition PSDK:
- http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm
+ If you use MSVC 6 it is required that you use the February 2003 edition of
+ the 'Platform SDK' which can be downloaded from:
+
+ http://www.microsoft.com/en-us/download/details.aspx?id=12261
Building any software with MSVC 6 without having PSDK installed is just
asking for trouble down the road once you have released it, you might notice
choice of static vs dynamic runtime and third party libraries. Anyone using
software built in such way will at some point regret having done so.
- When someone uses MSVC 6 without PSDK he is using a compiler back from 1998.
-
If the compiler has been updated with the installation of a service pack as
those mentioned in http://support.microsoft.com/kb/194022 the compiler can be
safely used to read source code, translate and make it object code.
header files and libraries with bugs and security issues which have already
been addressed and fixed long time ago.
- In order to make use of the updated system headers and fixed libraries
- for MSVC 6, it is required that 'Platform SDK', PSDK from now onwards,
- is installed. The specific PSDK that must be installed for MSVC 6 is the
- February 2003 edition, which is the latest one supporting the MSVC 6 compiler,
- this PSDK is also known as 'Windows Server 2003 PSDK' and can be downloaded
- from http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm
-
So, building curl and libcurl with MSVC 6 without PSDK is absolutely
discouraged for the benefit of anyone using software built in such
environment. And it will not be supported in any way, as we could just
documentation on how to compile zlib. Define the ZLIB_PATH environment
variable to the location of zlib.h and zlib.lib, for example:
- set ZLIB_PATH=c:\zlib-1.2.3
+ set ZLIB_PATH=c:\zlib-1.2.8
Then run 'nmake vc-zlib' in curl's root directory.
Before running nmake define the OPENSSL_PATH environment variable with
the root/base directory of OpenSSL, for example:
- set OPENSSL_PATH=c:\openssl-0.9.8k
+ set OPENSSL_PATH=c:\openssl-0.9.8y
Then run 'nmake vc-ssl' or 'nmake vc-ssl-dll' in curl's root
directory. 'nmake vc-ssl' will create a libcurl static and dynamic
at runtime.
Run 'nmake vc-ssl-zlib' to build with both ssl and zlib support.
- MSVC 6 IDE
- ----------
+ MSVC IDE
+ --------
- A minimal VC++ 6.0 reference workspace (vc6curl.dsw) is available with the
- source distribution archive to allow proper building of the two included
- projects, the libcurl library and the curl tool.
+ A fairly comprehensive set of Visual Studio project files are available for
+ v6.0 through v12.0 and are located in the projects folder to allow proper
+ building of both the libcurl library as well as the curl tool.
- 1) Open the vc6curl.dsw workspace with MSVC6's IDE.
- 2) Select 'Build' from top menu.
- 3) Select 'Batch Build' from dropdown menu.
- 4) Make sure that the eight project configurations are 'checked'.
- 5) Click on the 'Build' button.
- 6) Once the eight project configurations are built you are done.
+ For more information about these projects and building via Visual Studio
+ please see the README file located in the projects folder.
- Dynamic and static libcurl libraries are built in debug and release flavours,
- and can be located each one in its own subdirectory, DLL-Debug, DLL-Release,
- LIB-Debug and LIB-Release, all of them below the 'lib' subdirectory.
+ Borland C++ compiler
+ --------------------
- In the same way four curl executables are created, each using its respective
- library. The resulting curl executables are located in its own subdirectory,
- DLL-Debug, DLL-Release, LIB-Debug and LIB-Release, below the 'src' subdir.
+ Ensure that your build environment is properly set up to use the compiler
+ and associated tools. PATH environment variable must include the path to
+ bin subdirectory of your compiler installation, eg: c:\Borland\BCC55\bin
- These reference VC++ 6.0 configurations are generated using the dynamic CRT.
+ It is advisable to set environment variable BCCDIR to the base path of
+ the compiler installation.
- Intentionally, these reference VC++ 6.0 projects and configurations don't use
- third party libraries, such as OpenSSL or Zlib, to allow proper compilation
- and configuration for all new users without further requirements.
+ set BCCDIR=c:\Borland\BCC55
- If you need something more 'involved' you might adjust them for your own use,
- or explore the world of makefiles described above 'MSVC from command line'.
+ In order to build a plain vanilla version of curl and libcurl run the
+ following command from curl's root directory:
- Borland C++ compiler
- ---------------------
+ make borland
+
+ To build curl and libcurl with zlib and OpenSSL support set environment
+ variables ZLIB_PATH and OPENSSL_PATH to the base subdirectories of the
+ already built zlib and OpenSSL libraries and from curl's root directory
+ run command:
- compile openssl
+ make borland-ssl-zlib
- Make sure you include the paths to curl/include and openssl/inc32 in
- your bcc32.cnf file
+ libcurl library will be built in 'lib' subdirectory while curl tool
+ is built in 'src' subdirectory. In order to use libcurl library it is
+ advisable to modify compiler's configuration file bcc32.cfg located
+ in c:\Borland\BCC55\bin to reflect the location of libraries include
+ paths for example the '-I' line could result in something like:
- eg : -I"c:\Bcc55\include;c:\path_curl\include;c:\path_openssl\inc32"
+ -I"c:\Borland\BCC55\include;c:\curl\include;c:\openssl\inc32"
- Check to make sure that all of the sources listed in lib/Makefile.b32
- are present in the /path_to_curl/lib directory. (Check the src
- directory for missing ones.)
+ bcc3.cfg '-L' line could also be modified to reflect the location of
+ of libcurl library resulting for example:
- Make sure the environment variable "BCCDIR" is set to the install
- location for the compiler eg : c:\Borland\BCC55
+ -L"c:\Borland\BCC55\lib;c:\curl\lib;c:\openssl\out32"
- command line:
- make -f /path_to_curl/lib/Makefile-ssl.b32
+ In order to build sample program 'simple.c' from the docs\examples
+ subdirectory run following command from mentioned subdirectory:
- compile simplessl.c with appropriate links
+ bcc32 simple.c libcurl.lib cw32mt.lib
+
+ In order to build sample program simplessl.c an SSL enabled libcurl
+ is required, as well as the OpenSSL libeay32.lib and ssleay32.lib
+ libraries.
- c:\curl\docs\examples\> bcc32 -L c:\path_to_curl\lib\libcurl.lib
- -L c:\borland\bcc55\lib\psdk\ws2_32.lib
- -L c:\openssl\out32\libeay32.lib
- -L c:\openssl\out32\ssleay32.lib
- simplessl.c
OTHER MSVC IDEs
---------------
possibilities:
- Modify lib/config-win32.h
- - Modify lib/setup.h
+ - Modify lib/curl_setup.h
- Modify lib/Makefile.vc6
- Add defines to Project/Settings/C/C++/General/Preprocessor Definitions
in the vc6libcurl.dsw/vc6libcurl.dsp Visual C++ 6 IDE project.
+ Using BSD-style lwIP instead of Winsock TCP/IP stack in Win32 builds
+ --------------------------------------------------------------------
+
+ In order to compile libcurl and curl using BSD-style lwIP TCP/IP stack
+ it is necessary to make definition of preprocessor symbol USE_LWIPSOCK
+ visible to libcurl and curl compilation processes. To set this definition
+ you have the following alternatives:
+
+ - Modify lib/config-win32.h and src/config-win32.h
+ - Modify lib/Makefile.vc6
+ - Add definition to Project/Settings/C/C++/General/Preprocessor Definitions
+ in the vc6libcurl.dsw/vc6libcurl.dsp Visual C++ 6 IDE project.
+
+ Once that libcurl has been built with BSD-style lwIP TCP/IP stack support,
+ in order to use it with your program it is mandatory that your program
+ includes lwIP header file <lwip/opt.h> (or another lwIP header that includes
+ this) before including any libcurl header. Your program does not need the
+ USE_LWIPSOCK preprocessor definition which is for libcurl internals only.
+
+ Compilation has been verified with lwIP 1.4.0 and contrib-1.4.0 from:
+
+ http://download.savannah.gnu.org/releases/lwip/lwip-1.4.0.zip
+ http://download.savannah.gnu.org/releases/lwip/contrib-1.4.0.zip
+
+ This BSD-style lwIP TCP/IP stack support must be considered experimental
+ given that it has been verified that lwIP 1.4.0 still needs some polish,
+ and libcurl might yet need some additional adjustment, caveat emptor.
+
Important static libcurl usage note
-----------------------------------
dynamic import symbols.
+Apple iOS and Mac OS X
+======================
+ On recent Apple operating systems, curl can be built to use Apple's
+ SSL/TLS implementation, Secure Transport, instead of OpenSSL. To build with
+ Secure Transport for SSL/TLS, use the configure option --with-darwinssl. (It
+ is not necessary to use the option --without-ssl.) This feature requires iOS
+ 5.0 or later, or OS X 10.5 ("Leopard") or later.
+
+ When Secure Transport is in use, the curl options --cacert and --capath and
+ their libcurl equivalents, will be ignored, because Secure Transport uses
+ the certificates stored in the Keychain to evaluate whether or not to trust
+ the server. This, of course, includes the root certificates that ship with
+ the OS. The --cert and --engine options, and their libcurl equivalents, are
+ currently unimplemented in curl with Secure Transport.
+
+ For OS X users: In OS X 10.8 ("Mountain Lion"), Apple made a major
+ overhaul to the Secure Transport API that, among other things, added
+ support for the newer TLS 1.1 and 1.2 protocols. To get curl to support
+ TLS 1.1 and 1.2, you must build curl on Mountain Lion or later, or by
+ using the equivalent SDK. If you set the MACOSX_DEPLOYMENT_TARGET
+ environmental variable to an earlier version of OS X prior to building curl,
+ then curl will use the new Secure Transport API on Mountain Lion and later,
+ and fall back on the older API when the same curl binary is executed on
+ older cats. For example, running these commands in curl's directory in the
+ shell will build the code such that it will run on cats as old as OS X 10.6
+ ("Snow Leopard") (using bash):
+
+ export MACOSX_DEPLOYMENT_TARGET="10.6"
+ ./configure --with-darwinssl
+ make
+
+
IBM OS/2
========
Building under OS/2 is not much different from building under unix.
Curl seems to work with FTP & HTTP other protocols are not tested. (the
perl http/ftp testing server supplied as testing too cannot work on VMS
because vms has no concept of fork(). [ I tried to give it a whack, but
- thats of no use.
+ that's of no use.
SSL stuff has not been ported.
you can find precompiled packages at:
http://www.gknw.net/development/ossl/netware/
for CLIB-based builds OpenSSL 0.9.8h or later is required - earlier versions
- dont support buildunf with CLIB BSD sockets.
+ don't support building with CLIB BSD sockets.
- optional SSH2 sources (version 0.17 or later);
Set a search path to your compiler, linker and tools; on Linux make
a 'set | grep OSTYPE' shows the var present and set; I simply overwrote it
with 'OSTYPE=linux-rh9-gnu' and the detection in the Makefile worked...
Any help in testing appreciated!
- Builds automatically created 8 times a day from current CVS are here:
+ Builds automatically created 8 times a day from current git are here:
http://www.gknw.net/mirror/curl/autobuilds/
the status of these builds can be viewed at the autobuild table:
- http://curl.haxx.se/auto/
+ http://curl.haxx.se/dev/builds.html
eCos
of running curl in this way is the contents of the configuration file
printed to the console.
---- src/main.c 19 Jul 2006 19:09:56 -0000 1.363
-+++ src/main.c 24 Jul 2006 21:37:23 -0000
+--- src/main.c 19 Jul 2006 19:09:56 -0000 1.363
++++ src/main.c 24 Jul 2006 21:37:23 -0000
@@ -4286,11 +4286,31 @@
}
-
-
+
+
+#ifdef __ECOS
+#include <cyg/fileio/fileio.h>
+MTAB_ENTRY( testfs_mte1,
+ "",
+ 0);
+#endif
-
+
int main(int argc, char *argv[])
{
int res;
+ }
+#endif
memset(&config, 0, sizeof(struct Configurable));
-
+
config.errors = stderr; /* default errors to stderr */
curl can be compiled on Minix 3 using gcc or ACK (starting with
ver. 3.1.3). Ensure that GNU gawk and bash are both installed and
available in the PATH.
-
+
ACK
---
Increase the heap sizes of the compiler with the command:
GCC
---
Make sure gcc is in your PATH with the command:
-
+
export PATH=/usr/gnu/bin:$PATH
-
+
then configure and compile curl with:
./configure CC=gcc AR=/usr/gnu/bin/gar GREP=grep
VxWorks
========
Build for VxWorks is performed using cross compilation.
- That means you build on Windows machine using VxWorks tools and
+ That means you build on Windows machine using VxWorks tools and
run the built image on the VxWorks device.
-
+
To build libcurl for VxWorks you need:
-
+
- CYGWIN (free, http://cygwin.com/)
- Wind River Workbench (commercial)
3. Adjust environment variables defined in 'Environment' section
of the Makefile.vxworks file to point to your software folders.
4. Build the libcurl by typing 'make -f ./Makefile.vxworks'
-
- As a result the libcurl.a library should be created in the 'lib' folder.
+
+ As a result the libcurl.a library should be created in the 'lib' folder.
To clean the build results type 'make -f ./Makefile.vxworks clean'.
-
+
+
+Android
+=======
+ Method using the static makefile:
+ - see the build notes in the packages/Android/Android.mk file.
+
+ Method using a configure cross-compile (tested with Android NDK r7c, r8):
+ - prepare the toolchain of the Android NDK for standalone use; this can
+ be done by invoking the script:
+ ./build/tools/make-standalone-toolchain.sh
+ which creates a usual cross-compile toolchain. Lets assume that you put
+ this toolchain below /opt then invoke configure with something like:
+ export PATH=/opt/arm-linux-androideabi-4.4.3/bin:$PATH
+ ./configure --host=arm-linux-androideabi [more configure options]
+ make
+ - if you want to compile directly from our GIT repo you might run into
+ this issue with older automake stuff:
+ checking host system type...
+ Invalid configuration `arm-linux-androideabi':
+ system `androideabi' not recognized
+ configure: error: /bin/sh ./config.sub arm-linux-androideabi failed
+ this issue can be fixed with using more recent versions of config.sub
+ and config.guess which can be obtained here:
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=tree
+ you need to replace your system-own versions which usually can be
+ found in your automake folder:
+ find /usr -name config.sub
+
+ Wrapper for pkg-config
+ - In order to make proper use of pkg-config so that configure is able to
+ find all dependencies you should create a wrapper script for pkg-config;
+ file /opt/arm-linux-androideabi-4.4.3/bin/arm-linux-androideabi-pkg-config:
+
+ #!/bin/sh
+ SYSROOT=$(dirname ${0%/*})/sysroot
+ export PKG_CONFIG_DIR=
+ export PKG_CONFIG_LIBDIR=${SYSROOT}/usr/local/lib/pkgconfig:${SYSROOT}/usr/share/pkgconfig
+ export PKG_CONFIG_SYSROOT_DIR=${SYSROOT}
+ exec pkg-config "$@"
+
+ also create a copy or symlink with name arm-unknown-linux-androideabi-pkg-config.
+
CROSS COMPILE
=============
export NM=ppc_405-nm
./configure --target=powerpc-hardhat-linux \
- --host=powerpc-hardhat-linux \
- --build=i586-pc-linux-gnu \
- --prefix=/opt/hardhat/devkit/ppc/405/target/usr/local \
- --exec-prefix=/usr/local
+ --host=powerpc-hardhat-linux \
+ --build=i586-pc-linux-gnu \
+ --prefix=/opt/hardhat/devkit/ppc/405/target/usr/local \
+ --exec-prefix=/usr/local
(end script)
--disable-verbose (eliminates debugging strings and error code strings)
--enable-hidden-symbols (eliminates unneeded symbols in the shared library)
--without-libidn (disables support for the libidn DNS library)
+ --without-librtmp (disables support for RTMP)
--without-ssl (disables support for SSL/TLS)
--without-zlib (disables support for on-the-fly decompression)
The GNU compiler and linker have a number of options that can reduce the
size of the libcurl dynamic libraries on some platforms even further.
Specify them by providing appropriate CFLAGS and LDFLAGS variables on the
- configure command-line:
- CFLAGS="-ffunction-sections -fdata-sections" \
+ configure command-line, e.g.
+ CFLAGS="-Os -ffunction-sections -fdata-sections \
+ -fno-unwind-tables -fno-asynchronous-unwind-tables" \
LDFLAGS="-Wl,-s -Wl,-Bsymbolic -Wl,--gc-sections"
Be sure also to strip debugging symbols from your binaries after
.comment section).
Using these techniques it is possible to create a basic HTTP-only shared
- libcurl library for i386 Linux platforms that is only 98 KiB in size, and
- an FTP-only library that is 94 KiB in size (as of libcurl version 7.20.0,
- using gcc 4.3.3).
+ libcurl library for i386 Linux platforms that is only 114 KiB in size, and
+ an FTP-only library that is 115 KiB in size (as of libcurl version 7.35.0,
+ using gcc 4.8.2).
You may find that statically linking libcurl to your application will
result in a lower total size than dynamically linking.
command line. Following is a list of appropriate key words:
--disable-cookies !cookies
- --disable-crypto-auth !HTTP\ Digest\ auth !HTTP\ proxy\ Digest\ auth
--disable-manual !--manual
--disable-proxy !HTTP\ proxy !proxytunnel !SOCKS4 !SOCKS5
- Alpha OpenVMS V7.1-1H2
- Alpha Tru64 v5.0 5.1
- AVR32 Linux
- - ARM Android 1.5
+ - ARM Android 1.5, 2.1, 2.3, 3.2, 4.x
- ARM INTEGRITY
- - ARM iPhone OS
+ - ARM iOS
- Cell Linux
- Cell Cell OS
- HP-PA HP-UX 9.X 10.X 11.X
- i386 HURD
- i386 Haiku OS
- i386 Linux 1.3, 2.0, 2.2, 2.3, 2.4, 2.6
+ - i386 Mac OS X
- i386 MINIX 3.1
- i386 NetBSD
- i386 Novell NetWare
Useful URLs
===========
-OpenSSL http://www.openssl.org
-MingW http://www.mingw.org
-OpenLDAP http://www.openldap.org
-Zlib http://www.gzip.org/zlib/
-libssh2 http://www.libssh2.org
-
-
+axTLS http://axtls.sourceforge.net/
+c-ares http://c-ares.haxx.se/
+GNU GSS http://www.gnu.org/software/gss/
+GnuTLS http://www.gnu.org/software/gnutls/
+Heimdal http://www.pdc.kth.se/heimdal/
+libidn http://www.gnu.org/software/libidn/
+libmetalink https://launchpad.net/libmetalink/
+libssh2 http://www.libssh2.org/
+MIT Kerberos http://web.mit.edu/kerberos/www/dist/
+NSS http://www.mozilla.org/projects/security/pki/nss/
+OpenLDAP http://www.openldap.org/
+OpenSSL http://www.openssl.org/
+PolarSSL http://polarssl.org/
+yassl http://www.yassl.com/
+Zlib http://www.zlib.net/
+
+MingW http://www.mingw.org/
+MinGW-w64 http://mingw-w64.sourceforge.net/
+OpenWatcom http://www.openwatcom.org/