一次失败的尝试:paxosstore示例编译

本来想编译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: ./third/grpc/libs/opt/libgrpc.a: No such file or directory
g++: error: ./third/grpc/libs/opt/libgrpc++.a: No such file or directory
g++: error: ./third/grpc/libs/opt/libgrpc++_core_stats.a: No such file or directory
g++: error: ./third/grpc/libs/opt/libgrpc++_cronet.a: No such file or directory
g++: error: ./third/grpc/libs/opt/libgrpc_cronet.a: No such file or directory
g++: error: ./third/grpc/libs/opt/libgrpc++_error_details.a: No such file or directory
g++: error: ./third/grpc/libs/opt/libgrpc_plugin_support.a: No such file or directory
g++: error: ./third/grpc/libs/opt/libgrpc_unsecure.a: No such file or directory
g++: error: ./third/grpc/libs/opt/libgrpc++_unsecure.a: No such file or directory
g++: error: ./third/grpc/libs/opt/libz.a: No such file or directory
g++: error: ./third/grpc/libs/opt/libgrpc++_reflection.a: No such file or directory

解决方法:

cd third_party/cares/cares
mkdir -p cmake/build
cd cmake/build
cmake -DCMAKE_BUILD_TYPE=Release ../..
make -j4 install
cd ../../../../..


# Install zlib
cd third_party/zlib
mkdir -p cmake/build
cd cmake/build
cmake -DCMAKE_BUILD_TYPE=Release ../..
make -j4 install
cd ../../../..


# Install protobuf
cd third_party/protobuf
mkdir -p cmake/build
cd cmake/build
cmake -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release ..
make -j4 install
cd ../../../..

# Install gRPC
mkdir -p cmake/build
cd cmake/build
cmake -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DgRPC_PROTOBUF_PROVIDER=package -DgRPC_ZLIB_PROVIDER=package -DgRPC_CARES_PROVIDER=package -DgRPC_SSL_PROVIDER=package -DCMAKE_BUILD_TYPE=Release ../..
make -j4 install
cd ../..

最终报错如下:


./third/grpc/libs/opt/libgrpc.a(call_log_batch.o):/home/zhang/grpc/src/core/lib/surface/call_log_batch.cc:46: first defined here
./third/grpc/libs/opt/libgrpc++_cronet.a(completion_queue.cc.o):(.data.rel.local+0x0): multiple definition of `grpc_trace_operation_failures'
./third/grpc/libs/opt/libgrpc.a(completion_queue.o):(.bss+0x20): first defined here
./third/grpc/libs/opt/libgrpc++_cronet.a(completion_queue.cc.o):(.data.rel.local+0x10): multiple definition of `grpc_trace_pending_tags'
./third/grpc/libs/opt/libgrpc.a(completion_queue.o):(.bss+0x19): first defined here
./third/grpc/libs/opt/libgrpc++_cronet.a(completion_queue.cc.o):(.data.rel.local+0x20): multiple definition of `grpc_trace_cq_refcount'
./third/grpc/libs/opt/libgrpc.a(completion_queue.o):(.bss+0x18): first defined here
./third/grpc/libs/opt/libgrpc++_cronet.a(completion_queue.cc.o):(.data.rel.local+0x30): multiple definition of `grpc_cq_pluck_trace'
./third/grpc/libs/opt/libgrpc.a(completion_queue.o):(.bss+0x0): first defined here
./third/grpc/libs/opt/libgrpc++_cronet.a(completion_queue.cc.o): In function `grpc_completion_queue_next':
completion_queue.cc:(.text+0x20e8): multiple definition of `grpc_completion_queue_next'
./third/grpc/libs/opt/libgrpc.a(completion_queue.o):/home/zhang/grpc/src/core/lib/surface/completion_queue.cc:1118: first defined here
./third/grpc/libs/opt/libgrpc++_cronet.a(completion_queue.cc.o): In function `grpc_completion_queue_pluck':
completion_queue.cc:(.text+0x2cd7): multiple definition of `grpc_completion_queue_pluck'
./third/grpc/libs/opt/libgrpc.a(completion_queue.o):/home/zhang/grpc/src/core/lib/surface/completion_queue.cc:1312: first defined here
./third/grpc/libs/opt/libgrpc++_cronet.a(completion_queue.cc.o): In function `grpc_completion_queue_shutdown':
completion_queue.cc:(.text+0x2f0c): multiple definition of `grpc_completion_queue_shutdown'
./third/grpc/libs/opt/libgrpc.a(completion_queue.o):/home/zhang/grpc/src/core/lib/surface/completion_queue.cc:1400: first defined here
./third/grpc/libs/opt/libgrpc++_cronet.a(completion_queue.cc.o): In function `grpc_completion_queue_destroy':
completion_queue.cc:(.text+0x2ffd): multiple definition of `grpc_completion_queue_destroy'
./third/grpc/libs/opt/libgrpc.a(completion_queue.o):/home/zhang/grpc/src/core/lib/surface/completion_queue.cc:1408: first defined here
./third/grpc/libs/opt/libgrpc++_cronet.a(server.cc.o):(.data.rel.local+0x0): multiple definition of `grpc_server_channel_trace'
./third/grpc/libs/opt/libgrpc.a(server.o):(.bss+0x0): first defined here
./third/grpc/libs/opt/libgrpc++_cronet.a(server.cc.o):(.data.rel.ro+0x0): multiple definition of `grpc_server_top_filter'
./third/grpc/libs/opt/libgrpc.a(server.o):(.data.rel.ro+0x0): first defined here
./third/grpc/libs/opt/libgrpc++_cronet.a(server.cc.o): In function `grpc_server_register_completion_queue':
server.cc:(.text+0x2b4c): multiple definition of `grpc_server_register_completion_queue'
./third/grpc/libs/opt/libgrpc.a(server.o):/home/zhang/grpc/src/core/lib/surface/server.cc:1005: first defined here
./third/grpc/libs/opt/libgrpc++_cronet.a(server.cc.o): In function `grpc_server_create':
server.cc:(.text+0x2bfa): multiple definition of `grpc_server_create'
./third/grpc/libs/opt/libgrpc.a(server.o):/home/zhang/grpc/src/core/lib/surface/server.cc:1022: first defined here
./third/grpc/libs/opt/libgrpc++_cronet.a(server.cc.o): In function `grpc_server_register_method':
server.cc:(.text+0x2d53): multiple definition of `grpc_server_register_method'
./third/grpc/libs/opt/libgrpc.a(server.o):/home/zhang/grpc/src/core/lib/surface/server.cc:1077: first defined here
./third/grpc/libs/opt/libgrpc++_cronet.a(server.cc.o): In function `grpc_server_start':

只能说我找了很多解决方案,最终还是没找到解决方法,这次尝试算是比较失败的一次了。

毕竟花费了挺多的时间,最终解决不了还是挺不爽的。

发布了543 篇原创文章 · 获赞 222 · 访问量 70万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览