AnyQ安装踩坑

环境: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 #使配置生效
要实现提取问题中的参数并调用API,你需要进行以下步骤: 1. 对问题进行自然语言处理。你可以使用Python中的自然语言处理库,例如NLTK、spaCy、Stanford NLP等,来对问题进行分析和解析。 2. 从问题中提取参数。一旦你对问题进行了解析,就可以使用词性标注和命名实体识别等技术来提取参数。例如,如果问题是“北京天气怎么样?”,你可以使用命名实体识别来找到“北京”这个地点的参数。 3. 调用API。一旦你提取出了参数,就可以使用它们来调用相应的API。例如,如果你想要查询北京的天气,你可以使用天气API,并将“北京”作为参数传递给该API。 下面是一个简单的Python代码示例,演示如何从问题中提取参数并调用API: ```python import requests import json import nltk # 问题 question = "北京天气怎么样?" # 分词和词性标注 tokens = nltk.word_tokenize(question) tags = nltk.pos_tag(tokens) # 命名实体识别 ne_chunked = nltk.ne_chunk(tags) entities = [] for chunk in ne_chunked: if hasattr(chunk, 'label') and chunk.label() == 'GPE': entities.append(' '.join(c[0] for c in chunk)) # 调用API if len(entities) > 0: url = "http://api.openweathermap.org/data/2.5/weather?q={}&appid=your_app_id".format(entities[0]) response = requests.get(url) data = json.loads(response.text) print("天气:{}".format(data['weather'][0]['description'])) else: print("无法识别问题中的地点参数") ``` 在这个示例中,我们使用NLTK库对问题进行了分词和词性标注,然后使用命名实体识别找到了问题中的地点参数。接着,我们使用天气API来查询该地点的天气,并将查询结果输出到控制台中。 希望这个示例可以帮助你实现提取问题中的参数并调用API的功能。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值