<p dir="auto"><em>Please make sure that this is a build/installation issue. As per our <a href="https://github.com/tensorflow/tensorflow/blob/master/ISSUES.md">GitHub Policy</a>, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:build_template</em></p>
<p dir="auto"><strong>System information</strong></p>
<ul dir="auto">
<li>OS Platform and Distribution (e.g., Linux Ubuntu 16.04):</li>
<li>Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:</li>
<li>TensorFlow installed from (source or binary):</li>
<li>TensorFlow version:</li>
<li>Python version:</li>
<li>Installed using virtualenv? pip? conda?:</li>
<li>Bazel version (if compiling from source):</li>
<li>GCC/Compiler version (if compiling from source):</li>
<li>CUDA/cuDNN version:</li>
<li>GPU model and memory:</li>
</ul>
<p dir="auto"><strong>Describe the problem</strong></p>
<p dir="auto"><strong>Provide the exact sequence of commands / steps that you executed before running into the problem</strong></p>
<p dir="auto"><strong>Any other info / logs</strong><br>
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.</p>
<p dir="auto"><em>Please make sure that this is a build/installation issue. As per our <a href="https://github.com/tensorflow/tensorflow/blob/master/ISSUES.md">GitHub Policy</a>, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:build_template</em></p>
<p dir="auto"><strong>System information</strong></p>
<ul dir="auto">
<li>OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 16.04</li>
<li>Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:</li>
<li>TensorFlow installed from (source or binary):</li>
<li>TensorFlow version:</li>
<li>Python version: 2.7</li>
<li>Bazel version (if compiling from source): 0.26.1</li>
<li>GCC/Compiler version (if compiling from source): 7.3.0</li>
</ul>
<p dir="auto"><strong>Describe the problem</strong><br>
I want to build a tensorflow C library for MIPS architecture.<br>
So in order to do that, I specified the following options before building:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="export CC=/usr/bin/mips64-linux-gnuabi64-gcc
export CXX=/usr/bin/mips64-linux-gnuabi64-g++"><pre class="notranslate"><code class="notranslate">export CC=/usr/bin/mips64-linux-gnuabi64-gcc
export CXX=/usr/bin/mips64-linux-gnuabi64-g++
</code></pre></div>
<p dir="auto">Those are cross-compilers for MIPS64.<br>
So when I try to build bazel using:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="bazel build //tensorflow/tools/lib_package:libtensorflow --spawn_strategy=standalone --verbose_failures"><pre class="notranslate"><code class="notranslate">bazel build //tensorflow/tools/lib_package:libtensorflow --spawn_strategy=standalone --verbose_failures
</code></pre></div>
<p dir="auto">I get the following error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ERROR: /root/.cache/bazel/_bazel_root/36c1970dc5e3eff66b396f9517eb3547/external/hwloc/BUILD.bazel:214:1: C++ compilation of rule '@hwloc//:hwloc' failed (Exit 1): mips64-linux-gnuabi64-gcc failed: error executing command
  (cd /root/.cache/bazel/_bazel_root/36c1970dc5e3eff66b396f9517eb3547/execroot/org_tensorflow &amp;&amp; \
  exec env - \
    PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Users/kprosvir/Downloads/cmder/vendor/conemu-maximus5/ConEmu/wsl:/mnt/c/Users/kprosvir/Downloads/cmder/vendor/conemu-maximus5/ConEmu/Scripts:/mnt/c/Users/kprosvir/Downloads/cmder/vendor/conemu-maximus5:/mnt/c/Users/kprosvir/Downloads/cmder/vendor/conemu-maximus5/ConEmu:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Windows/System32/OpenSSH:/mnt/c/Program Files (x86)/Sennheiser/SoftphoneSDK:/mnt/c/ProgramData/Webex/Webex/Applications:/mnt/c/Users/kprosvir/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/kprosvir/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/kprosvir/AppData/Local/hyper/app-3.0.0/resources/bin:/mnt/c/Users/kprosvir/AppData/Local/Box/Box Edit:/snap/bin:/usr/local/go/bin:/root/go//bin' \
    PWD=/proc/self/cwd \
  /usr/bin/mips64-linux-gnuabi64-gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections -MD -MF bazel-out/host/bin/external/hwloc/_objs/hwloc/topology-x86.pic.d '-frandom-seed=bazel-out/host/bin/external/hwloc/_objs/hwloc/topology-x86.pic.o' -fPIC -iquote external/hwloc -iquote bazel-out/host/bin/external/hwloc -isystem external/hwloc/hwloc -isystem bazel-out/host/bin/external/hwloc/hwloc -isystem external/hwloc/include -isystem bazel-out/host/bin/external/hwloc/include -g0 -I. -Ihwloc -Iinclude -Wno-vla '-DHWLOC_DUMPED_HWDATA_DIR=' '-DRUNSTATEDIR=' -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__=&quot;redacted&quot;' '-D__TIMESTAMP__=&quot;redacted&quot;' '-D__TIME__=&quot;redacted&quot;' -c external/hwloc/hwloc/topology-x86.c -o bazel-out/host/bin/external/hwloc/_objs/hwloc/topology-x86.pic.o)
Execution platform: @bazel_tools//platforms:host_platform
In file included from external/hwloc/hwloc/topology-x86.c:23:0:
external/hwloc/hwloc/topology-x86.c: In function 'cpuid_or_from_dump':
external/hwloc/include/private/cpuid-x86.h:67:3: error: invalid 'asm': invalid use of '%k'
   __asm__(
   ^~~~~~~
Target //tensorflow/tools/lib_package:libtensorflow failed to build"><pre class="notranslate"><code class="notranslate">ERROR: /root/.cache/bazel/_bazel_root/36c1970dc5e3eff66b396f9517eb3547/external/hwloc/BUILD.bazel:214:1: C++ compilation of rule '@hwloc//:hwloc' failed (Exit 1): mips64-linux-gnuabi64-gcc failed: error executing command
  (cd /root/.cache/bazel/_bazel_root/36c1970dc5e3eff66b396f9517eb3547/execroot/org_tensorflow &amp;&amp; \
  exec env - \
    PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Users/kprosvir/Downloads/cmder/vendor/conemu-maximus5/ConEmu/wsl:/mnt/c/Users/kprosvir/Downloads/cmder/vendor/conemu-maximus5/ConEmu/Scripts:/mnt/c/Users/kprosvir/Downloads/cmder/vendor/conemu-maximus5:/mnt/c/Users/kprosvir/Downloads/cmder/vendor/conemu-maximus5/ConEmu:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Windows/System32/OpenSSH:/mnt/c/Program Files (x86)/Sennheiser/SoftphoneSDK:/mnt/c/ProgramData/Webex/Webex/Applications:/mnt/c/Users/kprosvir/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/kprosvir/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/kprosvir/AppData/Local/hyper/app-3.0.0/resources/bin:/mnt/c/Users/kprosvir/AppData/Local/Box/Box Edit:/snap/bin:/usr/local/go/bin:/root/go//bin' \
    PWD=/proc/self/cwd \
  /usr/bin/mips64-linux-gnuabi64-gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections -MD -MF bazel-out/host/bin/external/hwloc/_objs/hwloc/topology-x86.pic.d '-frandom-seed=bazel-out/host/bin/external/hwloc/_objs/hwloc/topology-x86.pic.o' -fPIC -iquote external/hwloc -iquote bazel-out/host/bin/external/hwloc -isystem external/hwloc/hwloc -isystem bazel-out/host/bin/external/hwloc/hwloc -isystem external/hwloc/include -isystem bazel-out/host/bin/external/hwloc/include -g0 -I. -Ihwloc -Iinclude -Wno-vla '-DHWLOC_DUMPED_HWDATA_DIR=' '-DRUNSTATEDIR=' -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/hwloc/hwloc/topology-x86.c -o bazel-out/host/bin/external/hwloc/_objs/hwloc/topology-x86.pic.o)
Execution platform: @bazel_tools//platforms:host_platform
In file included from external/hwloc/hwloc/topology-x86.c:23:0:
external/hwloc/hwloc/topology-x86.c: In function 'cpuid_or_from_dump':
external/hwloc/include/private/cpuid-x86.h:67:3: error: invalid 'asm': invalid use of '%k'
   __asm__(
   ^~~~~~~
Target //tensorflow/tools/lib_package:libtensorflow failed to build
</code></pre></div>
<p dir="auto">So the question is: is there any way to fix it and successfully build it for MIPS64?</p>