Hi all
I am new to grpc and bazel and am using it with c++. I added a simple hello
world service rpc with test and running it fails with error below
*********** WORKSPACE *************
workspace(name = "com_github_stitch")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive (
name = "com_github_grpc_grpc",
urls = ["https://github.com/grpc/grpc/archive/v1.21.1.tar.gz"],
strip_prefix = "grpc-1.21.1",
sha256 =
"1bf082fb3016154d3f806da8eb5876caf05743da4b2e8130fadd000df74b5bb6"
)
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
grpc_deps()
*********** BUILD ************
cc_test (
name = "node_test",
srcs = [
"stitch/node/admin_service_impl_test.cc"
],
linkopts = ["-v"],
deps = [
"//external:gtest",
"//source:node_admin_service",
"//proto:node_admin_service_grpc",
"@com_github_grpc_grpc//:grpc++"
]
)
*********** test cc file ***********
#include <gtest/gtest.h>
#include <grpcpp/grpcpp.h>
#include "source/stitch/node/admin_service_impl.hpp"
TEST(AdminServiceImpl, shouldReturnUpTimeForTheService)
{
grpc::ServerContext ctx;
stitch::node::StatusRequest request;
stitch::node::StatusResponse response;
stitch::node::AdminServiceImpl service;
auto status = service.GetStatus(&ctx, &request, &response);
EXPECT_TRUE(status.ok());
}
*********** Test execution **************
*$ bazel test //test/... --sandbox_debug --verbose_failures*
INFO: Build option --action_env has changed, discarding analysis cache.
INFO: Analyzed target //test:node_test (2 packages loaded, 2691 targets
configured).
INFO: Found 1 test target...
INFO: From Compiling
external/com_google_protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc
[for host]:
external/com_google_protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc:525:16:
warning: private field 'cold_threshold_' is not used
[-Wunused-private-field]
const double cold_threshold_;
^
1 warning generated.
INFO: From Compiling
external/com_google_protobuf/src/google/protobuf/util/json_util.cc [for
host]:
external/com_google_protobuf/src/google/protobuf/util/json_util.cc:132:16:
warning: 'InvalidName' overrides a member function but is not marked
'override' [-Winconsistent-missing-override]
virtual void InvalidName(const converter::LocationTrackerInterface& loc,
^
external/com_google_protobuf/src/google/protobuf/util/internal/error_listener.h:58:16:
note: overridden virtual function is here
virtual void InvalidName(const LocationTrackerInterface& loc,
^
external/com_google_protobuf/src/google/protobuf/util/json_util.cc:144:16:
warning: 'InvalidValue' overrides a member function but is not marked
'override' [-Winconsistent-missing-override]
virtual void InvalidValue(const converter::LocationTrackerInterface& loc,
^
external/com_google_protobuf/src/google/protobuf/util/internal/error_listener.h:63:16:
note: overridden virtual function is here
virtual void InvalidValue(const LocationTrackerInterface& loc,
^
external/com_google_protobuf/src/google/protobuf/util/json_util.cc:153:16:
warning: 'MissingField' overrides a member function but is not marked
'override' [-Winconsistent-missing-override]
virtual void MissingField(const converter::LocationTrackerInterface& loc,
^
external/com_google_protobuf/src/google/protobuf/util/internal/error_listener.h:68:16:
note: overridden virtual function is here
virtual void MissingField(const LocationTrackerInterface& loc,
^
3 warnings generated.
ERROR:
/private/var/tmp/_bazel_a0j00tw/56425938cca56d4db97767e40609569b/external/com_github_grpc_grpc/BUILD:1881:1:
Linking of rule
'@com_github_grpc_grpc//:grpc_transport_chttp2_server_secure' failed (Exit
1) sandbox-exec failed: error executing command
(cd
/private/var/tmp/_bazel_a0j00tw/56425938cca56d4db97767e40609569b/sandbox/darwin-sandbox/3267/execroot/com_github_stitch
&& \
exec env - \
CC=gcc \
CXX=g++ \
PATH=/usr/local/opt/llvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/bin:/usr/local/anaconda3/bin:/usr/local/anaconda3/bin:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/bin:/usr/local/anaconda3/bin:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/bin
\
PWD=/proc/self/cwd \
TMPDIR=/var/folders/kf/pp2vy3td78l36xbg4lry1m2r9ttrbg/T/ \
/usr/bin/sandbox-exec -f
/private/var/tmp/_bazel_a0j00tw/56425938cca56d4db97767e40609569b/sandbox/darwin-sandbox/3267/sandbox.sb
/var/tmp/_bazel_a0j00tw/install/a30ccea66b00013ad8874af930c7f981/_embedded_binaries/process-wrapper
'--timeout=0' '--kill_delay=15' external/local_config_cc/cc_wrapper.sh
-shared -o
bazel-out/darwin-fastbuild/bin/external/com_github_grpc_grpc/libgrpc_transport_chttp2_server_secure.so
bazel-out/darwin-fastbuild/bin/external/com_github_grpc_grpc/_objs/grpc_transport_chttp2_server_secure/server_secure_chttp2.pic.o
-pthread -Wl,-S -undefined dynamic_lookup -headerpad_max_install_names
-lstdc++ -lm): sandbox-exec failed: error executing command
(cd
/private/var/tmp/_bazel_a0j00tw/56425938cca56d4db97767e40609569b/sandbox/darwin-sandbox/3267/execroot/com_github_stitch
&& \
exec env - \
CC=gcc \
CXX=g++ \
PATH=/usr/local/opt/llvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/bin:/usr/local/anaconda3/bin:/usr/local/anaconda3/bin:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/bin:/usr/local/anaconda3/bin:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/bin
\
PWD=/proc/self/cwd \
TMPDIR=/var/folders/kf/pp2vy3td78l36xbg4lry1m2r9ttrbg/T/ \
/usr/bin/sandbox-exec -f
/private/var/tmp/_bazel_a0j00tw/56425938cca56d4db97767e40609569b/sandbox/darwin-sandbox/3267/sandbox.sb
/var/tmp/_bazel_a0j00tw/install/a30ccea66b00013ad8874af930c7f981/_embedded_binaries/process-wrapper
'--timeout=0' '--kill_delay=15' external/local_config_cc/cc_wrapper.sh
-shared -o
bazel-out/darwin-fastbuild/bin/external/com_github_grpc_grpc/libgrpc_transport_chttp2_server_secure.so
bazel-out/darwin-fastbuild/bin/external/com_github_grpc_grpc/_objs/grpc_transport_chttp2_server_secure/server_secure_chttp2.pic.o
-pthread -Wl,-S -undefined dynamic_lookup -headerpad_max_install_names
-lstdc++ -lm)
ld: illegal thread local variable reference to regular symbol
__ZN9grpc_core7ExecCtx9exec_ctx_E for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
Target //test:node_test failed to build
INFO: Elapsed time: 133.981s, Critical Path: 23.93s
INFO: 233 processes: 233 darwin-sandbox.
FAILED: Build did NOT complete successfully
--
You received this message because you are subscribed to the Google Groups
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/grpc-io/f9f8e255-08a5-4979-861b-f71557045bf2%40googlegroups.com.