1

我正在从源代码构建 TF,并且在 python 中包含 contrib 没有问题。当我尝试访问此模块时出现段错误,并出现以下错误:

error: _single_image_random_dot_stereograms.so debug map object file '/private/var/tmp/_bazel_mattmurphy/7ec540cd2482edb7e06749c20652a791/execroot/org_tensorflow/bazel-out/darwin-dbg/bin/tensorflow/contrib/image/_objs/python/ops/_single_image_random_dot_stereograms.so/tensorflow/contrib/image/kernels/single_image_random_dot_stereograms_ops.o' has changed (actual time is 2018-04-23 12:26:04.000000000, debug map time is 2018-04-21 20:47:03.000000000) since this executable was linked, file will be ignored
error: _single_image_random_dot_stereograms.so debug map object file '/private/var/tmp/_bazel_mattmurphy/7ec540cd2482edb7e06749c20652a791/execroot/org_tensorflow/bazel-out/darwin-dbg/bin/tensorflow/contrib/image/_objs/python/ops/_single_image_random_dot_stereograms.so/tensorflow/contrib/image/ops/single_image_random_dot_stereograms_ops.o' has changed (actual time is 2018-04-23 12:26:05.000000000, debug map time is 2018-04-21 20:47:02.000000000) since this executable was linked, file will be ignored
Process 58138 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x48)
    frame #0: 0x0000000131682290 _single_image_random_dot_stereograms.so`google::protobuf::internal::Mutex::Lock(this=0x0000000000000048) at common.cc:376
   373  }
   374
   375  void Mutex::Lock() {
-> 376    int result = pthread_mutex_lock(&mInternal->mutex);
   377    if (result != 0) {
   378      GOOGLE_LOG(FATAL) << "pthread_mutex_lock: " << strerror(result);
   379    }
Target 0: (python) stopped.

看起来问题与 protobuf 相关,但这很难诊断。

4

1 回答 1

1

在使用 Xcode 9.3 编译 MacOS 10.13.4 时,我观察到同样的问题。

问题是protobuf静态链接到libtensorflow_framework.so,但也链接到_single_image_random_dot_stereograms.soand libforestprotos.so,它们在contrib导入时被加载。

这里有一个相关的protobuf问题

该问题中的一条评论说,使用 Xcode 8.3 或更高版本编译时会出现问题,因此我假设官方 tensorflow 二进制文件有效,因为它是使用旧版本构建的。

作为解决方法,我已在本地删除了两个出现的 " @protobuf_archive//:protobuf" in/tensorflow/tensorflow/tensorflow/contrib/image/BUILD/tensorflow/tensorflow/tensorflow/contrib/tensor_forest/BUILD.

对于我在 python 中进行本地实验的用例,这似乎并没有破坏任何东西。

于 2018-04-26T13:17:57.853 回答