Rakesh Vidyadharan Help

Build

Standard cmake build procedure. See Dockerfile for build sequence. Ensure the dependencies are available under the following paths:

  • MacOSX - Various dependencies installed under the /usr/local/<dependency> path. See dependencies for scripts used to install the dependencies.

  • UNIX - All dependencies installed under the /opt/local path.

  • Windows - Most dependencies installed under the \opt\local path. A few dependencies also installed via vcpkg under \opt\src\vcpkg.

UNIX

Check out the project and build. Install dependencies. These instructions are for setting up on Mac OS X. For Linux, the assumption is that all dependencies are installed under /opt/local.

Build boost from sources.

BOOST_VERSION=1.87.0 INSTALL_DIR=/usr/local/boost cd /tmp ver=`echo "${BOOST_VERSION}" | awk -F'.' '{printf("%d_%d_%d",$1,$2,$3)}'` curl -OL https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${ver}.tar.bz2 tar xfj boost_${ver}.tar.bz2 sudo rm -rf $INSTALL_DIR cd boost_${ver} \ && ./bootstrap.sh \ && sudo ./b2 -j8 cxxflags=-std=c++20 install link=static threading=multi runtime-link=static --prefix=$INSTALL_DIR --without-python --without-mpi

RocksDB installed using the following script:

#!/bin/sh PREFIX=/usr/local/rocksdb VERSION=6.27.3 cd /tmp if [ -d rocksdb ] then rm -rf rocksdb gflags fi if [ -d $PREFIX ] then sudo rm -rf $PREFIX fi (git clone https://github.com/gflags/gflags.git \ && cd gflags \ && mkdir build_ && cd build_ \ && cmake \ -DBUILD_SHARED_LIBS=OFF \ -DBUILD_STATIC_LIBS=ON \ -DBUILD_TESTING=OFF \ -DBUILD_gflags_LIBS=ON \ -DINSTALL_HEADERS=ON \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_PREFIX_PATH=$PREFIX \ -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DCMAKE_INSTALL_LIBDIR=lib \ .. \ && make -j12 \ && sudo make install) (git clone -b v${VERSION} https://github.com/facebook/rocksdb.git \ && cd rocksdb \ && mkdir build && cd build \ && cmake -DWITH_TESTS=OFF \ -DWITH_ALL_TESTS=OFF \ -DCMAKE_CXX_STANDARD=17 \ -DCMAKE_BUILD_TYPE=Release \ -DROCKSDB_BUILD_SHARED=OFF \ -DCMAKE_PREFIX_PATH=$PREFIX \ -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DCMAKE_INSTALL_LIBDIR=lib \ .. \ && make -j12 \ && sudo make install)

flatbuffers installed using the following script:

#!/bin/sh NAME=flatbuffers PREFIX=/usr/local/flatbuffers VERSION=2.0.0 cd /tmp if [ -d $NAME ] then rm -rf $NAME fi if [ -d $PREFIX ] then sudo rm -rf $PREFIX fi git clone -b v${VERSION} https://github.com/google/flatbuffers.git \ && cd $NAME \ && mkdir build && cd build \ && cmake -DFLATBUFFERS_BUILD_TESTS=OFF \ -DFLATBUFFERS_BUILD_CPP17=ON \ -DFLATBUFFERS_ENABLE_PCH=ON \ -DCMAKE_PREFIX_PATH=$PREFIX \ -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DCMAKE_INSTALL_LIBDIR=lib \ .. \ && make -j12 \ && sudo make install

libnghttp2

brew install -y libnghttp2

Build project

Check out sources from the fork and build. If you wish to run the tests or the examples turn the appropriate options to ON from OFF.

cd /tmp git clone --branch dev https://github.com/sptrakesh/nghttp2-asio.git cd nghttp2-asio cmake -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_PREFIX_PATH=/usr/local/boost \ -DCMAKE_INSTALL_PREFIX=/usr/local/nghttp2 \ -DBUILD_EXAMPLE=OFF -DBUILD_TESTING=OFF \ -S . -B build cmake --build build -j12 sudo cmake --install build cd .. rm -rf nghttp2-asio

Check out, build and install the project.

git clone git@github.com:sptrakesh/config-db.git cd config-db cmake -DCMAKE_PREFIX_PATH=/usr/local/boost \ -DCMAKE_PREFIX_PATH=/usr/local/rocksdb \ -DCMAKE_PREFIX_PATH=/usr/local/flatbuffers \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr/local/spt \ -S . -B build cmake --build build -j12 sudo cmake --install build

Windows

Install pre-requisites for building and running on Windows. The following instructions at times reference arm or arm64 architecture. Modify those values as appropriate for your hardware. These instructions are based on steps I followed to set up the project on a Windows 11 virtual machine running via Parallels Desktop on a M2 Mac.

Issues

At present final linking of the service fails with unresolved external symbols. These have not manifested themselves on Mac OS X. I will update here if I finally manage to resolve the linking problems.

  • rocksdb::Cleanable::Cleanable(void)

  • rocksdb::PinnableSlice::PinnableSlice(class rocksdb::PinnableSlice &&)

  • rocksdb::Status::ToString(void)const

  • rocksdb::LRUCacheOptions::MakeSharedCache(void)const

  • rocksdb::ColumnFamilyOptions::OptimizeForPointLookup(unsigned __int64)

  • rocksdb::ColumnFamilyOptions::ColumnFamilyOptions(void)

  • rocksdb::DBOptions::OptimizeForSmallDb(class std::shared_ptr<class rocksdb::Cache> *)

  • rocksdb::DBOptions::DBOptions(void)

  • rocksdb::TransactionDB::Open(struct rocksdb::DBOptions const &,struct rocksdb::TransactionDBOptions const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::vector<struct rocksdb::ColumnFamilyDescriptor,class std::allocator<struct rocksdb::ColumnFamilyDescriptor> > const &,class std::vector<class rocksdb::ColumnFamilyHandle *,class std::allocator<class rocksdb::ColumnFamilyHandle *> > *,class rocksdb::TransactionDB **)

  • rocksdb::kDefaultColumnFamilyName

