Skip to content

get error when reply.as_string() ,macos 10.15 compile by bazel #76

@dxq174510447

Description

@dxq174510447

Describe the bug
A clear and concise description of what the bug is.
i use bazel compile my project. below is my code


       cpp_redis::client client;

	client.connect("127.0.0.1", 6379);
	client.auth("123456");

	std::future<cpp_redis::reply> r2= client.get("hello");
	client.sync_commit();
	if(r2.get().is_null()){
		cout << "null" << endl;
	}
	else{
		cout << "123" << endl;
		cout << r2.get().as_string()<< endl;
		cout << "456" << endl;
	}

WORKSPACE

http_archive(
    name = "redis",
    strip_prefix = "cpp_redis-master",
    url = "https://github.com/cpp-redis/cpp_redis/archive/master.zip",
)

load("@redis//:repositories.bzl", "cpp_redis_repositories")

cpp_redis_repositories()

BUILD

cc_binary(
    name = "wasm",
    srcs = ["seclang.cpp"],
    deps = [
    	"@redis//:cpp_redis",
    	":t1"
    	
    ],
    visibility = ["//visibility:public"]
)

cc_library(
    name = "t1",
    srcs = ["ttt/t1.cpp"],
    hdrs = ["ttt/t1.h"]
)

build

bazel build -s //src:wasm

In file included from bazel-out/darwin-fastbuild/bin/external/redis/_virtual_includes/cpp_redis/cpp_redis/core/reply.hpp:29:
In file included from bazel-out/darwin-fastbuild/bin/external/redis/_virtual_includes/cpp_redis/cpp_redis/misc/optional.hpp:39:
bazel-out/darwin-fastbuild/bin/external/redis/_virtual_includes/cpp_redis/cpp_redis/misc/logger.hpp:135:3: warning: explicitly defaulted copy constructor is implicitly deleted [-Wdefaulted-function-deleted]
  logger(const logger&) = default;
  ^
bazel-out/darwin-fastbuild/bin/external/redis/_virtual_includes/cpp_redis/cpp_redis/misc/logger.hpp:194:14: note: copy constructor of 'logger' is implicitly deleted because field 'm_mutex' has a deleted copy constructor
  std::mutex m_mutex;
             ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__mutex_base:40:5: note: 'mutex' has been explicitly marked deleted here
    mutex(const mutex&) = delete;
    ^
In file included from src/seclang.cpp:11:
In file included from bazel-out/darwin-fastbuild/bin/external/redis/_virtual_includes/cpp_redis/cpp_redis/cpp_redis:30:
In file included from bazel-out/darwin-fastbuild/bin/external/redis/_virtual_includes/cpp_redis/cpp_redis/core/client.hpp:36:
In file included from bazel-out/darwin-fastbuild/bin/external/redis/_virtual_includes/cpp_redis/cpp_redis/core/types.hpp:31:
In file included from bazel-out/darwin-fastbuild/bin/external/redis/_virtual_includes/cpp_redis/cpp_redis/core/reply.hpp:29:
In file included from bazel-out/darwin-fastbuild/bin/external/redis/_virtual_includes/cpp_redis/cpp_redis/misc/optional.hpp:39:
bazel-out/darwin-fastbuild/bin/external/redis/_virtual_includes/cpp_redis/cpp_redis/misc/logger.hpp:140:11: warning: explicitly defaulted copy assignment operator is implicitly deleted [-Wdefaulted-function-deleted]
  logger& operator=(const logger&) = default;
          ^
bazel-out/darwin-fastbuild/bin/external/redis/_virtual_includes/cpp_redis/cpp_redis/misc/logger.hpp:194:14: note: copy assignment operator of 'logger' is implicitly deleted because field 'm_mutex' has a deleted copy assignment operator
  std::mutex m_mutex;
             ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__mutex_base:41:12: note: 'operator=' has been explicitly marked deleted here
    mutex& operator=(const mutex&) = delete;
           ^
