## General |
|
Generally CppCMS can be used as-is for embedded systems. However there are many features that are heavy and targeted |
for high performance web servers. These options |
are rather useless for embedded system. |
|
Thus additional build options that make this library optimized for embedded system provided. |
|
They are reduce number of dependencies and make executable |
significantly smaller. |
|
## Changes in Embedded Build |
|
### Normal Embedded Build |
|
- Caching is completely removed. Small memory footprint |
is very important for embedded system thus, caching |
stuff in memory is quite useless. |
- Zlib compression are removed -- it removes dependency on `boost::iostreams`, zlib and bzip2 libraries. |
- Removed mod-prefork. |
- Removed dynamic templates loading --- this feature requires export of symbols to binary and increases its size in order to make RTTI work. Thus, all templates should be |
statically compiled into the binary. |
|
### CGI Mode |
|
- FastCGI and SCGI APIs are removed |
- Mod-thread and mod process are removed including |
all thread pool facilities |
- Changes in files based session backend to work |
properly with CGI mode including garbage collection |
(sessions that had time-out). |
|
### Minimal Dependencies |
|
Embedded compilation allows building CppCMS using only following libraries: |
|
- libcgicc |
- libboost\_signals |
- libboost\_regex. |
|
## Cross Compilation of CppCMS |
|
### General |
|
For cross compilation you should use `--host` configuration switch according to your platform, for example: |
|
./configure --host=arm-linux-eabi ... |
./configure --host=mips-linux-gnu |
|
Do not forget to build boost and cgicc as well. Refer to |
your platform documentation for cross-compilation instructions. |
|
### Build Flags: |
|
- `--enable-embedded` -- Create embedded version of cppcms. |
- `--enable-cgi` -- implement CGI API only. |
|
_Additional flags:_ |
|
- `CXXFLAGS=-Os` -- optimize for size when you build |
for embedded system |
- `--prefix=/...` -- always specify installation prefix... You do not want to install to `/usr/local/lib`, `;-)` |
|
For example: |
|
./configure --host=arm-linux-gnu --prefix=/usr/arm-linux-gnu CXXFLAGS=-Os --enable-embedded --enable-cgi |
|
Would configure cross compilation make files for ARM platform, |
|
_Notes:_ |
|
- Remember that you should build cgicc and boost as well |
- It is recommended to build `boost::regex` without ICU support in order to reduce executable size. |
- Use `strip --strip-all` to reduce your executable size. |
|
## Static Linking |
|
In some cases you want to build your application |
without dependencies on many shared objects. |
Thus you can link your application "almost" statically. |
|
Only system libraries like libc, libstdc++, pthreads, rt would be linked dynamically |
|
### CGI Only |
|
You can build "almost" static build as following: |
|
g++ hello.o /path/to/libcppcms.a /path/to/libcppcmstranstext.a /path/to/libboost_signals.a /path/to/libboost_regex.a /path/to/libcgicc.a |
|
|
### With Worker Threads |
|
You can build "almost" static build as following: |
|
g++ hello.o /path/to/libcppcms.a /path/to/libcppcmstranstext.a /path/to/libboost_signals.a /path/to/libboost_regex.a /path/to/libcgicc.a -lrt -lpthread |
|
|
|
|