编译echo测试程序失败,brpc是通过cmake方式编译的
分支:On branch 1.9.0 通过cmake方式构建
CMake Deprecation Warning at CMakeLists.txt:18 (cmake_minimum_required): Compatibility with CMake < 2.8.12 will be removed from a future version of CMake.
Update the VERSION argument
-- The C compiler identification is Clang 14.0.0
-- The CXX compiler identification is Clang 14.0.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found Protobuf: /usr/local/lib/libprotobuf.so (found version "3.19.4")
CMake Error at CMakeLists.txt:50 (message):
Fail to find brpc
-- Configuring incomplete, errors occurred! See also "/home/fanghongbin/brpc/example/echo_c++/build/CMakeFiles/CMakeOutput.log".
构建目录 f@DESKTOP-UB1M0MH:~/brpc/build$ ls output/ bin include lib f@DESKTOP-UB1M0MH:~/brpc/build$ ls output/lib/ libbrpc.a 只有静态库没有动态库
你把这个文件里的 /home/fanghongbin/brpc/example/echo_c++/build/CMakeFiles/CMakeOutput.log 错误log 发上来啊😂
cmake编译brpc动态库,需要添加编译命令-DBUILD_SHARED_LIBS=ON 我这边使用的全部命令是
拉取项目
https://github.com/apache/brpc.git cd brpc git checkout 1.9.0
cmake编译brpc
mkdir build && cd build cmake -DCMAKE_CXX_COMPILER=$(which g++) -DCMAKE_C_COMPILER=$(which gcc) -DWITH_RDMA=ON -DBUILD_SHARED_LIBS=ON .. make -j16 make install
编译echo_c++ example
cd ../example/echo_c++/ mkdir build && cd build cmake -DCMAKE_CXX_COMPILER=$(which g++) -DCMAKE_C_COMPILER=$(which gcc) -DLINK_SO=ON .. make -j16