tensorflow: when install from sources, I encounter ERROR: C++ compilation of rule '//google/protobuf:protobuf_lite' failed: crosstool_wrapper_driver_is_not_gcc failed

Do anyone compile the source of Tensor Flow? When I install Tensor Flow from sources, After I excute under command in terminal.

bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer

I encounter the follow error.

ERROR: ~/tensorflow/google/protobuf/BUILD:29:1: C++ compilation of rule 
'//google/protobuf:protobuf_lite' failed: crosstool_wrapper_driver_is_not_gcc failed: error 
executing command third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc -
U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -fPIE -Wall -Wunused-but-set-
parameter -Wno-free-nonheap-object ... (remaining 40 argument(s) skipped).
Target //tensorflow/cc:tutorials_example_trainer failed to build

My OS is Ubuntu 14.04,GCC/G++ is 4.7, GPU is K40c, Python is 2.7, cuda is 7.0, cudnn is 6.5v2, bazel is installed by compile source code.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 17 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Same here, except with a different error:

.cache/bazel/_bazel_re2300/d217f35631206796f447d50c6f1d6243/external/protobuf/BUILD:331:1: Linking of rule '@protobuf//:protoc' failed: crosstool_wrapper_driver_is_not_gcc failed: error executing command 
  (cd /hmt/sirius1/skv0/u/4/r/re2300/.cache/bazel/_bazel_re2300/d217f35631206796f447d50c6f1d6243/execroot/tensorflow && \
  exec env - \
  external/local_config_cuda/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc -o bazel-out/host/bin/external/protobuf/protoc bazel-out/host/bin/external/protobuf/_objs/protoc/external/protobuf/src/google/protobuf/compiler/main.o bazel-out/host/bin/external/protobuf/libprotoc_lib.a bazel-out/host/bin/external/protobuf/libprotobuf.a bazel-out/host/bin/external/protobuf/libprotobuf_lite.a -lpthread -lstdc++ -B/usr/bin/ -pie -Wl,-z,relro,-z,now -no-canonical-prefixes -pass-exit-codes '-Wl,--build-id=md5' '-Wl,--hash-style=gnu' -Wl,-S -Wl,--gc-sections): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
/usr/bin/ld: unrecognized option '-plugin'
/usr/bin/ld: use the --help option for usage information

EDIT: I fixed this by adding the fno-use-linker-plugin flag to the compiler.

index 20449a1..48a4e60 100755
--- a/third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc.tpl
+++ b/third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc.tpl
@@ -309,6 +309,7 @@ def main():
     # TODO(eliben): rename to a more descriptive name.
     cpu_compiler_flags.append('-D__GCUDACC_HOST__')

+  cpu_compiler_flags.append('-fno-use-linker-plugin')
   return subprocess.call([CPU_COMPILER] + cpu_compiler_flags)

 if __name__ == '__main__':