Tencent / flare

Flare是广泛投产于腾讯广告后台的现代化C++开发框架,包含了基础库、RPC、各种客户端等。主要特点为易用性强、长尾延迟低。
Other
1.33k stars 200 forks source link

bazel build ... 失败 #125

Closed liphx closed 1 year ago

liphx commented 1 year ago
checking run-time libs availability... failed
configure: error: one or more libs available at link-time are not available run-time. Libs used at link-time: -lnghttp2   -lssl -lcrypto -lz 
_____ END BUILD LOGS _____
rules_foreign_cc: Build wrapper script location: bazel-out/k8-fastbuild/bin/external/com_github_curl_curl/curl_foreign_cc/wrapper_build_script.sh
rules_foreign_cc: Build script location: bazel-out/k8-fastbuild/bin/external/com_github_curl_curl/curl_foreign_cc/build_script.sh
rules_foreign_cc: Build log location: bazel-out/k8-fastbuild/bin/external/com_github_curl_curl/curl_foreign_cc/Configure.log
liphx commented 1 year ago

bazel 6.3.2

4kangjc commented 1 year ago

没有复现出来,看这的信息也看不出具体原因。用一个干净的docker容器编译一下试试。

liphx commented 1 year ago

应该是编译第三方依赖时缺少libtool,下面的测试ok了

docker run -it debian bash

# in docker
apt update && apt install git python3 -y && git clone https://github.com/Tencent/flare.git

# install bazel
# https://bazel.build/install/ubuntu?hl=zh-cn

cd flare/
bazel build ...
# configure: error: --with-nghttp2 was specified but could not find libnghttp2 pkg-config file.

# apt install -y autoconf libtool libnghttp2-dev
# build ok
4kangjc commented 1 year ago

应该是编译第三方依赖时缺少libtool,下面的测试ok了

docker run -it debian bash

# in docker
apt update && apt install git python3 -y && git clone https://github.com/Tencent/flare.git

# install bazel
# https://bazel.build/install/ubuntu?hl=zh-cn

cd flare/
bazel build ...
# configure: error: --with-nghttp2 was specified but could not find libnghttp2 pkg-config file.

# apt install -y autoconf libtool libnghttp2-dev
# build ok

那看上去应该是缺失autotools, 编译nghttp2,jemalloc,ctemplate和gperftools都用的是configure_make

liphx commented 1 year ago

应该是编译第三方依赖时缺少libtool,下面的测试ok了

docker run -it debian bash

# in docker
apt update && apt install git python3 -y && git clone https://github.com/Tencent/flare.git

# install bazel
# https://bazel.build/install/ubuntu?hl=zh-cn

cd flare/
bazel build ...
# configure: error: --with-nghttp2 was specified but could not find libnghttp2 pkg-config file.

# apt install -y autoconf libtool libnghttp2-dev
# build ok

那看上去应该是缺失autotools, 编译nghttp2,jemalloc,ctemplate和gperftools都用的是configure_make

新容器里autoconf libtool libnghttp2-dev 都需要安装 libnghttp2-dev是为了pkgconfig,最后应该还是链接的flare里编译出的库 libtool的问题参考下面链接 https://stackoverflow.com/questions/18978252/error-libtool-library-used-but-libtool-is-undefined

4kangjc commented 1 year ago

应该是编译第三方依赖时缺少libtool,下面的测试ok了

docker run -it debian bash

# in docker
apt update && apt install git python3 -y && git clone https://github.com/Tencent/flare.git

# install bazel
# https://bazel.build/install/ubuntu?hl=zh-cn

cd flare/
bazel build ...
# configure: error: --with-nghttp2 was specified but could not find libnghttp2 pkg-config file.

# apt install -y autoconf libtool libnghttp2-dev
# build ok

那看上去应该是缺失autotools, 编译nghttp2,jemalloc,ctemplate和gperftools都用的是configure_make

新容器里autoconf libtool libnghttp2-dev 都需要安装 libnghttp2-dev是为了pkgconfig,最后应该还是链接的flare里编译出的库 libtool的问题参考下面链接 https://stackoverflow.com/questions/18978252/error-libtool-library-used-but-libtool-is-undefined

容器镜像使用GCC11(理论上GCC8以上就行)即可,如果是x86-64换成将bazel换成x86_64即可

FROM gcc:11

CMD git clone https://github.com/Tencent/flare.git && cd flare && \
 wget https://github.com/bazelbuild/bazel/releases/download/6.3.2/bazel-6.3.2-linux-arm64 && \
  chmod +x bazel-6.3.2-linux-arm64 && \
 ./bazel-6.3.2-linux-arm64 build ...