本来想编译paxosstore的example,没想到最终还是失败了。
git clone https://github.com/Tencent/paxosstore.git
cd paxosstore
git submodule update --init --recursive
然后安装有用的库:
apt install zlib1g-dev libssl-dev libpcap-dev libelf-dev libicu-dev libreadline-dev libtool libsysfs-dev \
libsqlite3-dev libbz2-dev libreadline-dev zlib1g-dev liblzma-dev liblzo2-dev \
libsnappy-dev liblz4-dev libzstd-dev libgflags-dev libprotoc-dev
编译:
cd certain
./build.sh example
会报错:network/IOChannel.cpp:127:16: error: ‘writev’ was not declared in this scope
然后在network/IOChannel.cpp
添加头文件:
#include<sys/uio.h>
接着报错:error: this statement may fall through [-Werror=implicit-fallthrough=]
解决方法:
export CFLAGS='-Wno-implicit-fallthrough'
然后报错:
./third/protobuf/src/protoc --grpc_out=./ --plugin=protoc-gen-grpc=./third/grpc/bins/opt/grpc_cpp_plugin example/example.proto
./third/grpc/bins/opt/grpc_cpp_plugin: program not found or is not executable
--grpc_out: protoc-gen-grpc: Plugin failed with status code 1.
Makefile:95: recipe for target 'example/example.grpc.pb.cc' failed
make: *** [example/example.grpc.pb.cc] Error 1
make: *** Waiting for unfinished jobs....
rm src/Certain.pb.cc
参考:grpc/run_distrib_test_cmake.sh at master · grpc/grpc
这是因为grpc编译没完成,有错误,解决方法:
mv grpc grpc2
git clone https://github.com/grpc/grpc.git
cd grpc
git submodule update --init
make REQUIRE_CUSTOM_LIBRARIES_opt=1 static
cmake . -DgRPC_PROTOBUF_PROVIDER=package -DgRPC_ZLIB_PROVIDER=package -DgRPC_CARES_PROVIDER=package -DgRPC_SSL_PROVIDER=package
make
cp *.a libs/opt/
可能会报错:
g++: error: ./third/grpc/libs/opt/libboringssl.a: No such file or directory
g++: error: ./third/grpc/libs/opt/libgpr.a: No such file or directory
g++: error