I am trying to build envoy latest code using bazel.
I have installed all the required dependencies and then executed
bazel build //source/exe:envoy-static
Got below error:
/home/i309801/Desktop/envoy/source/extensions/filters/network/kafka/BUILD:92:1: C++ compilation of rule '//source/extensions/filters/network/kafka:serialization_lib' failed (Exit 1) envoy_cc_wrapper failed:
There was a general build breakage that was fixed today, so closing for now. If you are still having an issue, can you give more details about your platform and the environment and re-open?
I took the latest code today and facing same error. Hence reopening this issue.
Further Details:
Ubuntu 16.04 LTS
clang version 8.0.0
Bazel version 0.25.0
go version go1.12.5 linux/amd64
Let me know if you need further details.
I am not able to re-open this issue .
Can you attach the complete output of your bazel command?
ERROR: /home/i309801/Desktop/envoy/source/extensions/filters/network/kafka/BUILD:92:1: C++ compilation of rule '//source/extensions/filters/network/kafka:serialization_lib' failed (Exit 1) envoy_cc_wrapper failed: error executing command /home/i309801/.cache/bazel/_bazel_i309801/b6d0838a6096d725b6cb04aa30aa8841/external/local_config_cc/extra_tools/envoy_cc_wrapper -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter ... (remaining 72 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
In file included from source/extensions/filters/network/kafka/serialization.cc:1:0:
bazel-out/k8-fastbuild/bin/source/extensions/filters/network/kafka/_virtual_includes/serialization_lib/extensions/filters/network/kafka/serialization.h: In member function 'uint32_t Envoy::Extensions::NetworkFilters::Kafka::EncodingContext::computeSize(const T&) const [with T = bool; uint32_t = unsigned int]':
bazel-out/k8-fastbuild/bin/source/extensions/filters/network/kafka/_virtual_includes/serialization_lib/extensions/filters/network/kafka/serialization.h:526:34: error: enclosing class of constexpr non-static member function 'uint32_t Envoy::Extensions::NetworkFilters::Kafka::EncodingContext::computeSize(const T&) const [with T = bool; uint32_t = unsigned int]' is not a literal type
template <> constexpr uint32_t EncodingContext::computeSize(const TYPE&) const { \
^
bazel-out/k8-fastbuild/bin/source/extensions/filters/network/kafka/_virtual_includes/serialization_lib/extensions/filters/network/kafka/serialization.h:530:1: note: in expansion of macro 'COMPUTE_SIZE_OF_NUMERIC_TYPE'
COMPUTE_SIZE_OF_NUMERIC_TYPE(bool)
^
bazel-out/k8-fastbuild/bin/source/extensions/filters/network/kafka/_virtual_includes/serialization_lib/extensions/filters/network/kafka/serialization.h:468:7: note: 'Envoy::Extensions::NetworkFilters::Kafka::EncodingContext' is not literal because:
class EncodingContext {
^
bazel-out/k8-fastbuild/bin/source/extensions/filters/network/kafka/_virtual_includes/serialization_lib/extensions/filters/network/kafka/serialization.h:468:7: note: 'Envoy::Extensions::NetworkFilters::Kafka::EncodingContext' is not an aggregate, does not have a trivial default constructor, and has no constexpr constructor that is not a copy or move constructor
bazel-out/k8-fastbuild/bin/source/extensions/filters/network/kafka/_virtual_includes/serialization_lib/extensions/filters/network/kafka/serialization.h: In member function 'uint32_t Envoy::Extensions::NetworkFilters::Kafka::EncodingContext::computeSize(const T&) const [with T = signed char; uint32_t = unsigned int]':
bazel-out/k8-fastbuild/bin/source/extensions/filters/network/kafka/_virtual_includes/serialization_lib/extensions/filters/network/kafka/serialization.h:526:34: error: enclosing class of constexpr non-static member function 'uint32_t Envoy::Extensions::NetworkFilters::Kafka::EncodingContext::computeSize(const T&) const [with T = signed char; uint32_t = unsigned int]' is not a literal type
template <> constexpr uint32_t EncodingContext::computeSize(const TYPE&) const { \
^
bazel-out/k8-fastbuild/bin/source/extensions/filters/network/kafka/_virtual_includes/serialization_lib/extensions/filters/network/kafka/serialization.h:531:1: note: in expansion of macro 'COMPUTE_SIZE_OF_NUMERIC_TYPE'
COMPUTE_SIZE_OF_NUMERIC_TYPE(int8_t)
^
bazel-out/k8-fastbuild/bin/source/extensions/filters/network/kafka/_virtual_includes/serialization_lib/extensions/filters/network/kafka/serialization.h: In member function 'uint32_t Envoy::Extensions::NetworkFilters::Kafka::EncodingContext::computeSize(const T&) const [with T = short int; uint32_t = unsigned int]':
bazel-out/k8-fastbuild/bin/source/extensions/filters/network/kafka/_virtual_includes/serialization_lib/extensions/filters/network/kafka/serialization.h:526:34: error: enclosing class of constexpr non-static member function 'uint32_t Envoy::Extensions::NetworkFilters::Kafka::EncodingContext::computeSize(const T&) const [with T = short int; uint32_t = unsigned int]' is not a literal type
template <> constexpr uint32_t EncodingContext::computeSize(const TYPE&) const { \
^
bazel-out/k8-fastbuild/bin/source/extensions/filters/network/kafka/_virtual_includes/serialization_lib/extensions/filters/network/kafka/serialization.h:532:1: note: in expansion of macro 'COMPUTE_SIZE_OF_NUMERIC_TYPE'
COMPUTE_SIZE_OF_NUMERIC_TYPE(int16_t)
^
bazel-out/k8-fastbuild/bin/source/extensions/filters/network/kafka/_virtual_includes/serialization_lib/extensions/filters/network/kafka/serialization.h: In member function 'uint32_t Envoy::Extensions::NetworkFilters::Kafka::EncodingContext::computeSize(const T&) const [with T = int; uint32_t = unsigned int]':
bazel-out/k8-fastbuild/bin/source/extensions/filters/network/kafka/_virtual_includes/serialization_lib/extensions/filters/network/kafka/serialization.h:526:34: error: enclosing class of constexpr non-static member function 'uint32_t Envoy::Extensions::NetworkFilters::Kafka::EncodingContext::computeSize(const T&) const [with T = int; uint32_t = unsigned int]' is not a literal type
template <> constexpr uint32_t EncodingContext::computeSize(const TYPE&) const { \
^
bazel-out/k8-fastbuild/bin/source/extensions/filters/network/kafka/_virtual_includes/serialization_lib/extensions/filters/network/kafka/serialization.h:533:1: note: in expansion of macro 'COMPUTE_SIZE_OF_NUMERIC_TYPE'
COMPUTE_SIZE_OF_NUMERIC_TYPE(int32_t)
^
bazel-out/k8-fastbuild/bin/source/extensions/filters/network/kafka/_virtual_includes/serialization_lib/extensions/filters/network/kafka/serialization.h: In member function 'uint32_t Envoy::Extensions::NetworkFilters::Kafka::EncodingContext::computeSize(const T&) const [with T = unsigned int; uint32_t = unsigned int]':
bazel-out/k8-fastbuild/bin/source/extensions/filters/network/kafka/_virtual_includes/serialization_lib/extensions/filters/network/kafka/serialization.h:526:34: error: enclosing class of constexpr non-static member function 'uint32_t Envoy::Extensions::NetworkFilters::Kafka::EncodingContext::computeSize(const T&) const [with T = unsigned int; uint32_t = unsigned int]' is not a literal type
template <> constexpr uint32_t EncodingContext::computeSize(const TYPE&) const { \
^
bazel-out/k8-fastbuild/bin/source/extensions/filters/network/kafka/_virtual_includes/serialization_lib/extensions/filters/network/kafka/serialization.h:534:1: note: in expansion of macro 'COMPUTE_SIZE_OF_NUMERIC_TYPE'
COMPUTE_SIZE_OF_NUMERIC_TYPE(uint32_t)
^
bazel-out/k8-fastbuild/bin/source/extensions/filters/network/kafka/_virtual_includes/serialization_lib/extensions/filters/network/kafka/serialization.h: In member function 'uint32_t Envoy::Extensions::NetworkFilters::Kafka::EncodingContext::computeSize(const T&) const [with T = long int; uint32_t = unsigned int]':
bazel-out/k8-fastbuild/bin/source/extensions/filters/network/kafka/_virtual_includes/serialization_lib/extensions/filters/network/kafka/serialization.h:526:34: error: enclosing class of constexpr non-static member function 'uint32_t Envoy::Extensions::NetworkFilters::Kafka::EncodingContext::computeSize(const T&) const [with T = long int; uint32_t = unsigned int]' is not a literal type
template <> constexpr uint32_t EncodingContext::computeSize(const TYPE&) const { \
^
bazel-out/k8-fastbuild/bin/source/extensions/filters/network/kafka/_virtual_includes/serialization_lib/extensions/filters/network/kafka/serialization.h:535:1: note: in expansion of macro 'COMPUTE_SIZE_OF_NUMERIC_TYPE'
COMPUTE_SIZE_OF_NUMERIC_TYPE(int64_t)
^
Target //source/exe:envoy-static failed to build
Thanks. I am wondering if this is specific to the Kafka extension or if you can't compile anything on your machine.
Can you try
bazel test //test/common/....
and see if that works? Note that all the developers seem to be able to build no problem, so I'm not sure what's different about your system or setup. clang 8 seems reasonable to me.
As another data point, I get this while running tools/bazel-test-docker.sh //test/integration:hotrestart_test on master
@jmarantz it worked !! Now all 168 tests passed.
But Bazel build still fails with same error as mentioned previously. Anything else we can do?
@bplotnick i tried the command you shared, build failed for me.
Sorry, did you try to clean it up and rebuild? like bazel clean --expunge
@dio now i got different error:
/home/i309801/Desktop/envoy/source/extensions/clusters/redis/BUILD:11:1: C++ compilation of rule ' //source/extensions/clusters/redis:redis_cluster' failed (Exit 1) envoy_cc_wrapper failed: error executin g command /home/i309801/.cache/bazel/_bazel_i309801/b6d0838a6096d725b6cb04aa30aa8841/external/local_confi g_cc/extra_tools/envoy_cc_wrapper -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter .. . (remaining 397 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
In file included from bazel-out/k8-fastbuild/bin/include/envoy/stream_info/_virtual_includes/stream_info_ interface/envoy/stream_info/stream_info.h:15:0,
from bazel-out/k8-fastbuild/bin/include/envoy/network/_virtual_includes/connection_inter face/envoy/network/connection.h:14,
from bazel-out/k8-fastbuild/bin/include/envoy/event/_virtual_includes/dispatcher_interfa ce/envoy/event/dispatcher.h:14,
from bazel-out/k8-fastbuild/bin/include/envoy/api/_virtual_includes/api_interface/envoy/ api/api.h:7,
from source/extensions/clusters/redis/redis_cluster.h:15,
from source/extensions/clusters/redis/redis_cluster.cc:1:
source/extensions/clusters/redis/redis_cluster.cc: In instantiation of 'Envoy::Extensions::Clusters::Redi s::RedisCluster::onClusterSlotUpdate(const std::vector
/usr/include/c++/5/bits/predefined_ops.h:296:31: required from 'bool __gnu_cxx::__ops::_Iter_negate<_Pr edicate>::operator()(_Iterator) [with _Iterator = __gnu_cxx::__normal_iterator > >; _Predicate = Envoy::Extensions::Clusters::Redis::RedisCluster: :onClusterSlotUpdate(const std::vector
source/extensions/clusters/redis/redis_cluster.cc:92:52: error: cannot call member function 'const envoy: :api::v2::endpoint::LocalityLbEndpoints& Envoy::Extensions::Clusters::Redis::RedisCluster::localityLbEndp oint() const' without object
return host->priority() == localityLbEndpoint().priority();
^
bazel-out/k8-fastbuild/bin/source/common/common/_virtual_includes/assert_lib/common/common/assert.h:86:19 : note: in definition of macro 'EXPAND'
#define EXPAND(X) X
^
bazel-out/k8-fastbuild/bin/source/common/common/_virtual_includes/assert_lib/common/common/assert.h:79:29 : note: in expansion of macro '_ASSERT_IMPL'
#define _ASSERT_ORIGINAL(X) _ASSERT_IMPL(X, #X, ASSERT_ACTION, "")
^
bazel-out/k8-fastbuild/bin/source/common/common/_virtual_includes/assert_lib/common/common/assert.h:81:53 : note: in expansion of macro '_ASSERT_ORIGINAL'
#define _ASSERT_SELECTOR(_1, _2, ASSERT_MACRO, ...) ASSERT_MACRO
^
source/extensions/clusters/redis/redis_cluster.cc:91:5: note: in expansion of macro 'ASSERT'
ASSERT(std::all_of(hosts_.begin(), hosts_.end(), & {
^
In file included from /usr/include/c++/5/bits/stl_algobase.h:71:0,
from /usr/include/c++/5/bits/char_traits.h:39,
from /usr/include/c++/5/string:40,
from /usr/include/c++/5/stdexcept:39,
from /usr/include/c++/5/array:38,
from source/extensions/clusters/redis/redis_cluster.h:3,
from source/extensions/clusters/redis/redis_cluster.cc:1:
/usr/include/c++/5/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_negate<_Predi cate>::operator()(_Iterator) [with _Iterator = __gnu_cxx::__normal_iterator > >; _Predicate = Envoy::Extensions::Clusters::Redis::RedisCluster: :onClusterSlotUpdate(const std::vector, std::vector
/usr/include/c++/5/bits/predefined_ops.h:296:31: error: void value not ignored as it ought to be
{ return !bool(_M_pred(*__it)); }
^
Target //source/exe:envoy-static failed to build
@Satvindar seems like you can try to use clang and clang++ from llvm-8 to compile it. As you have mentioned that you have it in your machine (assumed it is installed at /usr/lib/llvm-8).
$ export PATH=/usr/lib/llvm-8/bin:$PATH
$ export CC=clang
$ export CXX=clang++
$ bazel build //source/exe:envoy-static
@dio Thnaks a lot . Build is successful now.
But integration tests are failing when i run below command for http-filter-example:
bazel test //http-filter-example:http_filter_integration_test
ERROR: /home/i309801/Desktop/envoy-filter-example/http-filter-example/BUILD:47:1: C++ compilation of rule '//http-filter-example:http_filter_integration_test_lib_internal_only' failed (Exit 1) envoy_cc_wrapper failed: error executing command /home/i309801/.cache/bazel/_bazel_i309801/01330d535f2da866e5c0a2eb67025593/external/local_config_cc/extra_tools/envoy_cc_wrapper -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign ... (remaining 858 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
http-filter-example/http_filter_integration_test.cc:39:85: error: no member named 'c_str' in 'Envoy::Http::HeaderString'
request_stream->headers().get(Http::LowerCaseString("via"))->value().c_str());
~~~~~~~~~~~~~~ ^
external/com_google_googletest/googletest/include/gtest/gtest.h:2118:64: note: expanded from macro 'EXPECT_STREQ'
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2)
^~
external/com_google_googletest/googletest/include/gtest/gtest_pred_impl.h:164:40: note: expanded from macro 'EXPECT_PRED_FORMAT2'
GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
^~
external/com_google_googletest/googletest/include/gtest/gtest_pred_impl.h:149:43: note: expanded from macro 'GTEST_PRED_FORMAT2_'
GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
^~
external/com_google_googletest/googletest/include/gtest/gtest_pred_impl.h:77:52: note: expanded from macro 'GTEST_ASSERT_'
if (const ::testing::AssertionResult gtest_ar = (expression)) \
^~~~
1 error generated.
Target //http-filter-example:http_filter_integration_test failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 320.149s, Critical Path: 55.78s
INFO: 69 processes: 69 linux-sandbox.
FAILED: Build did NOT complete successfully
@Satvindar Ah, that's true. Since this https://github.com/envoyproxy/envoy/pull/6564 is merged we no longer have that c_str() for HeaderString.
envoy (master): git log -S "c_str" include/envoy/http/header_map.h
commit 3a596a4b0f8a8c3e60ff6240508a1d7395a9bacd
Author: Dan No茅 <[email protected]>
Date: Tue Apr 16 14:29:29 2019 -0400
Remove HeaderString::c_str() and migrate callers to getStringView() (#6564)
Do you think you can help us to submit a fix for that? It is in this line: https://github.com/envoyproxy/envoy-filter-example/blob/master/http-filter-example/http_filter_integration_test.cc#L39
And seems like this is not related to your first question. I'll close this 馃檪.
@dio Yes, I modified the code and its working.
I will create a PR for this change and will add you as a reviewer.
Thanks :)
I meet the similar error about kafka networkfilter when building envoy-wasm:
the Tracestack :
ERROR: /home/envoy-wasm/source/extensions/filters/network/kafka/BUILD:231:1: Executing genrule //source/extensions/filters/network/kafka:serialization_composite_generated_source failed (Exit 1) linux-sandbox failed: error executing command
(cd /root/.cache/bazel/_bazel_root/7943ff6a97d79b71366dffc326f50b10/sandbox/linux-sandbox/202/execroot/envoy && \
exec env - \
BAZEL_COMPILER=clang \
BAZEL_CXXOPTS='-stdlib=libc++' \
BAZEL_LINKLIBS=-l%:libc++.a:-l%:libc++abi.a:-lm \
BAZEL_LINKOPTS=-lm \
CC=/root/package/llvm-project/build/bin/clang \
CXX=/root/package/llvm-project/build/bin/clang++ \
CXXFLAGS='-stdlib=libc++ -Wno-error' \
LDFLAGS='-stdlib=libc++' \
PATH=/root/package/llvm-project/build/bin:/root/package/z3-master/build:/root/package/gn/out:/root/package/llvm-project/build/bin:/usr/local/java/bin:/root/apache-ant-1.9.14/bin:/usr/share/Modules/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin \
TMPDIR=/tmp \
/root/.cache/bazel/_bazel_root/install/c435ff35b78e9d78b94f06dd7301a644/linux-sandbox -t 15 -w /root/.cache/bazel/_bazel_root/7943ff6a97d79b71366dffc326f50b10/sandbox/linux-sandbox/202/execroot/envoy -w /tmp -w /dev/shm -D -- /bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh;
./bazel-out/host/bin/source/extensions/filters/network/kafka/serialization_composite_code_generator_bin bazel-out/aarch64-fastbuild/bin/source/extensions/filters/network/kafka/external/serialization_composite.h
')
...
Traceback (most recent call last):
File "./bazel-out/host/bin/source/extensions/filters/network/kafka/serialization_composite_code_generator_bin", line 349, in <module>
Main()
File "./bazel-out/host/bin/source/extensions/filters/network/kafka/serialization_composite_code_generator_bin", line 303, in Main
'Cannot exec() %r: file not found.' % main_filename
AssertionError: Cannot exec() '/root/.cache/bazel/_bazel_root/7943ff6a97d79b71366dffc326f50b10/sandbox/linux-sandbox/202/execroot/envoy/./bazel-out/host/bin/source/extensions/filters/network/kafka/serialization_composite_code_generator_bin.runfiles/envoy/source/extensions/filters/network/kafka/serialization/launcher.py': file not found.
It seems like launcher.py not found, however I found the file
root@localhost envoy-wasm]# ll /root/.cache/bazel/_bazel_root/7943ff6a97d79b71366dffc326f50b10/sandbox/linux-sandbox/202/execroot/envoy/./bazel-out/host/bin/source/extensions/filters/network/kafka/serialization_composite_code_generator_bin.runfiles/envoy/source/extensions/filters/network/kafka/serialization/launcher.py
lrwxrwxrwx. 1 root root 144 Mar 26 20:26 [/root/.cache/bazel/_bazel_root/7943ff6a97d79b71366dffc326f50b10/sandbox/linux-sandbox/202/execroot/envoy/./bazel-out/host/bin/source/extensions/filters/network/kafka/serialization_composite_code_generator_bin.runfiles/envoy/source/extensions/filters/network/kafka/serialization/launcher.py -> /root/.cache/bazel/_bazel_root/7943ff6a97d79b71366dffc326f50b10/execroot/envoy/source/extensions/filters/network/kafka/serialization/launcher.py
[root@localhost envoy-wasm]# ll /root/.cache/bazel/_bazel_root/7943ff6a97d79b71366dffc326f50b10/execroot/envoy/source/extensions/filters/network/kafka/serialization/launcher.py
-rw-------. 1 l00424155 root 926 Mar 20 17:11 /root/.cache/bazel/_bazel_root/7943ff6a97d79b71366dffc326f50b10/execroot/envoy/source/extensions/filters/network/kafka/serialization/launcher.py
Any idea to fix the building error?
Most helpful comment
@Satvindar seems like you can try to use clang and clang++ from llvm-8 to compile it. As you have mentioned that you have it in your machine (assumed it is installed at
/usr/lib/llvm-8).