Not able to build the executable binary in Ubuntu 20.04 for both gcc and clang

未关闭
#138 10 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
cpp
领域
build-system

调研方向

首先,在使用 Envoy v1.16.0 的 envoy-filter-example 中重现 bazel build //http-filter-example:envoy --config=clang,然后检查报告中提到的工具链配置和 bazel/setup_clang.sh。比较 GCC 和 Clang 的命令行,并确认使用文档所述的 Ubuntu 20.04 设置可以成功构建示例二进制文件。

由索引模型根据 Issue 内容生成。

描述

Hello, I am trying to build the http filter with envoy v1.16.0 . I tried using both gcc and clang but still no luck.

GCC

My specs are as follows.

  • bazel 3.4.1
  • gcc 9.3.0
  • gcc++ 9.3.0

When I try to build using the following commands,

git clone https://github.com/envoyproxy/envoy-filter-example.git
cd envoy-filter-example
git submodule update --init
cd envoy
git checkout v1.16.0
cd ..
bazel build //http-filter-example:envoy --config=clang

I get the following error.

ERROR: /home/khadija/.cache/bazel/_bazel_khadija/67b71b3527ed4854635b017e6b6cd642/external/com_googlesource_quiche/BUILD.bazel:2170:17: C++ compilation of rule '@com_googlesource_quiche//:quic_core_framer_lib' failed (Exit 1): gcc failed: error executing command 
  (cd /home/khadija/.cache/bazel/_bazel_khadija/67b71b3527ed4854635b017e6b6cd642/sandbox/linux-sandbox/2634/execroot/envoy_filter_example && \
  exec env - \
    BAZEL_LINKLIBS=-l%:libstdc++.a \
    BAZEL_LINKOPTS=-lm \
    CC=gcc \
    CXX=g++ \
    PATH=/home/khadija/.cache/bazelisk/downloads/bazelbuild/bazel-3.4.1-linux-x86_64/bin:/usr/lib/llvm-8/bin:/home/khadija/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin \
    PWD=/proc/self/cwd \`

[-Werror=sign-compare]
 5546 |         static_cast<size_t>(writer->remaining() - ecn_size) <
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
 5547 |             QuicDataWriter::GetVarInt62Len(gap) +
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~            
 5548 |                 QuicDataWriter::GetVarInt62Len(ack_range)) {
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
At global scope:
cc1plus: error: unrecognized command line option '-Wno-range-loop-analysis' [-Werror]
cc1plus: all warnings being treated as errors
Target //:envoy failed to build
Clang

I followed the instructions on bazel/ReadMe to download and configure Clang+llvm.

git clone https://github.com/envoyproxy/envoy-filter-example.git
cd envoy-filter-example
git submodule update --init
cd envoy
git checkout v1.16.0
bazel/setup_clang.sh ~/Downloads/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04
cd ..
bazel build //http-filter-example:envoy --config=clang

But I am getting the following error.

ERROR: /home/khadija/.cache/bazel/_bazel_khadija/b8963e6f21a84c9e75cda0cff04a3eb5/external/envoy/source/common/common/BUILD:321:23: C++ compilation of rule '@envoy//source/common/common:thread_impl_lib_posix' failed (Exit 1) gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 70 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
gcc: error: unrecognized command line option '-fno-limit-debug-info'
gcc: error: unrecognized command line option '-Wgnu-conditional-omitted-operand'
gcc: error: unrecognized command line option '-Wc++2a-extensions'; did you mean '-fms-extensions'?
gcc: error: unrecognized command line option '-Wrange-loop-analysis'
Target //http-filter-example:envoy failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.718s, Critical Path: 0.40s
INFO: 0 processes.
FAILED: Build did NOT complete successfully

Any idea ? I was using envoy v1.14.0 and it works fine. But with v1.16.0, I can't build using both gcc and clang. Tried for few days and still no luck.

主要语言
C++
星标
361
派生
220
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

envoyproxy/envoy-filter-example 的其他 Issue

查看 envoyproxy/envoy-filter-example 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。