Forum

officially support fully static compilation with system mbed TLS library

robotanarchy
3 August 2015, 10:52
Hello,

I've compiled hiawatha for sabotage linux with a fully statically linked mbedtls system library, basically like this:

CFLAGS="-static" cmake -DUSE_SYSTEM_MBEDTLS=ON
sed -i 's/-lmbedtls/-lmbedtls -lmbedcrypto -lmbedx509/' CMakeFiles/*/link.txt
make
make install

(mbedtls is compiled with MBEDTLS_THREADING_C and MBEDTLS_THREADING_PTHREAD)

Here's the link to my current build recipe (it has the full make/cmake statements):
https://github.com/robotanarchy/sabotage/blob/hiawatha/pkg/hiawatha

So while this works, it is a hack and proper upstream support would be better. Would you like to add this to the cmake buildsystem (maybe with something like -DUSE_SYSTEM_MBEDTLS_STATICALLY=ON)?

Thanks for making this great webserver
Hugo Leisink
12 August 2015, 08:29
The sed line is probably not required if you use this CMakeLists.txt file (changes at line 116, 146 and 147). It contains a fix for linking the mbed TLS library. This fix will be available in the next Hiawatha release.
This topic has been closed.