In file included from src/seclang.cpp:11:
In file included from bazel-out/darwin-fastbuild/bin/external/redis/_virtual_includes/cpp_redis/cpp_redis/cpp_redis:41:
In file included from bazel-out/darwin-fastbuild/bin/external/redis/_virtual_includes/cpp_redis/cpp_redis/network/tcp_client.hpp:28:
In file included from bazel-out/darwin-fastbuild/bin/external/tacopie/_virtual_includes/tacopie/tacopie/tacopie:30:
In file included from bazel-out/darwin-fastbuild/bin/external/tacopie/_virtual_includes/tacopie/tacopie/utils/error.hpp:29:
bazel-out/darwin-fastbuild/bin/external/tacopie/_virtual_includes/tacopie/tacopie/utils/logger.hpp:107:3: warning: explicitly defaulted copy constructor is implicitly deleted [-Wdefaulted-function-deleted]
  logger(const logger&) = default;
  ^
bazel-out/darwin-fastbuild/bin/external/tacopie/_virtual_includes/tacopie/tacopie/utils/logger.hpp:157:14: note: copy constructor of 'logger' is implicitly deleted because field 'm_mutex' has a deleted copy constructor
  std::mutex m_mutex;
             ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__mutex_base:40:5: note: 'mutex' has been explicitly marked deleted here
    mutex(const mutex&) = delete;
    ^
In file included from src/seclang.cpp:11:
In file included from bazel-out/darwin-fastbuild/bin/external/redis/_virtual_includes/cpp_redis/cpp_redis/cpp_redis:41:
In file included from bazel-out/darwin-fastbuild/bin/external/redis/_virtual_includes/cpp_redis/cpp_redis/network/tcp_client.hpp:28:
In file included from bazel-out/darwin-fastbuild/bin/external/tacopie/_virtual_includes/tacopie/tacopie/tacopie:30:
In file included from bazel-out/darwin-fastbuild/bin/external/tacopie/_virtual_includes/tacopie/tacopie/utils/error.hpp:29:
bazel-out/darwin-fastbuild/bin/external/tacopie/_virtual_includes/tacopie/tacopie/utils/logger.hpp:109:11: warning: explicitly defaulted copy assignment operator is implicitly deleted [-Wdefaulted-function-deleted]
  logger& operator=(const logger&) = default;
          ^
bazel-out/darwin-fastbuild/bin/external/tacopie/_virtual_includes/tacopie/tacopie/utils/logger.hpp:157:14: note: copy assignment operator of 'logger' is implicitly deleted because field 'm_mutex' has a deleted copy assignment operator
  std::mutex m_mutex;
             ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__mutex_base:41:12: note: 'operator=' has been explicitly marked deleted here
    mutex& operator=(const mutex&) = delete;
           ^
4 warnings generated.
Target //src:wasm up-to-date:
  bazel-bin/src/wasm
INFO: Elapsed time: 0.881s, Critical Path: 0.81s
INFO: 2 processes: 1 internal, 1 darwin-sandbox.
INFO: Build completed successfully, 2 total actions

run


dengxiaoqian@dengxiaoqiandeMacBook-Pro ctgw_wasm % bazel run -s //src:wasm
DEBUG: Rule 'redis' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "666243fefb1465c0f9e6cd7fba0eab099e8aa7469674fecfc246f572705543ab"
DEBUG: Repository redis instantiated at:
  no stack (--record_rule_instantiation_callstack not enabled)
Repository rule http_archive defined at:
  /private/var/tmp/_bazel_dengxiaoqian/52cacb9c84a09b383e18d0ecdbf561f4/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in <toplevel>
INFO: Analyzed target //src:wasm (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //src:wasm up-to-date:
  bazel-bin/src/wasm
INFO: Elapsed time: 0.077s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
!!!Hello World111!!!
123

console not print the value of 'hello' and '456'

what cause the problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions