introduce without extensions
[profile/ivi/libwebsockets.git] / README.build
1 Building the library and test apps
2 ----------------------------------
3
4 You need to regenerate the autotools and libtoolize stuff for your system
5
6 $ ./autogen.sh
7
8 Then for a Fedora x86_86 box, the following config line was
9 needed:
10
11  ./configure --prefix=/usr --libdir=/usr/lib64 --enable-openssl
12
13 For Apple systems, Christopher Baker reported that this is needed
14 (and I was told separately enabling openssl makes trouble somehow)
15
16 ./configure CC="gcc -arch i386 -arch x86_64" CXX="g++ -arch i386 -arch
17 x86_64" CPP="gcc -E" CXXCPP="g++ -E" --enable-nofork
18
19 For mingw build, I did the following to get working build, ping test is
20 disabled when building this way
21
22 1) install mingw64_w32 compiler packages from Fedora
23 2) additionally install mingw64-zlib package
24 3) ./configure --prefix=/usr --enable-mingw --host=x86_64-w64-mingw32
25 4) make
26
27 For uClibc, you will likely need --enable-builtin-getifaddrs
28
29
30 otherwise if /usr/local/... and /usr/local/lib are OK then...
31
32 $ ./configure
33 $ make clean
34 $ make && sudo make install
35 $ libwebsockets-test-server
36
37 should be enough to get a test server listening on port 7861.
38
39
40 Configure script options
41 ------------------------
42
43 There are several other possible configure options
44
45 --enable-nofork         disables the fork into the background API
46                         and removes all references to fork() and
47                         pr_ctl() from the sources.  Use it if your
48                         platform doesn't support forking.
49
50 --enable-libcrypto      by default libwebsockets uses its own
51                         built-in md5 and sha-1 implementation for
52                         simplicity.  However the libcrypto ones
53                         may be faster, and in a distro context it
54                         may be highly desirable to use a common
55                         library implementation for ease of security
56                         upgrades.  Give this configure option
57                         to disable the built-in ones and force use
58                         of the libcrypto (part of openssl) ones.
59
60 --with-client-cert-dir=dir   tells the client ssl support where to
61                              look for trust certificates to validate
62                              the remote certificate against.
63
64 --enable-noping         Don't try to build the ping test app
65                         It needs some unixy environment that
66                         may choke in other build contexts, this
67                         lets you cleanly stop it being built
68                         
69 --enable-builtin-getifaddrs  if your libc lacks getifaddrs, you can build an
70                         implementation into the library.  By default your libc
71                         one is used.
72
73 --without-testapps      Just build the library not the test apps
74
75 --without-client        Don't build the client part of the library nor the
76                         test apps that need the client part.  Useful to
77                         minimize library footprint for embedded server-only
78                         case
79
80 --without-server        Don't build the server part of the library nor the
81                         test apps that need the server part.  Useful to
82                         minimize library footprint for embedded client-only
83                         case
84
85 --without-daemonize     Don't build daemonize.c / lws_daemonize
86
87 --disable-debug         Remove all debug logging below lwsl_notice in severity
88                         from the code -- it's not just defeated from logging
89                         but removed from compilation
90
91 --without-extensions    Remove all code and data around protocol extensions.
92                         This reduces the code footprint considerably but
93                         you will lose extension features like compression.
94                         However that may be irrelevant for embedded use and
95                         the code / data size / speed improvements may be
96                         critical.
97
98
99 Externally configurable important constants
100 -------------------------------------------
101
102 You can control these from configure by just setting them as commandline
103 args throgh CFLAGS, eg
104
105 ./configure CFLAGS="-DLWS_MAX_ZLIB_CONN_BUFFER=8192"
106
107
108 They all have reasonable defaults usable for all use-cases except resource-
109 constrained, so you only need to take care about them if you want to tune them
110 to the amount of memory available.
111
112  - LWS_MAX_HEADER_NAME_LENGTH default 64: max characters in an HTTP header
113 name that libwebsockets can cope with
114
115  - LWS_MAX_HEADER_LEN default 4096: largest HTTP header value string length
116 libwebsockets can cope with
117
118  - LWS_INITIAL_HDR_ALLOC default 256: amount of memory to allocate initially,
119 tradeoff between taking too much and needless realloc
120
121  - LWS_ADDITIONAL_HDR_ALLOC default 64: how much to additionally realloc if
122 the header value string keeps coming
123
124  - MAX_USER_RX_BUFFER default 4096: max amount of user rx data to buffer at a
125 time and pass to user callback LWS_CALLBACK_RECEIVE or
126 LWS_CALLBACK_CLIENT_RECEIVE.  Large frames are passed to the user callback
127 in chunks of this size.  Tradeoff between per-connection static memory
128 allocation and if you expect to deal with large frames, how much you can
129 see at once which can affect efficiency.
130
131  - MAX_BROADCAST_PAYLOAD default 4096: largest amount of user tx data we can
132 broadcast at a time
133
134  - LWS_MAX_PROTOCOLS default 10: largest amount of different protocols the
135 server can serve
136
137  - LWS_MAX_EXTENSIONS_ACTIVE default 10: largest amount of extensions we can
138 choose to have active on one connection
139
140  - SPEC_LATEST_SUPPORTED default 13: only change if you want to remove support
141 for later protocol versions... unlikely
142
143  - AWAITING_TIMEOUT default 5: after this many seconds without a response, the
144 server will hang up on the client
145
146  - CIPHERS_LIST_STRING default "DEFAULT": SSL Cipher selection.  It's advisable
147 to tweak the ciphers allowed to be negotiated on secure connections for
148 performance reasons, otherwise a slow algorithm may be selected by the two
149 endpoints and the server could expend most of its time just encrypting and
150 decrypting data, severely limiting the amount of messages it will be able to
151 handle per second.  For example::
152
153     "RC4-MD5:RC4-SHA:AES128-SHA:AES256-SHA:HIGH:!DSS:!aNULL"
154
155  - SYSTEM_RANDOM_FILEPATH default "/dev/urandom": if your random device differs
156 you can set it here
157
158  - LWS_MAX_ZLIB_CONN_BUFFER  maximum size a compression buffer is allowed to
159 grow to before closing the connection.  Some limit is needed or any connecton
160 can exhaust all server memory by sending it 4G buffers full of zeros which the
161 server is expect to expand atomically.  Default is 64KBytes.
162
163  - LWS_SOMAXCONN  maximum number of pending connect requests the listening
164 socket can cope with.  Default is SOMAXCONN.  If you need to use synthetic
165 tests that just spam hundreds of connect requests at once without dropping
166 any, you can try messing with these as well as ulimit (see later)
167 (courtesy Edwin van der Oetelaar)
168
169 echo "2048 64512" > /proc/sys/net/ipv4/ip_local_port_range
170 echo "1" > /proc/sys/net/ipv4/tcp_tw_recycle
171 echo "1" > /proc/sys/net/ipv4/tcp_tw_reuse
172 echo "10" > /proc/sys/net/ipv4/tcp_fin_timeout
173 echo "65536" > /proc/sys/net/core/somaxconn
174 echo "65536" > /proc/sys/net/ipv4/tcp_max_syn_backlog
175 echo "262144" > /proc/sys/net/netfilter/nf_conntrack_max
176