Static linking
goodspeed1986 opened this issue · 3 comments
How to build akumuli without any dependencies (shared libraries)?
There're several places in cmake files that control this. You have to update them.
- This line https://github.com/akumuli/Akumuli/blob/master/CMakeLists.txt#L105 enables dynamic boost linking
- libakumuli is built as a dynamic lib (https://github.com/akumuli/Akumuli/blob/master/libakumuli/CMakeLists.txt#L1) it can be built as a static lib
- There're a bunch of 3rd party dependencies (APR, jemalloc) which a linked as a dynamic libraries and can be linked staticly.
Also, if you'll link all dependencies statically, the app will still link C-runtime dynamically. You can use some static CRT library (for instance musl) but this can prove to be tricky. For instance, you'll have to build all dependencies yourself using static CRT instead of dynamic one. With boost it's not that tricky because you have this option (https://github.com/akumuli/Akumuli/blob/master/CMakeLists.txt#L107) but other libraries have to be rebuilt with all their dependencies.
Here is my own bash scripts to build akumulid and libakumuli statically: https://github.com/webfolderio/Akumuli-static
It's tested under CircleCI & Ubuntu but should also work for CentOS etc...
Thanks. It works for me.