Tuesday, September 29, 2020

Compile Trading System with C++17

 Library versions

 

gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC) 

boost_1_74_0

glog-0.4.0

libprotoc 3.13.0  (proto buffer)

NO ZeroMQ


Compile errors fixes

getopt_pp.h -> comment all throw(GetOptEx)

SyncCircularBuffer.h -> boost::interprocess::scoped_lock

boost bind errors -> boost::placeholders::_1 , boost::placeholders::_2

 

hash_map errors -> Just replace with std_map and do NOT use unordered_map. string search does not work with unordered_map

 

Exception errors -> Replace catch(Exception e) with catch catch(IoException &e) [& important]

floor function error -> Add #include <cmath>


Add  LIB += -lrt -lpthread to the Makefile for bellow error

undefined reference to symbol 'shm_unlink@@GLIBC_2.2.5'

undefined reference to symbol 'pthread_mutexattr_settype@@GLIBC_2.2.5'

Saturday, September 19, 2020

libevent

https://libevent.org/

https://github.com/libevent/libevent

 http://blog.gaurav.im/2014/12/15/a-gentle-intro-to-libevent/?fbclid=IwAR0-TS7VZblI959v_dnSSnoFoIFnRuPCso6s-clDJF-RI6UHAGbsZfcneGs

How to install

./configure

make

make install

 How to compile

g++ filename.cpp -levent -levent_core

 

if this error comes when running "error while loading shared libraries: libevent-2.1.so.7: cannot open "shared object file: No such file or directory

 sudo ln -s /usr/local/lib/libevent-2.1.so.7.0.1  /usr/local/lib/libevent-2.1.so.7

Wednesday, September 16, 2020

std::this_thread::yield

 https://en.cppreference.com/w/cpp/thread/yield

 

#include <iostream>
#include <chrono>
#include <thread>
 
// "busy sleep" while suggesting that other threads run
// for a small amount of time
void little_sleep(std::chrono::microseconds us)
{
    auto start = std::chrono::high_resolution_clock::now();
    auto end = start + us;
    do {
        std::this_thread::yield();
    } while (std::chrono::high_resolution_clock::now() < end);
}
 
int main()
{
    auto start = std::chrono::high_resolution_clock::now();
 
    little_sleep(std::chrono::microseconds(10000));
 
    auto elapsed = std::chrono::high_resolution_clock::now() - start;
    std::cout << "waited for "
              << std::chrono::duration_cast<std::chrono::microseconds>(elapsed).count()
              << " microseconds\n";
}

Thursday, September 10, 2020

C++ law latency communication libraries

 1. Solarflare OpenOnload (https://support.solarflare.com/wp/onload)


2. Hummingbird Code Software LLC (https://www.hummingbirdcode.net/p/hmbdc-is-c-framework-and-library-built.html)

 

3. eCAL (https://github.com/continental/ecal) 

 

4. shadesmar (https://github.com/Squadrick/shadesmar)


5. tcpshm (https://github.com/MengRao/tcpshm)


6. cpp-ipc (https://github.com/mutouyun/cpp-ipc)

Wednesday, September 9, 2020

eCAL How To Install in CentOS 8

 This is eCAL git repository

https://github.com/continental/ecal

*** install cMake

1. install git

yum insall git

2. Download eCAL repository

git clone https://github.com/continental/ecal.git


3. download third party libraries. 

git clone spdlog,tclap,tinyxml etc. 

BUT download  install protobuf from the release. (extract tar file, ./configure, make, make install)


4. README.md has mre detals how to install eCAL. Some third party can be optional

cmake .. -DCMAKE_BUILD_TYPE=Release -DECAL_THIRDPARTY_BUILD_PROTOBUF=OFF -DECAL_THIRDPARTY_BUILD_CURL=OFF -DECAL_THIRDPARTY_BUILD_HDF5=OFF -DHAS_QT5=OFF -DHAS_HDF5=OFF