<h3 dir="auto">System information</h3>
<ul dir="auto">
<li><strong>Have I written custom code (as opposed to using a stock example script provided in TensorFlow)</strong>: yes</li>
<li><strong>OS Platform and Distribution (e.g., Linux Ubuntu 16.04)</strong>: MacOs</li>
<li><strong>Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device</strong>: no</li>
<li><strong>TensorFlow installed from (source or binary)</strong>: source by bazel "http_archive"</li>
<li><strong>TensorFlow version (use command below)</strong>: 1.11.0</li>
<li><strong>Python version</strong>: 2.7</li>
<li><strong>Bazel version (if compiling from source)</strong>: 0.15.2</li>
<li><strong>GCC/Compiler version (if compiling from source)</strong>: Apple LLVM version 10.0.0 (clang-1000.11.45.2)</li>
<li><strong>CUDA/cuDNN version</strong>: no</li>
<li><strong>GPU model and memory</strong>: no</li>
<li><strong>Exact command to reproduce</strong>:<br>
clone branch <a href="https://github.com/shkarupa-alex/tfunicode/tree/feature/tf-1.11.0">https://github.com/shkarupa-alex/tfunicode/tree/feature/tf-1.11.0</a><br>
export PYTHON_BIN_PATH=<code class="notranslate">which python2.7</code><br>
bazel clean --expunge<br>
bazel build //tfunicode</li>
</ul>
<h3 dir="auto">Describe the problem</h3>
<p dir="auto">I've got custom OPs library. I build it from source with bazel (for generating python wrappers).<br>
It successfully builds with TF 1.8.0.<br>
But when i try to upgrade TF to 1.11.0, building fails with such error:</p>
<blockquote>
<p dir="auto">ld: can't open -exported_symbols_list file: -filelist<br>
clang: error: linker command failed with exit code 1 (use -v to see invocation)<br>
File provided to clang with failed option is pywrap_tensorflow_internal_versionscript.lds (exists).</p>
</blockquote>
<h3 dir="auto">Source code / logs</h3>
<p dir="auto">Full error log <a href="https://github.com/tensorflow/tensorflow/files/2449241/err.txt">err.txt</a></p>
<h3 dir="auto">System information</h3>
<ul dir="auto">
<li><strong>Have I written custom code (as opposed to using a stock example script provided in TensorFlow)</strong>: No</li>
<li><strong>OS Platform and Distribution (e.g., Linux Ubuntu 16.04)</strong>: MacOS Mojave and High Sierra</li>
<li><strong>Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device</strong>: N/A</li>
<li><strong>TensorFlow installed from (source or binary)</strong>: source</li>
<li><strong>TensorFlow version (use command below)</strong>: master</li>
<li><strong>Python version</strong>: 2.7</li>
<li><strong>Bazel version (if compiling from source)</strong>: 0.17..2-homebrew</li>
<li><strong>GCC/Compiler version (if compiling from source)</strong>:</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="clang -v
Apple LLVM version 10.0.0 (clang-1000.11.45.2)"><pre class="notranslate"><code class="notranslate">clang -v
Apple LLVM version 10.0.0 (clang-1000.11.45.2)
</code></pre></div>
<ul dir="auto">
<li><strong>CUDA/cuDNN version</strong>: N/A</li>
<li><strong>GPU model and memory</strong>: N/A</li>
<li><strong>Exact command to reproduce</strong>:</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="bazel test --test_output=all --nocache_test_results --config=opt tensorflow/compiler/tests:cpu_tests"><pre class="notranslate"><code class="notranslate">bazel test --test_output=all --nocache_test_results --config=opt tensorflow/compiler/tests:cpu_tests
</code></pre></div>
<p dir="auto">(Configured with XLA support enabled)</p>
<h3 dir="auto">Describe the problem</h3>
<p dir="auto">When trying to run the above command I get:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ld: can't open -exported_symbols_list file: -filelist
clang: error: linker command failed with exit code 1 (use -v to see invocation)"><pre class="notranslate"><code class="notranslate">ld: can't open -exported_symbols_list file: -filelist
clang: error: linker command failed with exit code 1 (use -v to see invocation)
</code></pre></div>
<h3 dir="auto">Source code / logs</h3>
<p dir="auto">After applying this diff:</p>
<div class="highlight highlight-source-diff notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="index df15914233..8de9c7cfdd 100644
--- a/tensorflow/tensorflow.bzl
+++ b/tensorflow/tensorflow.bzl
@@ -1636,8 +1636,7 @@ def tf_py_wrap_cc(
     )
     extra_linkopts = select({
         &quot;@local_config_cuda//cuda:darwin&quot;: [
-            &quot;-Wl,-exported_symbols_list&quot;,
-            &quot;$(location %s.lds)&quot; % vscriptname,
+            &quot;-Wl,-exported_symbols_list,$(location %s.lds)&quot; % vscriptname,
         ],
         clean_dep(&quot;//tensorflow:windows&quot;): [],
         &quot;//conditions:default&quot;: ["><pre class="notranslate">index df15914233..8de9c7cfdd 100644
<span class="pl-md">--- a/tensorflow/tensorflow.bzl</span>
<span class="pl-mi1">+++ b/tensorflow/tensorflow.bzl</span>
<span class="pl-mdr">@@ -1636,8 +1636,7 @@</span> def tf_py_wrap_cc(
     )
     extra_linkopts = select({
         "@local_config_cuda//cuda:darwin": [
<span class="pl-md"><span class="pl-md">-</span>            "-Wl,-exported_symbols_list",</span>
<span class="pl-md"><span class="pl-md">-</span>            "$(location %s.lds)" % vscriptname,</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>            "-Wl,-exported_symbols_list,$(location %s.lds)" % vscriptname,</span>
         ],
         clean_dep("//tensorflow:windows"): [],
         "//conditions:default": [</pre></div>
<p dir="auto">and running <code class="notranslate">bazel test --test_output=all --nocache_test_results --config=opt tensorflow/compiler/tests:cpu_tests</code></p>
<p dir="auto">I get lots of warnings during linking:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ld: warning: cannot export hidden symbol std::__1::shared_ptr&lt;tensorflow::AWSSha256HMACOpenSSLImpl&gt;::__enable_weak_this(...) from bazel-out/darwin-opt/bin/tensorflow/core/platform/s3/libaws_crypto.lo(aws_crypto.o)
ld: warning: cannot export hidden symbol std::__1::shared_ptr&lt;tensorflow::AWSLogSystem&gt;::__enable_weak_this(...) from bazel-out/darwin-opt/bin/tensorflow/core/platform/s3/libaws_logging.lo(aws_logging.o)
ld: warning: cannot export hidden symbol std::__1::shared_ptr&lt;tensorflow::Notification&gt;::__enable_weak_this(...) from bazel-out/darwin-opt/bin/tensorflow/core/grappler/libutils.a(utils.o)"><pre class="notranslate"><code class="notranslate">ld: warning: cannot export hidden symbol std::__1::shared_ptr&lt;tensorflow::AWSSha256HMACOpenSSLImpl&gt;::__enable_weak_this(...) from bazel-out/darwin-opt/bin/tensorflow/core/platform/s3/libaws_crypto.lo(aws_crypto.o)
ld: warning: cannot export hidden symbol std::__1::shared_ptr&lt;tensorflow::AWSLogSystem&gt;::__enable_weak_this(...) from bazel-out/darwin-opt/bin/tensorflow/core/platform/s3/libaws_logging.lo(aws_logging.o)
ld: warning: cannot export hidden symbol std::__1::shared_ptr&lt;tensorflow::Notification&gt;::__enable_weak_this(...) from bazel-out/darwin-opt/bin/tensorflow/core/grappler/libutils.a(utils.o)
</code></pre></div>
<p dir="auto">And then when the tests are ran I get errors such as:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="2018-10-11 13:02:47.136859: I tensorflow/compiler/xla/service/service.cc:157]   StreamExecutor device (0): &lt;undefined&gt;, &lt;undefined&gt;
*** Received signal 10 ***
*** BEGIN MANGLED STACK TRACE ***
0   libtensorflow_framework.so          0x00000001200870a7 _ZN10tensorflow7testingL17StacktraceHandlerEiP9__siginfoPv + 183
1   libsystem_platform.dylib            0x00007fff66049b3d _sigtramp + 29
2   ???                                 0x0000000000000000 0x0 + 0
3   _pywrap_tensorflow_internal.so      0x00000001143583a9 _ZNSt3__110__function6__funcIZN3xla3cpu13CpuExecutable24ExecuteAsyncOnStreamImplEPKNS2_27ServiceExecutableRunOptionsEN4absl4SpanIKPKNS2_12ShapedBufferEEEPNS2_19HloExecutionProfileEE12AsyncRunTaskNS_9allocatorISH_EEFvvEEclEv + 73
4   libtensorflow_framework.so          0x000000012032bd09 _ZNSt3__110__function6__funcIZN15stream_executor4host10HostStream11EnqueueTaskENS_8functionIFvvEEEE12NotifiedTaskNS_9allocatorIS8_EES6_EclEv + 25
5   libtensorflow_framework.so          0x00000001200641da _ZN5Eigen26NonBlockingThreadPoolTemplIN10tensorflow6thread16EigenEnvironmentEE10WorkerLoopEi + 618
6   libtensorflow_framework.so          0x0000000120063e6f _ZNSt3__110__function6__funcIZN10tensorflow6thread16EigenEnvironment12CreateThreadENS_8functionIFvvEEEEUlvE_NS_9allocatorIS8_EES6_EclEv + 47
7   libtensorflow_framework.so          0x0000000120088a30 _ZNSt3__114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEENS_8functionIFvvEEEEEEEEPvSB_ + 48
8   libsystem_pthread.dylib             0x00007fff6605233d _pthread_body + 126
9   libsystem_pthread.dylib             0x00007fff660552a7 _pthread_start + 70
10  libsystem_pthread.dylib             0x00007fff66051425 thread_start + 13
*** END MANGLED STACK TRACE ***

*** Begin stack trace ***
	tensorflow::CurrentStackTrace()
	tensorflow::testing::StacktraceHandler(int, __siginfo*, void*)
	_sigtramp

	std::__1::__function::__func&lt;xla::cpu::CpuExecutable::ExecuteAsyncOnStreamImpl(xla::ServiceExecutableRunOptions const*, absl::Span&lt;xla::ShapedBuffer const* const&gt;, xla::HloExecutionProfile*)::AsyncRunTask, std::__1::allocator&lt;xla::cpu::CpuExecutable::ExecuteAsyncOnStreamImpl(xla::ServiceExecutableRunOptions const*, absl::Span&lt;xla::ShapedBuffer const* const&gt;, xla::HloExecutionProfile*)::AsyncRunTask&gt;, void ()&gt;::operator()()
	std::__1::__function::__func&lt;stream_executor::host::HostStream::EnqueueTask(std::__1::function&lt;void ()&gt;)::NotifiedTask, std::__1::allocator&lt;stream_executor::host::HostStream::EnqueueTask(std::__1::function&lt;void ()&gt;)::NotifiedTask&gt;, void ()&gt;::operator()()
	Eigen::NonBlockingThreadPoolTempl&lt;tensorflow::thread::EigenEnvironment&gt;::WorkerLoop(int)
	std::__1::__function::__func&lt;tensorflow::thread::EigenEnvironment::CreateThread(std::__1::function&lt;void ()&gt;)::'lambda'(), std::__1::allocator&lt;tensorflow::thread::EigenEnvironment::CreateThread(std::__1::function&lt;void ()&gt;)::'lambda'()&gt;, void ()&gt;::operator()()
	void* std::__1::__thread_proxy&lt;std::__1::tuple&lt;std::__1::unique_ptr&lt;std::__1::__thread_struct, std::__1::default_delete&lt;std::__1::__thread_struct&gt; &gt;, std::__1::function&lt;void ()&gt; &gt; &gt;(void*)
	_pthread_body
	_pthread_start
	thread_start
*** End stack trace ***"><pre class="notranslate"><code class="notranslate">2018-10-11 13:02:47.136859: I tensorflow/compiler/xla/service/service.cc:157]   StreamExecutor device (0): &lt;undefined&gt;, &lt;undefined&gt;
*** Received signal 10 ***
*** BEGIN MANGLED STACK TRACE ***
0   libtensorflow_framework.so          0x00000001200870a7 _ZN10tensorflow7testingL17StacktraceHandlerEiP9__siginfoPv + 183
1   libsystem_platform.dylib            0x00007fff66049b3d _sigtramp + 29
2   ???                                 0x0000000000000000 0x0 + 0
3   _pywrap_tensorflow_internal.so      0x00000001143583a9 _ZNSt3__110__function6__funcIZN3xla3cpu13CpuExecutable24ExecuteAsyncOnStreamImplEPKNS2_27ServiceExecutableRunOptionsEN4absl4SpanIKPKNS2_12ShapedBufferEEEPNS2_19HloExecutionProfileEE12AsyncRunTaskNS_9allocatorISH_EEFvvEEclEv + 73
4   libtensorflow_framework.so          0x000000012032bd09 _ZNSt3__110__function6__funcIZN15stream_executor4host10HostStream11EnqueueTaskENS_8functionIFvvEEEE12NotifiedTaskNS_9allocatorIS8_EES6_EclEv + 25
5   libtensorflow_framework.so          0x00000001200641da _ZN5Eigen26NonBlockingThreadPoolTemplIN10tensorflow6thread16EigenEnvironmentEE10WorkerLoopEi + 618
6   libtensorflow_framework.so          0x0000000120063e6f _ZNSt3__110__function6__funcIZN10tensorflow6thread16EigenEnvironment12CreateThreadENS_8functionIFvvEEEEUlvE_NS_9allocatorIS8_EES6_EclEv + 47
7   libtensorflow_framework.so          0x0000000120088a30 _ZNSt3__114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEENS_8functionIFvvEEEEEEEEPvSB_ + 48
8   libsystem_pthread.dylib             0x00007fff6605233d _pthread_body + 126
9   libsystem_pthread.dylib             0x00007fff660552a7 _pthread_start + 70
10  libsystem_pthread.dylib             0x00007fff66051425 thread_start + 13
*** END MANGLED STACK TRACE ***

*** Begin stack trace ***
	tensorflow::CurrentStackTrace()
	tensorflow::testing::StacktraceHandler(int, __siginfo*, void*)
	_sigtramp

	std::__1::__function::__func&lt;xla::cpu::CpuExecutable::ExecuteAsyncOnStreamImpl(xla::ServiceExecutableRunOptions const*, absl::Span&lt;xla::ShapedBuffer const* const&gt;, xla::HloExecutionProfile*)::AsyncRunTask, std::__1::allocator&lt;xla::cpu::CpuExecutable::ExecuteAsyncOnStreamImpl(xla::ServiceExecutableRunOptions const*, absl::Span&lt;xla::ShapedBuffer const* const&gt;, xla::HloExecutionProfile*)::AsyncRunTask&gt;, void ()&gt;::operator()()
	std::__1::__function::__func&lt;stream_executor::host::HostStream::EnqueueTask(std::__1::function&lt;void ()&gt;)::NotifiedTask, std::__1::allocator&lt;stream_executor::host::HostStream::EnqueueTask(std::__1::function&lt;void ()&gt;)::NotifiedTask&gt;, void ()&gt;::operator()()
	Eigen::NonBlockingThreadPoolTempl&lt;tensorflow::thread::EigenEnvironment&gt;::WorkerLoop(int)
	std::__1::__function::__func&lt;tensorflow::thread::EigenEnvironment::CreateThread(std::__1::function&lt;void ()&gt;)::'lambda'(), std::__1::allocator&lt;tensorflow::thread::EigenEnvironment::CreateThread(std::__1::function&lt;void ()&gt;)::'lambda'()&gt;, void ()&gt;::operator()()
	void* std::__1::__thread_proxy&lt;std::__1::tuple&lt;std::__1::unique_ptr&lt;std::__1::__thread_struct, std::__1::default_delete&lt;std::__1::__thread_struct&gt; &gt;, std::__1::function&lt;void ()&gt; &gt; &gt;(void*)
	_pthread_body
	_pthread_start
	thread_start
*** End stack trace ***
</code></pre></div>
<p dir="auto">Note that <code class="notranslate">cc_wrapper.sh</code> calls <code class="notranslate">gcc</code> however I haven't changed it so it still points at Apple LLVM.</p>
<p dir="auto">Note that there is an issue <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="367084543" data-permission-text="Title is private" data-url="https://github.com/tensorflow/tensorflow/issues/22759" data-hovercard-type="issue" data-hovercard-url="/tensorflow/tensorflow/issues/22759/hovercard" href="https://github.com/tensorflow/tensorflow/issues/22759">#22759</a> however that one uses custom code, where as this is HEAD of master.</p>