我正在从源代码构建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相关,但这很难诊断。
答案 0 :(得分:1)
在使用Xcode 9.3在MacOS 10.13.4上进行编译时,我观察到同样的问题。
问题在于,protobuf
静态链接到libtensorflow_framework.so
,但也导入_single_image_random_dot_stereograms.so
和libforestprotos.so
,在导入contrib
时会加载。
这是一个相关的protobuf
issue。
该问题中的注释表示在使用Xcode 8.3或更高版本进行编译时会出现问题,因此我假设官方tensorflow二进制文件有效,因为它是使用旧版本构建的。
作为解决方法,我已在@protobuf_archive//:protobuf
和/tensorflow/tensorflow/tensorflow/contrib/image/BUILD
中本地删除了“/tensorflow/tensorflow/tensorflow/contrib/tensor_forest/BUILD
”的两个出现。
对于我在python中进行本地实验的用例,这似乎没有破坏任何东西。