This repository provides a shared library that provides access to some common functionality that can be useful when running kdb-based systems on Linux.
NOTE: This repository incorporates (and supercedes) kdb-base64-lib and kdb-systemd-lib.
| Source File | Function Prefix | Optional | Description |
|---|---|---|---|
Base64.cpp |
_cpp_b64 |
No | High performance Base64 encoding and decoding |
File.cpp |
_cpp_filesystem |
No | Detailed file and filesystem queries |
Process.cpp |
_cpp_process |
No | Process and thread information |
System.cpp |
_cpp_system |
No | System-level information |
Systemd.cpp |
_cpp_systemd |
Yes | Systemd integration for process reporting |
To compile, use cmake:
# Create build in a local 'build' folder within the repo
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build .The Dockerfile in this repository can be used to create an image that will be able to compile the library for Ubuntu:
# Explicitly build for x86_64 (if running on M-series Mac)
podman build -t jasraj/cmake:1.0.0 --arch=x86_64 .
# Start a container with the new image and run compilation commands
podman run -it --rm -v $(pwd):/opt/git/repo --arch=x86_64 jasraj/cmake:1.0.0 /bin/bashAll the components marked as optional in the table above will be excluded (OFF) by default. The sections below describe how to enable them and the additional library requirements.
To include the systemd functionality within the shared library, ensure you have the development files for systemd installed:
- Ubuntu:
libsystemd-dev - CentOS:
systemd-devel
The configuration flag to enable this is BUILD_SYSTEMD_COMPONENT. Example:
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SYSTEMD_COMPONENT=ON ..The generated shared library will be in the build folder:
> ls -l *.so*
lrwxr-xr-x. 1 root root 22 Feb 12 15:30 libkdb-cpp-common.so -> libkdb-cpp-common.so.1
lrwxr-xr-x. 1 root root 26 Feb 12 15:30 libkdb-cpp-common.so.1 -> libkdb-cpp-common.so.1.0.0
-rwxr-xr-x. 1 root root 79928 Feb 12 15:30 libkdb-cpp-common.so.1.0.0and one of the following options should be used for installation:
- Manually move the shared library into any folder specified on
$LD_LIBRARY_PATH - Install the library into
/usr/libwithcmake --install .(will requirerootuser) - Generate DEB and RPM files with
cpack .