Linux 6.2.0-39-generic #40~22.04.1-Ubuntu ?x86_64 x86_64 x86_64 GNU/Linux
### 安装编译环境必要工具
sudo apt install build-essential -y
sudo apt install cmake -y
sudo apt-get install p7zip-full -y
boost_1_72_0.tar.gz,解压后需修改vboost/thread/pthread/thread_data.hpp,添加
#undef PTHREAD_STACK_MIN
#define PTHREAD_STACK_MIN 16384
编译
bootstrap.sh
./b2 -j10 release cflags=-fPIC cxxflags=-fPIC install --layout=versioned threading=multi --prefix="/path/boost-1_72" --without-python --without-graph --without-graph_parallel --without-mpi --without-wave --without-test --without-log
git clone https://github.com/nanomsg/nanomsg.git
cd nanomsg
## 切换到发布的tag
git checkout 1.2
## 编译静态库
cmake -DCMAKE_INSTALL_PREFIX=/path/nanomsg -DCMAKE_BUILD_TYPE=Release -DNN_STATIC_LIB=ON ..
make -j10 && make install
编译之前修改CMakeLists.txt,添加-fPIC参数
git clone https://github.com/gabime/spdlog.git
cd spdlog
### 切换到发布的tag
git checkout v1.9.2
cmake -DCMAKE_INSTALL_PREFIX=/path/spdlog -DCMAKE_BUILD_TYPE=Release ..
make -j10 && make install
git clone https://github.com/Tencent/rapidjson.git
cd rapidjson
git checkout v1.1.0
## 使用include目录下的头文件即可
编译依赖完成之后,拷贝到头文件和依赖库
cp nanomsg/ /deps/wtcpp/include -r
cp boost/ /deps/wtcpp/include/ -r
cp rapidjson/ /deps/wtcpp/include -r
cp spdlog/ /deps/wtcpp/include -r
cp libnanomsg.a /deps/wtcpp/lib
cp libboost_chrono-gcc11-mt-x64-1_72.a /deps/wtcpp/lib/libboost_chrono.a
cp libboost_date_time-gcc11-mt-x64-1_72.a /deps/wtcpp/lib/libboost_date_time.a
cp libboost_filesystem-gcc11-mt-x64-1_72.a /deps/wtcpp/lib/libboost_filesystem.a
cp libboost_regex-gcc11-mt-x64-1_72.a /deps/wtcpp/lib/libboost_regex
cp libboost_regex-gcc11-mt-x64-1_72.a /deps/wtcpp/lib/libboost_regex.a
cp libboost_thread-gcc11-mt-x64-1_72.a /deps/wtcpp/lib/libboost_thread.a
.
├── include
│???├── boost
│???├── nanomsg
│???├── rapidjson
│???└── spdlog
└── lib
? ? ├── libboost_chrono.a
? ? ├── libboost_date_time.a
? ? ├── libboost_filesystem.a
? ? ├── libboost_regex.a
? ? ├── libboost_thread.a
? ? └── libnanomsg.a
附上编译后的下载链接,https://download.csdn.net/download/chenaschen/88685561
设置依赖环境,修改了原来版本设置固定路径的方式,使用环境变量。
export MyDependsGcc=/deps/wtcpp
下载好代码之后,切到分支
cd wondertrader/src
## 编译debug
build_debug.sh
## 编译release
build_release.sh