1

I tried to build tensorflow from source but failed due to gcc error.

Error log:

gcc: error trying to exec 'as': execvp: No such file or directory
ERROR: /home/pcy/tensorflow-r0.10/tensorflow/core/kernels/BUILD:369:1:
output 'tensorflow/core/kernels/_objs/batch_matrix_band_part_op_gpu/tensorflow/core/kernels/batch_matrix_band_part_op_gpu.cu.pic.o' was not created.

ERROR: /home/pcy/tensorflow-r0.10/tensorflow/core/kernels/BUILD:369:1: not all outputs were created.
Target //tensorflow/tools/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 24.255s, Critical Path: 23.90s
pcy@BJSH-DATAGPU-134-200:~/tensorflow-r0.10$ whereis as
as: /usr/bin/as /usr/share/man/man1/as.1.gz

Can anyone explain this? I have no idea why it is wrong...

Franz Ebner
  • 4,951
  • 3
  • 39
  • 57
潘晨毅
  • 11
  • 2

1 Answers1

2

I am not sure, but I believe that is because Bazel unsets the path variable and copies the required tools internally or something.

The workaround is unfortunately that you have to recompile your compiler, and hardcode the paths to as, ld and nm.

This is related to Issue #2806.

You have to configure your compiler like this:

./configure --prefix=/opt/gcc-5.3 --disable-nls --enable-languages=c,c++ --with-ld=/bin/ld --with-nm=/bin/nm --with-as=/usr/bin/as

You can obviously choose your own prefix path.

fat-lobyte
  • 1,129
  • 1
  • 10
  • 16
  • Worked for me, with gcc-4.9.4. Thanks! Then, after a short while, I've found [this](https://gist.github.com/taylorpaul/3e4e405ffad1be8355bf742fa24b41f0) post, which suggests to just copy "as" to fix this issue. I've not tried that myself, though, so I don't want to post this as an answer. – Igor Dec 01 '16 at 17:24