1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-18 07:25:14 -05:00
curl/docs/INSTALL

630 lines
22 KiB
Plaintext
Raw Normal View History

_ _ ____ _
___| | | | _ \| |
/ __| | | | |_) | |
| (__| |_| | _ <| |___
2000-05-22 13:35:35 -04:00
\___|\___/|_| \_\_____|
How To Compile
Installing Binary Packages
==========================
2000-05-22 13:35:35 -04:00
Lots of people download binary distributions of curl and libcurl. This
document does not describe how to install curl or libcurl using such a
binary package. This document describes how to compile, build and install
curl and libcurl from source code.
2000-05-22 13:35:35 -04:00
UNIX
====
A normal unix installation is made in three or four steps (after you've
unpacked the source archive):
2000-11-27 08:39:11 -05:00
./configure
make
make test (optional)
make install
2000-05-22 13:35:35 -04:00
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.
2003-04-29 12:55:17 -04:00
Get a full listing of all available configure options by invoking it like:
./configure --help
If you want to install curl in a different file hierarchy than /usr/local,
you need to specify that already when running configure:
./configure --prefix=/path/to/curl/tree
If you happen to have write permission in that directory, you can do 'make
install' without being root. An example of this would be to make a local
install in your own home directory:
./configure --prefix=$HOME
make
make install
The configure script always tries to find a working SSL library unless
explicitly told not to. If you have OpenSSL installed in the default search
path for your compiler/linker, you don't need to do anything special. If
2001-12-03 05:07:49 -05:00
you have OpenSSL installed in /usr/local/ssl, you can run configure like:
2000-05-22 13:35:35 -04:00
./configure --with-ssl
If you have OpenSSL installed somewhere else (for example, /opt/OpenSSL,)
you can run configure like this:
./configure --with-ssl=/opt/OpenSSL
2001-12-03 05:07:49 -05:00
If you insist on forcing a build without SSL support, even though you may
have OpenSSL installed in your system, you can run configure like this:
2000-05-22 13:35:35 -04:00
./configure --without-ssl
If you have OpenSSL installed, but with the libraries in one place and the
2001-12-03 05:07:49 -05:00
header files somewhere else, you have to set the LDFLAGS and CPPFLAGS
2000-05-22 13:35:35 -04:00
environment variables prior to running configure. Something like this
should work:
(with the Bourne shell and its clones):
CPPFLAGS="-I/path/to/ssl/include" LDFLAGS="-L/path/to/ssl/lib" \
./configure
(with csh, tcsh and their clones):
2000-05-22 13:35:35 -04:00
env CPPFLAGS="-I/path/to/ssl/include" LDFLAGS="-L/path/to/ssl/lib" \
./configure
If you have shared SSL libs installed in a directory where your run-time
linker doesn't find them (which usually causes configure failures), you can
provide the -R option to ld on some operating systems to set a hard-coded
path to the run-time linker:
LDFLAGS=-R/usr/local/ssl/lib ./configure --with-ssl
Another option to the previous trick, is to set LD_LIBRARY_PATH or edit the
/etc/ld.so.conf file.
If your SSL library was compiled with rsaref (this was common in the past
when used in the United States), you may also need to set:
2000-05-22 13:35:35 -04:00
LIBS=-lRSAglue -lrsaref
(as suggested by Doug Kaufman)
2000-05-22 13:35:35 -04:00
MORE OPTIONS
2000-05-22 13:35:35 -04:00
2001-12-03 05:07:49 -05:00
To force configure to use the standard cc compiler if both cc and gcc are
present, run configure like
2000-05-22 13:35:35 -04:00
CC=cc ./configure
or
env CC=cc ./configure
2000-05-22 13:35:35 -04:00
To force a static library compile, disable the shared library creation
by running configure like:
./configure --disable-shared
2000-09-26 18:32:46 -04:00
To tell the configure script to skip searching for thread-safe functions,
add an option 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
2000-05-22 13:35:35 -04:00
If you're a curl developer and use gcc, you might want to enable more
debug options with the --enable-debug option.
2006-07-08 17:29:45 -04:00
curl can be built to use a whole range of libraries to provide various
useful services, and configure will try to auto-detect a decent
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 yassl support instead of OpenSSL or GunTLS, you must build
yassl with its OpenSSL emulation enabled and point to that directory root
with configure --with-ssl.
2000-05-22 13:35:35 -04:00
Win32
=====
MingW32
-------
2000-05-22 13:35:35 -04:00
Run the 'mingw32.bat' file to get the proper environment variables set,
then run 'make mingw32' in the root dir. Use 'make mingw32-ssl' to build
curl SSL enabled.
2000-05-22 13:35:35 -04:00
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.
2000-05-22 13:35:35 -04:00
Cygwin
------
2000-05-22 13:35:35 -04:00
Almost identical to the unix installation. Run the configure script in the
curl root with 'sh configure'. Make sure you have the sh executable in
/bin/ or you'll see the configure fail towards the end.
2000-05-22 13:35:35 -04:00
Run 'make'
2000-05-22 13:35:35 -04:00
Dev-Cpp
-------
See the separate INSTALL.devcpp file for details.
2000-05-22 13:35:35 -04:00
MSVC from command line
----------------------
2000-05-22 13:35:35 -04:00
Run the 'vcvars32.bat' file to get a proper environment. The
vcvars32.bat file is part of the Microsoft development environment and
you may find it in 'C:\Program Files\Microsoft Visual Studio\vc98\bin'
provided that you installed Visual C/C++ 6 in the default directory.
2000-05-22 13:35:35 -04:00
Then run 'nmake vc' in curl's root directory.
2000-05-22 13:35:35 -04:00
If you want to compile with zlib support, you will need to build
zlib (http://www.gzip.org/zlib/) as well. Please read the zlib
documentation on how to compile zlib. Define the ZLIB_PATH environment
variable to the location of zlib.h and zlib.lib, for example:
2000-05-22 13:35:35 -04:00
set ZLIB_PATH=c:\zlib-1.2.1
2000-05-22 13:35:35 -04:00
Then run 'nmake vc-zlib' in curl's root directory.
2000-05-22 13:35:35 -04:00
If you want to compile with SSL support you need the OpenSSL package.
Please read the OpenSSL documentation on how to compile and install
the OpenSSL libraries. The build process of OpenSSL generates the
libeay32.dll and ssleay32.dll files in the out32dll subdirectory in
the OpenSSL home directory. OpenSSL static libraries (libeay32.lib,
ssleay32.lib, RSAglue.lib) are created in the out32 subdirectory.
2000-05-22 13:35:35 -04:00
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.7d
2004-07-11 09:49:52 -04:00
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
libraries in the lib subdirectory, as well as a statically linked
version of curl.exe in the src subdirectory. This statically linked
version is a standalone executable not requiring any DLL at
runtime. This make method requires that you have the static OpenSSL
libraries available in OpenSSL's out32 subdirectory.
'nmake vc-ssl-dll' creates the libcurl dynamic library and
links curl.exe against libcurl and OpenSSL dynamically.
This executable requires libcurl.dll and the OpenSSL DLLs
at runtime.
Run 'nmake vc-ssl-zlib' to build with both ssl and zlib support.
2004-07-11 09:49:52 -04:00
Borland C++ compiler
---------------------
2004-07-11 09:49:52 -04:00
compile openssl
2004-07-11 09:49:52 -04:00
Make sure you include the paths to curl/include and openssl/inc32 in
your bcc32.cnf file
2004-07-11 09:49:52 -04:00
eg : -I"c:\Bcc55\include;c:\path_curl\include;c:\path_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.)
Make sure the environment variable "BCCDIR" is set to the install
location for the compiler eg : c:\Borland\BCC55
command line:
make -f /path_to_curl/lib/Makefile-ssl.b32
compile simplessl.c with appropriate links
2000-05-22 13:35:35 -04:00
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
MSVC IDE
--------
If you use VC++, Borland or similar compilers. Include all lib source
files in a static lib "project" (all .c and .h files that is).
(you should name it libcurl or similar)
Make the sources in the src/ drawer be a "win32 console application"
project. Name it curl.
For VC++ 6, there's an included Makefile.vc6 that should be possible
to use out-of-the-box.
Disabling Specific Protocols in Win32 builds
--------------------------------------------
The configure utility, unfortunately, is not available for the Windows
environment, therefore, you cannot use the various disable-protocol
options of the configure utility on this platform.
However, you can use the following defines to disable specific
protocols:
HTTP_ONLY disables all protocols except HTTP
CURL_DISABLE_FTP disables FTP
CURL_DISABLE_LDAP disables LDAP
CURL_DISABLE_TELNET disables TELNET
CURL_DISABLE_DICT disables DICT
CURL_DISABLE_FILE disables FILE
If you want to set any of these defines you have the following
possibilities:
- Modify lib/setup.h
- Modify lib/Makefile.vc6
- Add defines to Project/Settings/C/C++/General/Preprocessor Definitions
in the curllib.dsw/curllib.dsp Visual C++ 6 IDE project.
Important static libcurl usage note
-----------------------------------
When building an application that uses the static libcurl library, you must
add '-DCURL_STATICLIB' to your CFLAGS. Otherwise the linker will look for
dynamic import symbols.
2000-05-22 13:35:35 -04:00
IBM OS/2
========
Building under OS/2 is not much different from building under unix.
You need:
- emx 0.9d
- GNU make
- GNU patch
- ksh
- GNU bison
- GNU file utilities
- GNU sed
- autoconf 2.13
If you want to build with OpenSSL or OpenLDAP support, you'll need to
download those libraries, too. Dirk Ohme has done some work to port SSL
libraries under OS/2, but it looks like he doesn't care about emx. You'll
find his patches on: http://come.to/Dirk_Ohme
2000-05-22 13:35:35 -04:00
If during the linking you get an error about _errno being an undefined
symbol referenced from the text segment, you need to add -D__ST_MT_ERRNO__
in your definitions.
If everything seems to work fine but there's no curl.exe, you need to add
-Zexe to your linker flags.
If you're getting huge binaries, probably your makefiles have the -g in
CFLAGS.
2001-08-08 03:50:14 -04:00
VMS
===
(The VMS section is in whole contributed by the friendly Nico Baggus)
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.
SSL stuff has not been ported.
Telnet has about the same issues as for Win32. When the changes for Win32
are clear maybe they'll work for VMS too. The basic problem is that select
2001-08-08 03:50:14 -04:00
ONLY works for sockets.
Marked instances of fopen/[f]stat that might become a problem, especially
for non stream files. In this regard, the files opened for writing will be
created stream/lf and will thus be safe. Just keep in mind that non-binary
read/wring from/to files will have a records size limit of 32767 bytes
imposed.
Stat to get the size of the files is again only safe for stream files &
fixed record files without implied CC.
-- My guess is that only allowing access to stream files is the quickest
way to get around the most issues. Therefore all files need to to be
checked to be sure they will be stream/lf before processing them. This is
the easiest way out, I know. The reason for this is that code that needs to
report the filesize will become a pain in the ass otherwise.
Exit status.... Well we needed something done here,
VMS has a structured exist status:
| 3 | 2 | 1 | 0|
|1098|765432109876|5432109876543|210|
+----+------------+-------------+---+
|Ctrl| Facility | Error code |sev|
+----+------------+-------------+---+
With the Ctrl-bits an application can tell if part or the whole message has
already been printed from the program, DCL doesn't need to print it again.
2001-08-08 03:50:14 -04:00
Facility - basically the program ID. A code assigned to the program
2001-08-08 03:50:14 -04:00
the name can be fetched from external or internal message libraries
Errorcode - the errodes assigned by the application
Sev. - severity: Even = error, off = non error
2004-07-11 09:49:52 -04:00
0 = Warning
1 = Success
2 = Error
3 = Information
4 = Fatal
2004-07-11 09:49:52 -04:00
<5-7> reserved.
2001-08-08 03:50:14 -04:00
This all presents itself with:
%<FACILITY>-<SeV>-<Errorname>, <Error message>
See also the src/curlmsg.msg file, it has the source for the messages In
src/main.c a section is devoted to message status values, the globalvalues
create symbols with certain values, referenced from a compiled message
file. Have all exit function use a exit status derived from a translation
table with the compiled message codes.
This was all compiled with:
2004-07-11 09:49:52 -04:00
Compaq C V6.2-003 on OpenVMS Alpha V7.1-1H2
2001-08-08 03:50:14 -04:00
So far for porting notes as of:
13-jul-2001
N. Baggus
QNX
===
(This section was graciously brought to us by David Bentham)
As QNX is targeted for resource constrained environments, the QNX headers
set conservative limits. This includes the FD_SETSIZE macro, set by default
to 32. Socket descriptors returned within the CURL library may exceed this,
resulting in memory faults/SIGSEGV crashes when passed into select(..)
calls using fd_set macros.
A good all-round solution to this is to override the default when building
libcurl, by overriding CFLAGS during configure, example
# configure CFLAGS='-DFD_SETSIZE=64 -g -O2'
RISC OS
=======
The library can be cross-compiled using gccsdk as follows:
CC=riscos-gcc AR=riscos-ar RANLIB='riscos-ar -s' ./configure \
--host=arm-riscos-aof --without-random --disable-shared
make
where riscos-gcc and riscos-ar are links to the gccsdk tools.
You can then link your program with curl/lib/.libs/libcurl.a
2003-12-16 09:51:58 -05:00
AmigaOS
=======
(This section was graciously brought to us by Diego Casorran)
To build cURL/libcurl on AmigaOS just type 'make amiga' ...
What you need is: (not tested with others versions)
GeekGadgets / gcc 2.95.3 (http://www.geekgadgets.org/)
AmiTCP SDK v4.3 (http://www.aminet.net/comm/tcp/AmiTCP-SDK-4.3.lha)
Native Developer Kit (http://www.amiga.com/3.9/download/NDK3.9.lha)
As no ixemul.library is required you will be able to build it for
WarpOS/PowerPC (not tested by me), as well a MorphOS version should be
possible with no problems.
To enable SSL support, you need a OpenSSL native version (without ixemul),
you can find a precompiled package at http://amiga.sourceforge.net/OpenSSL/
NetWare
=======
To compile curl.nlm / libcurl.nlm you need:
- either any gcc / nlmconv, or CodeWarrior 7 PDK 4 or later.
2004-07-12 07:29:36 -04:00
- gnu make and awk running on the platform you compile on;
native Win32 versions can be downloaded from:
http://www.gknw.com/development/prgtools/
- recent Novell LibC SDK available from:
http://developer.novell.com/ndk/libc.htm
- optional zlib sources (at the moment only dynamic linking with zlib.imp);
sources with NetWare Makefile can be obtained from:
http://www.gknw.com/mirror/zlib/
2005-08-18 12:33:45 -04:00
- optional OpenSSL sources (version 0.9.8 or later which builds with BSD);
Set a search path to your compiler, linker and tools; on Linux make
sure that the var OSTYPE contains the string 'linux'; and then type
'make netware' from the top source directory; other tagets available
are 'netware-ssl', 'netware-ssl-zlib', 'netware-zlib' and 'netware-ares';
if you need other combinations you can control the build with the
environment variables WITH_SSL, WITH_ZLIB, WITH_ARES and ENABLE_IPV6.
I found on some Linux systems (RH9) that OS detection didnt work although
2004-07-04 22:20:20 -04:00
a 'set | grep OSTYPE' shows the var present and set; I simply overwrote it
2005-08-18 12:33:45 -04:00
with 'OSTYPE=linux-rh9-gnu' and the detection in the Makefile worked...
Any help in testing appreciated!
2005-08-18 12:33:45 -04:00
Builds automatically created 8 times a day from current CVS are here:
http://www.gknw.com/mirror/curl/autobuilds/
the status of these builds can be viewed at the autobuild table:
http://curl.haxx.se/auto/
CROSS COMPILE
=============
(This section was graciously brought to us by Jim Duey, with additions by
Dan Fandrich)
Download and unpack the cURL package. Version should be 7.9.1 or later.
'cd' to the new directory. (e.g. cd curl-7.12.3)
Set environment variables to point to the cross-compile toolchain and call
configure with any options you need. Be sure and specify the '--host' and
'--build' parameters at configuration time. The following script is an
example of cross-compiling for the IBM 405GP PowerPC processor using the
toolchain from MonteVista for Hardhat Linux.
(begin script)
#! /bin/sh
export PATH=$PATH:/opt/hardhat/devkit/ppc/405/bin
export CPPFLAGS="-I/opt/hardhat/devkit/ppc/405/target/usr/include"
export AR=ppc_405-ar
export AS=ppc_405-as
export LD=ppc_405-ld
export RANLIB=ppc_405-ranlib
export CC=ppc_405-gcc
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
(end script)
You may also need to provide a parameter like '--with-random=/dev/urandom'
to configure as it cannot detect the presence of a random number
generating device for a target system. The '--prefix' parameter
specifies where cURL will be installed. If 'configure' completes
successfully, do 'make' and 'make install' as usual.
In some cases, you may be able to simplify the above commands to as
little as:
./configure --host=ARCH-OS
REDUCING SIZE
=============
There are a number of configure options that can be used to reduce the
size of libcurl for embedded applications where binary size is an
important factor. First, be sure to set the CFLAGS variable when
configuring with any relevant compiler optimization flags to reduce the
size of the binary. For gcc, this would mean at minimum the -Os option
and probably the -march=X option as well, e.g.:
./configure CFLAGS='-Os' ...
Be sure to specify as many --disable- and --without- flags on the configure
command-line as you can to disable all the libcurl features that you
know your application is not going to need. Besides specifying the
--disable-PROTOCOL flags for all the types of URLs your application
will not use, here are some other flags that can reduce the size of the
library:
--disable-ares (disables support for the ARES DNS library)
--disable-cookies (disables support for HTTP cookies)
--disable-crypto-auth (disables HTTP cryptographic authentication)
--disable-ipv6 (disables support for IPv6)
--disable-verbose (eliminates debugging strings and error code strings)
--enable-hidden-symbols (eliminates unneeded symbols in library)
--without-libidn (disables support for the libidn DNS library)
--without-ssl (disables support for SSL/TLS)
--without-zlib (disables support for on-the-fly decompression)
The GNU linker has a number of options to reduce the size of the libcurl
dynamic libraries on some platforms even further. Specify them by giving
the options -Wl,-Bsymbolic and -Wl,-s on the gcc command-line.
Be sure also to strip debugging symbols from your binaries after
compiling using 'strip' (or the appropriate variant if cross-compiling).
If space is really tight, you may be able to remove some unneeded
sections of the library using the -R option to objcopy (e.g. the
.comment section).
Using these techniques it is possible to create an HTTP-only shared
libcurl library for i386 Linux platforms that is less than 90 KB in
size (as of version 7.15.4).
You may find that statically linking libcurl to your application will
result in a lower total size.
2000-11-27 08:39:11 -05:00
PORTS
=====
This is a probably incomplete list of known hardware and operating systems
that curl has been compiled for. If you know a system curl compiles and
runs on, that isn't listed, please let us know!
2000-11-27 08:39:11 -05:00
- Alpha DEC OSF 4
- Alpha Digital UNIX v3.2
- Alpha FreeBSD 4.1, 4.5
- Alpha Linux 2.2, 2.4
- Alpha NetBSD 1.5.2
2002-04-26 08:58:07 -04:00
- Alpha OpenBSD 3.0
- Alpha OpenVMS V7.1-1H2
2000-11-27 08:39:11 -05:00
- Alpha Tru64 v5.0 5.1
- HP-PA HP-UX 9.X 10.X 11.X
2001-11-22 08:03:11 -05:00
- HP-PA Linux
2004-02-02 10:34:09 -05:00
- HP3000 MPE/iX
2000-11-27 08:39:11 -05:00
- MIPS IRIX 6.2, 6.5
2001-11-22 08:03:11 -05:00
- MIPS Linux
2002-03-06 07:33:34 -05:00
- Pocket PC/Win CE 3.0
2005-05-09 09:26:41 -04:00
- Power AIX 3.2.5, 4.2, 4.3.1, 4.3.2, 5.1, 5.2
2000-11-27 08:39:11 -05:00
- PowerPC Darwin 1.0
- PowerPC Linux
2001-11-22 08:03:11 -05:00
- PowerPC Mac OS 9
2000-11-27 08:39:11 -05:00
- PowerPC Mac OS X
- SINIX-Z v5
2000-11-27 08:39:11 -05:00
- Sparc Linux
2005-05-09 09:26:41 -04:00
- Sparc Solaris 2.4, 2.5, 2.5.1, 2.6, 7, 8, 9, 10
- Sparc SunOS 4.1.X
- StrongARM (and other ARM) RISC OS 3.1, 4.02
2005-06-22 18:30:52 -04:00
- StrongARM/ARM7/ARM9 Linux 2.4, 2.6
- StrongARM NetBSD 1.4.1
- Ultrix 4.3a
2000-11-27 08:39:11 -05:00
- i386 BeOS
2003-05-27 03:37:34 -04:00
- i386 DOS
- i386 Esix 4.1
2000-11-27 08:39:11 -05:00
- i386 FreeBSD
2001-12-06 02:11:33 -05:00
- i386 HURD
2005-05-09 09:26:41 -04:00
- i386 Linux 1.3, 2.0, 2.2, 2.3, 2.4, 2.6
2000-11-27 08:39:11 -05:00
- i386 NetBSD
2004-03-17 07:46:42 -05:00
- i386 Novell NetWare
2000-11-27 08:39:11 -05:00
- i386 OS/2
- i386 OpenBSD
- i386 SCO unix
2000-11-27 08:39:11 -05:00
- i386 Solaris 2.7
2005-05-09 09:26:41 -04:00
- i386 Windows 95, 98, ME, NT, 2000, XP, 2003
2002-06-12 03:26:13 -04:00
- i386 QNX 6
- i486 ncr-sysv4.3.03 (NCR MP-RAS)
2000-11-27 08:39:11 -05:00
- ia64 Linux 2.3.99
- m68k AmigaOS 3
2001-11-22 08:03:11 -05:00
- m68k Linux
2000-11-27 08:39:11 -05:00
- m68k OpenBSD
- m88k dg-dgux5.4R3.00
- s390 Linux
- XScale/PXA250 Linux 2.4
2000-11-27 08:39:11 -05:00
Useful URLs
===========
2004-08-13 07:53:33 -04:00
OpenSSL http://www.openssl.org
MingW http://www.mingw.org
OpenLDAP http://www.openldap.org
Zlib http://www.gzip.org/zlib/