sersync2編譯
1、下載boost編譯安裝
$ cd path/to/boost_1_64_0
$ ./bootstrap.sh --help
## 配置選項, 相當于configure
$ ./bootstrap.sh --prefix=/usr/local
## 相當于make
$ ./b2
## 相當于make install
$ ./b2 install
完成后boost庫將出現在/usr/local/lib目錄下
到sersync2源碼下直接執行命令make
將在build/Release目錄下生成.o等中間文件, 并且dist目錄下生成sersync2可執行文件
make報錯
boost庫安裝完成后再執行make, 出現
```
/usr/bin/ld: cannot find -lpthread
/usr/bin/ld: cannot find -lstdc++
/usr/bin/ld: cannot find -lm
/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
make[2]: *** [dist/Release/GNU-Linux-x86/sersync2] Error 1
make[2]: Leaving directory `/mnt/hgfs/home/Coding/sersync'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/mnt/hgfs/home/Coding/sersync'
make: *** [.build-impl] Error 2
經過查找, makefile實際生效的是`nbproject/Makefile-Release.mk`, 其中`LDLIBSOPTIONS`選項是編譯操作的關鍵字段
去掉`-static`參數, 添加`libpthread.so`的位置`-L/lib64`
vi nbproject/Makefile-Release.mk
LDLIBSOPTIONS=-Llib -L/lib64 -L/usr/lib64 -L/usr/local/lib -lboost_thread -lboost_regex -lboost_system -lboost_date_time -lpthread -lrt -static-libgcc
出現問題看readme-detail.md文件有解決方法
浙公網安備 33010602011771號