编译WonderTrader

环境:

gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)

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

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
  • nanomsg
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参数

  • spdlog
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
  • rapidjson
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

编译WonderTrader

设置依赖环境,修改了原来版本设置固定路径的方式,使用环境变量。

export MyDependsGcc=/deps/wtcpp

下载好代码之后,切到分支

cd wondertrader/src
## 编译debug
build_debug.sh
## 编译release
build_release.sh

  • 8
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值