Build

Install dependencies and build the project.

Build boost from sources. Download and extract Boost 1.87 (or above) to a temporary location (eg. `\opt\src`). Launch the Visual Studio Command utility and cd to the temporary location.

cd \opt\src curl -OL https://boostorg.jfrog.io/artifactory/main/release/1.87.0/source/boost_1_87_0.tar.gz tar -xfz boost_1_87_0.tar.gz cd boost_1_87_0 .\bootstrap.bat .\b2 -j8 install threading=multi address-model=64 architecture=arm asynch-exceptions=on --prefix=\opt\local --without-python --without-mpi cd .. del /s /q boost_1_87_0 rmdir /s /q boost_1_87_0

Install fmt library.

cd \opt\src git clone https://github.com/fmtlib/fmt.git --branch 9.1.0 cd fmt cmake -DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=\opt\local -DCMAKE_INSTALL_LIBDIR=lib -DFMT_TEST=OFF -DFMT_MODULE=ON -S . -B build cmake --build build --target install -j8

Install range-v3 library.

git clone https://github.com/ericniebler/range-v3.git --branch 0.12.0 cd range-v3 cmake -DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=\opt\local -DCMAKE_INSTALL_LIBDIR=lib -DRANGE_V3_DOCS=OFF -DRANGE_V3_EXAMPLES=OFF -DRANGE_V3_PERF=OFF -DRANGE_V3_TESTS=OFF -DRANGE_V3_INSTALL=ON -B build -S . cmake --build build --target install -j8
cd \opt\src git clone -b v23.5.9 https://github.com/google/flatbuffers.git cd flatbuffers cmake -DFLATBUFFERS_BUILD_TESTS=OFF -DFLATBUFFERS_BUILD_CPP17=ON -DFLATBUFFERS_ENABLE_PCH=ON -DCMAKE_PREFIX_PATH=\opt\local -DCMAKE_INSTALL_PREFIX=\opt\local -S . -B build cmake --build build --target install -j8 cd .. del /s /q flatbuffers rmdir /s /q flatbuffers
cd \opt\src git clone https://github.com/Microsoft/vcpkg.git cd vcpkg .\bootstrap-vcpkg.bat -disableMetrics .\vcpkg integrate install --vcpkg-root \opt\src\vcpkg .\vcpkg install openssl:arm64-windows .\vcpkg install snappy:arm64-windows .\vcpkg install rocksdb:arm64-windows .\vcpkg install readline:arm64-windows

Install gflags if compiling RocksDB locally.

cd \opt\src git clone https://github.com/gflags/gflags.git cd gflags cmake -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_gflags_LIBS=ON -DINSTALL_HEADERS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=\opt\local -DCMAKE_INSTALL_PREFIX=\opt\local -S . -B cmake-build cmake --build cmake-build --target install -j8 cd .. del /s /q gflags rmdir /s /q gflags
cd \opt\src git clone -b v8.3.2 https://github.com/facebook/rocksdb.git cd rocksdb cmake -DWITH_TESTS=OFF -DWITH_ALL_TESTS=OFF -DWITH_BENCHMARK_TOOLS=OFF -DCMAKE_CXX_STANDARD=20 -DCMAKE_BUILD_TYPE=Release -DROCKSDB_BUILD_SHARED=OFF -DCMAKE_PREFIX_PATH=\opt\local -DCMAKE_INSTALL_PREFIX=\opt\local -DCMAKE_TOOLCHAIN_FILE="C:/opt/src/vcpkg/scripts/buildsystems/vcpkg.cmake" -S . -B build -G"Unix Makefiles" -DCMAKE_MAKE_PROGRAM=nmake set CL=/MP cmake --build build cd .. del /s /q rocksdb rmdir /s /q rocksdb

Launch the Visual Studio Command utility.


Note: I have not had any success attempting to build nghttp2-asio on Windows ARM64, hence the -DHTTP_SERVER=OFF option is required when invoking cmake.

cd %homepath%\source\repos git clone https://github.com/sptrakesh/config-db.git cd config-db cmake -DCMAKE_PREFIX_PATH=\opt\local -DCMAKE_INSTALL_PREFIX=\opt\spt -DCMAKE_TOOLCHAIN_FILE="C:/opt/src/vcpkg/scripts/buildsystems/vcpkg.cmake" -DHTTP_SERVER=Off -S . -B build cmake --build build --target install -j8

API Usage

The API can be used to communicate with the TCP service. Client code bases can use cmake to use the library.

find_package(ConfigDb REQUIRED COMPONENTS api) if (APPLE) include_directories(/usr/local/spt/include) else() include_directories(/opt/spt/include) endif (APPLE) target_link_libraries(${Target_Name} PRIVATE configdb::api ...)
# Run cmake cmake -DCMAKE_PREFIX_PATH="/usr/local/boost;/usr/local/spt" -S . -B build cmake --build build --parallel sudo cmake --install build
Last modified: 18 February 2025