SyntaxNet Bazel build failed: gcc: error: unrecognized command line option '-h' - tensorflow

Trying to install SyntaxNet on Ubuntu 14.04 LTS, build fails with gcc unrecognized command line option '-h'.
Searched gcc documentation and there seems to be no such command line option.
Have anybody seen this?
sudo /home/user/bin/bazel test --linkopt=-headerpad_max_install_names --spawn_strategy=standalone --genrule_strategy=standalone \
syntaxnet/... util/utf8/...
INFO: Found 65 targets and 12 test targets...
ERROR: /home/user/.cache/bazel/_bazel_root/1a72b3057373bad6ae8a8f20db5423d4/external/re2/BUILD:9:1: Linking of rule '#re2//:re2' failed: gcc failed: error executing command /usr/bin/gcc -shared -o bazel-out/local-opt/bin/external/re2/libre2.so -pthread -no-canonical-prefixes -B/usr/bin -B/usr/bin -pass-exit-codes '-Wl,--build-id=md5' '-Wl,--hash-style=gnu' ... (remaining 3 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
gcc: error: unrecognized command line option '-h'
INFO: Elapsed time: 0.857s, Critical Path: 0.45s

Related

Encountered error while trying to install package. lxml

work/Versions/3.9/Headers -c src/lxml/etree.c -o build/temp.macosx-10.9-universal2-cpython-39/src/lxml/etree.o -w -flat_namespace
src/lxml/etree.c:96:10: fatal error: 'Python.h' file not found
#include "Python.h"
^~~~~~~~~~
1 error generated.
Compile failed: command '/usr/bin/clang' failed with exit code 1
cc -arch x86_64 -I/usr/include/libxml2 -c /var/folders/cf/lh0781v528b2s9g1hk8v7bg40000gn/T/xmlXPathInit1vfqpnc0.c -o var/folders/cf/lh0781v528b2s9g1hk8v7bg40000gn/T/xmlXPathInit1vfqpnc0.o
cc -arch x86_64 var/folders/cf/lh0781v528b2s9g1hk8v7bg40000gn/T/xmlXPathInit1vfqpnc0.o -lxml2 -o a.out
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> lxml
Try using pip3 install lxml, But the above problems still occur

gcc: error: unrecognized command line option '-mfpu=neon-vfpv4'

gcc: error: unrecognized command line option '-mfpu=neon-vfpv4' while building tensorflow from source. I have used bazel build -c opt --copt="-mfpu=neon-vfpv4" --copt="-funsafe-math-optimizations" --copt="-ftree-vectorize" --copt="-fomit-frame-pointer" --local_resources 1024,1.0,1.0 --verbose_failures tensorflow/tools/pip_package:build_pip_package to build it
Don't add --copt="-mfpu=neon-vfpv4" to your command line as this is not a flag gcc supports.
This flag is used on ARM architectures. If you are compiling under x86/amd64, just remove it.
$ gcc -mfpu=neon-vfpv4
gcc: error: unrecognized command line option '-mfpu=neon-vfpv4'
gcc: fatal error: no input files
compilation terminated.
$ arm-none-eabi-gcc -mfpu=neon-vfpv4
arm-none-eabi-gcc: fatal error: no input files
compilation terminated.

TensorFlow 1.1 “bazel build tensorflow/tools/graph_transforms:transform_graph"

When I build quantization tool use the command
"bazel build tensorflow/tools/graph_transforms:transform_graph"
The complie result as below:
WARNING: Sandboxed execution is not supported on your system and thus hermeticity of actions cannot be guaranteed. See http://bazel.build/docs/bazel-user-manual.html#sandboxing for more information. You can turn off this warning via --ignore_unsupported_sandboxing.
INFO: Found 1 target...
ERROR: /root/tensorflow-master/tensorflow/core/BUILD:1287:1: C++ compilation of rule '//tensorflow/core:framework_internal' failed: gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -B/usr/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG ... (remaining 106 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
tensorflow/core/framework/reader_op_kernel.cc:20:61: error: definition of implicitly-declared 'tensorflow::ReaderOpKernel::ReaderOpKernel(tensorflow::OpKernelConstruction*)'
ReaderOpKernel::ReaderOpKernel(OpKernelConstruction* context)
^
tensorflow/core/framework/reader_op_kernel.cc:27:33: error: definition of implicitly-declared 'virtual tensorflow::ReaderOpKernel::~ReaderOpKernel()'
ReaderOpKernel::~ReaderOpKernel() {
^
tensorflow/core/framework/reader_op_kernel.cc:34:50: error: no 'void tensorflow::ReaderOpKernel::Compute(tensorflow::OpKernelContext*)' member function declared in class 'tensorflow::ReaderOpKernel'
void ReaderOpKernel::Compute(OpKernelContext* ctx) {
^
Target //tensorflow/tools/graph_transforms:transform_graph failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 5.989s, Critical Path: 5.02s
What's the problem?
Thanks!
Please try two things:
(1) configure the compile environment first and then compile, like
./configure
bazel build tensorflow/tools/graph_transforms:transform_graph
(2) You can also try:
sudo bazel build tensorflow/tools/graph_transforms:transform_graph
Point (2) worked for me sometimes to remove dependencies of including header files.
please download the latest tensorflow and bazel, if needed.

tensorflow build fail at october 6 2016

Ubuntu 16.04
gcc 5.4.0
java 1.8.0_91
bazel 0.3.1 (download the releases , haven't build from source because it build fail)
I change the config file follow the discussion here and here because it works for ./configure.
I clone the lastest code and configure without GPU. Here is my build instruction at the root directory of tensorflow
bazel build -c opt //tensorflow/tools/pip_package:build_pip_package
The error log:
ERROR: /home/gt/.cache/bazel/_bazel_gt/3d5d29ec73796bda2fc5b2dffed26f47/external/protobuf/BUILD:333:1: Linking of rule '#protobuf//:protoc' failed: gcc failed: error executing command /usr/bin/gcc -o bazel-out/host/bin/external/protobuf/protoc -Wl,-no-as-needed -B/usr/bin -B/usr/bin -pass-exit-codes '-Wl,--build-id=md5' '-Wl,--hash-style=gnu' -Wl,-S -Wl,--gc-sections ... (remaining 1 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
bazel-out/host/bin/external/protobuf/_objs/protoc/external/protobuf/src/google/protobuf/compiler/main.o: In function `main':
main.cc:(.text.startup.main+0x2db): undefined reference to `vtable for google::protobuf::compiler::php::Generator'
main.cc:(.text.startup.main+0x642): undefined reference to `vtable for google::protobuf::compiler::php::Generator'
main.cc:(.text.startup.main+0x740): undefined reference to `vtable for google::protobuf::compiler::php::Generator'
collect2: error: ld returned 1 exit status
Target //tensorflow/tools/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
This is a bug in protobuf, we signaled it already two weeks ago. See https://github.com/google/protobuf/issues/2133

Tensorflow Serving Compile Error Using Docker on OSX

I'm trying to install TensorFlow serving on OSX El Capitan using Docker but keep running into an error. Here is the tutorial I'm following:
https://tensorflow.github.io/serving/docker.html
Here is the command causing the error:
bazel test tensorflow_serving/...
Here's the error I'm getting:
for (int i = 0; i < suffix.size(); ++i) {
^
ERROR: /root/.cache/bazel/_bazel_root/f8d1071c69ea316497c31e40fe01608c/external/tf/tensorflow/core/kernels/BUILD:212:1: C++ compilation of rule '#tf//tensorflow/core/kernels:mirror_pad_op' failed: gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -iquote external/tf -iquote ... (remaining 65 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 4.
gcc: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
Solved! Looks like the issues was with running out of memory in the VM.
Here's how I fixed it:
1) When creating the machine, make sure it has more memory (mine was only 1GB). Here is how you create a docker machine with 4GB:
docker-machine create -d virtualbox --virtualbox-memory 4096 default
2) When running the bazel command pass in a parameter limiting the amount of memory to use. Here I'm running the command using only 2GB:
bazel build -c opt --copt=-mavx --verbose_failures --local_resources 2048,2.0,1.0 -j 1 //tensorflow_serving/example:mnist_export
Where the original command was:
bazel build //tensorflow_serving/example:mnist_export