环境:linux ubuntu22.04,gcc/g++ 5,cmake 3.3.2,bison 3.0
1.gcc版本问题
make过程出现以下错误,原因是gcc版本过高,ubuntu22.04默认gcc版本是11及以上,且无法安装低版本,可以通过更换apt源来获取低版本,官方要求4.8.5以上,我安装的5也可
高版本Ubuntu(如22.02)修改apt源,快速安装低版本gcc/g++
/usr/include/c++/11/bits/stl_tree.h:770:15: error: static assertion failed: comparison object must be invocable as const
770 | is_invocable_v<const _Compare&, const _Key&, const _Key&>,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2.git clone问题
Failed to clone 'third_party/benchmark'. Retry scheduled
Cloning into '/paddle/Paddle/build/third_party/protobuf/src/extern_protobuf/third_party/benchmark'...
fatal: unable to access 'https://github.com/google/benchmark.git/': Failed to connect to github.com port 443: Connection refused
网络问题,重试几遍,如果提示文件已存在则把build/third_party中包对应的文件删除,重新执行cmake … && make
后来发现经常clone失败是因为没有设置git用户邮箱以及ssh key
3.boost安装问题
(try: 6) https://altushost-swe.dl.sourceforge.net/project/boost/boost/1.41.0/boost_1_41_0.tar.gz
Connecting to altushost-swe.dl.sourceforge.net (altushost-swe.dl.sourceforge.net)|79.142.76.130|:443... ^Cmake[2]: *** [CMakeFiles/extern_boost.dir/build.make:89: third_party/boost/src/extern_boost-stamp/extern_boost-download] Interrupt
make[1]: *** [CMakeFiles/Makefile2:225: CMakeFiles/extern_boost.dir/all] Interrupt
make: *** [Makefile:84: all] Interrupt
发现下载boost网址中1.41.0无法下载,1.42.0可以,修改AnyQ/cmake/external/boost.cmake,把所有的41改成42
4.openssl安装失败
/root/AnyQ/build/third_party/openssl/src/openssl
Operating system: x86_64-whatever-linux2
"glob" is not exported by the File::Glob module
Can't continue after import errors at ./Configure line 17.
BEGIN failed--compilation aborted at ./Configure line 17.
"glob" is not exported by the File::Glob module
Can't continue after import errors at ./Configure line 17.
BEGIN failed--compilation aborted at ./Configure line 17.
This system (linux-x86_64) is not supported. See file INSTALL for details.
/root/AnyQ/build/third_party/openssl/src/openssl
make[3]: Entering directory '/root/AnyQ/build/third_party/openssl/src/openssl'
make[3]: *** No targets specified and no makefile found. Stop.
make[3]: Leaving directory '/root/AnyQ/build/third_party/openssl/src/openssl'
make[2]: *** [CMakeFiles/extern_openssl.dir/build.make:74: third_party/openssl/src/extern_openssl-stamp/extern_openssl-install] Error 2
修改AnyQ/build/third_party/openssl/src/openssl/Configure文件
#use if $^O ne "VMS", 'File::Glob' => qw/glob/;
# 修改为
use if $^O ne "VMS", 'File::Glob' => qw/:glob/;
修改AnyQ/build/third_party/openssl/src/openssl/test/build.info文件
use if $^O ne "VMS", 'File::Glob' => qw/glob/;
# 同样进行修改
use if $^O ne "VMS", 'File::Glob' => qw/:glob/;
5.xgboost安装失败
Cloning into '/root/AnyQ/build/third_party/xgboost/src/xgboost/dmlc-core'...
error: RPC failed; curl 16 Error in the HTTP2 framing layer
fatal: expected flush after ref listing
fatal: clone of 'https://github.com/dmlc/dmlc-core' into submodule path '/root/AnyQ/build/third_party/xgboost/src/xgboost/dmlc-core' failed
Failed to clone 'dmlc-core'. Retry scheduled
Cloning into '/root/AnyQ/build/third_party/xgboost/src/xgboost/rabit'...
^Cwarning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'
make[2]: *** [CMakeFiles/extern_xgboost.dir/build.make:89: third_party/xgboost/src/extern_xgboost-stamp/extern_xgboost-download] Interrupt
make[1]: *** [CMakeFiles/Makefile2:710: CMakeFiles/extern_xgboost.dir/all] Interrupt
make: *** [Makefile:84: all] Interrupt
指定版本,修改/AnyQ/cmake/external/xgboost.cmake文件
DOWNLOAD_COMMAND git clone -b v0.90 --recursive https://github.com/dmlc/xgboost.git && cd xgboost && git checkout v0.90
6.brpc编译失败
In file included from /usr/include/features.h:486,
from /usr/include/x86_64-linux-gnu/c++/11/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/11/bits/c++config.h:586,
from /usr/include/c++/11/limits:42,
from ./brpc/rtmp.pb.h:7,
from brpc/rtmp.pb.cc:4:
/usr/include/x86_64-linux-gnu/sys/cdefs.h:314:60: error: macro "__has_attribute" requires an identifier
314 | #if __GNUC_PREREQ (2,5) || __glibc_has_attribute (__const__)
|
参考Fix const compile error in gcc version >= 11.2.0修改Makefile和config_brpc.sh中的-D__const__
Packing libbrpc.a Linking protoc-gen-mcpack /usr/bin/ld: libbrpc.a(mutex.o): in function `bthread::init_sys_mutex_lock()':
/root/AnyQ/build/third_party/brpc/src/brpc/src/bthread/mutex.cpp:407: undefined reference to `_dl_sym'
/usr/bin/ld: /root/AnyQ/build/third_party/brpc/src/brpc/src/bthread/mutex.cpp:408: undefined reference to `_dl_sym'
collect2: error: ld returned 1 exit status
参考libbrpc.so: undefined reference to `_dl_sym’ #1779
修复代码
直接将brpc的版本改为1.2.0有用
DOWNLOAD_COMMAND git clone https://github.com/brpc/brpc.git && cd brpc && git checkout 1.2.0
7.libiomp5.so动态库找不到
./run_server: error while loading shared libraries: libiomp5.so: cannot open shared object file: No such file or directory
cd /etc/ld.so.conf
touch anyq-libs.conf #在该文件中写入anyq lib文件路径,如/usr/AnyQ/build/third_party/lib
ldconfig #使配置生效