Skip to content

Symbol not found: _CFTimeZoneCopyDefault for simple example on MacOS. #291

@robertnishihara

Description

@robertnishihara

Hi! I'm running into the following issue with abseil on MacOS. Please let me know if you have suggestions for things to try.

Environment

  • MacOS 10.13.6
  • bazel version
    $ bazel version
    INFO: Invocation ID: cacd095e-84ff-432a-afb8-c56fe7aaad9d
    Build label: 0.22.0
    Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
    Build time: Mon Jan 28 13:00:18 2019 (1548680418)
    Build timestamp: 1548680418
    Build timestamp as int: 1548680418
    
  • g++ --version
    Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
    Apple LLVM version 10.0.0 (clang-1000.10.44.4)
    Target: x86_64-apple-darwin17.7.0
    Thread model: posix
    

InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Code for Reproducing

I can reproduce this with the following three files.

The hello_world.cc file:

#include "absl/time/clock.h"
#include "absl/time/time.h"

int main() {
  absl::Time t = absl::Now();
  absl::FormatTime(t);

  return(0);
}

The WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "com_google_absl",
    strip_prefix = "abseil-cpp-master",
    urls = ["https://github.com/abseil/abseil-cpp/archive/master.zip"],
)

The BUILD file:

cc_binary(
  name = "hello_world",
  deps = ["@com_google_absl//absl/time"],
  srcs = ["hello_world.cc"],
)

Instructions for Reproducing

First I build with

$ bazel build //:hello_world
INFO: Invocation ID: df8ad84b-2691-4fea-b26c-08998d0cb391
INFO: Analysed target //:hello_world (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //:hello_world up-to-date:
  bazel-bin/hello_world
INFO: Elapsed time: 0.142s, Critical Path: 0.00s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action

Then I run it with

$ ./bazel-bin/hello_world
dyld: lazy symbol binding failed: Symbol not found: _CFTimeZoneCopyDefault
  Referenced from: /Users/rnishihara/abseil-example/./bazel-bin/hello_world
  Expected in: flat namespace

dyld: Symbol not found: _CFTimeZoneCopyDefault
  Referenced from: /Users/rnishihara/abseil-example/./bazel-bin/hello_world
  Expected in: flat namespace

Abort trap: 6

which produces the error above.

Metadata

Metadata

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