tensorflow / tensorflow

An Open Source Machine Learning Framework for Everyone
https://tensorflow.org
Apache License 2.0
185.45k stars 74.17k forks source link

Building Tensorflow from source failed, compilation error #15118

Closed rezwan16 closed 6 years ago

rezwan16 commented 6 years ago

System information

Describe the problem

The following errors appears at the building stage when I tried to install Tensorflow for CPU from source.

Source code / logs

WARNING: /home/localuser/tensorflow/tensorflow/core/BUILD:1813:1: in includes attribute of cc_library rule //tensorflow/core:framework_headers_lib: '../../external/nsync/public' resolves to 'external/nsync/public' not below the relative path of its package 'tensorflow/core'. This will be an error in the future. Since this rule was created by the macro 'cc_header_only_library', the error might have been caused by the macro implementation in /home/localuser/tensorflow/tensorflow/tensorflow.bzl:1100:30.
WARNING: /home/localuser/tensorflow/tensorflow/contrib/learn/BUILD:15:1: in py_library rule //tensorflow/contrib/learn:learn: target '//tensorflow/contrib/learn:learn' depends on deprecated target '//tensorflow/contrib/session_bundle:exporter': No longer supported. Switch to SavedModel immediately.
WARNING: /home/localuser/tensorflow/tensorflow/contrib/learn/BUILD:15:1: in py_library rule //tensorflow/contrib/learn:learn: target '//tensorflow/contrib/learn:learn' depends on deprecated target '//tensorflow/contrib/session_bundle:gc': No longer supported. Switch to SavedModel immediately.
INFO: Found 1 target...
ERROR: /home/localuser/tensorflow/tensorflow/core/grappler/costs/BUILD:112:1: C++ compilation of rule '//tensorflow/core/grappler/costs:robust_stats' failed (Exit 1): gcc failed: error executing command 
  (cd /root/.cache/bazel/_bazel_localuser/88f96db14f5044a661b2d9ab97596b51/execroot/org_tensorflow && \
  exec env - \
    PATH=/opt/jdk1.8.0_144/bin:/home/localuser/bazel-0.6.1/output:/usr/local/MATLAB/R2016a/bin:/Ansys/AnsysEM170/AnsysEM17.0/Linux64:/Ansys/AnsysEM170/LayoutIntegrations17.0/Linux64:/usr/local/bin:/usr/local/netscape:/usr/sbin:/usr/bin:/usr/lib:/bin:/sbin:/etc:/opt/lumerical/fdtd/bin:/lib:.:/root/bin \
    PWD=/proc/self/cwd \
    PYTHON_BIN_PATH=/usr/local/bin/python2.7 \
    PYTHON_LIB_PATH=/usr/local/lib/python2.7/site-packages \
    TF_NEED_CUDA=0 \
    TF_NEED_OPENCL_SYCL=0 \
  /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 -ffunction-sections -fdata-sections -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK '-march=native' '-std=c++0x' -MD -MF bazel-out/local-opt/bin/tensorflow/core/grappler/costs/_objs/robust_stats/tensorflow/core/grappler/costs/robust_stats.pic.d '-frandom-seed=bazel-out/local-opt/bin/tensorflow/core/grappler/costs/_objs/robust_stats/tensorflow/core/grappler/costs/robust_stats.pic.o' -fPIC -iquote . -iquote bazel-out/local-opt/genfiles -iquote external/bazel_tools -iquote bazel-out/local-opt/genfiles/external/bazel_tools -isystem external/bazel_tools/tools/cpp/gcc3 -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c tensorflow/core/grappler/costs/robust_stats.cc -o bazel-out/local-opt/bin/tensorflow/core/grappler/costs/_objs/robust_stats/tensorflow/core/grappler/costs/robust_stats.pic.o).
tensorflow/core/grappler/costs/robust_stats.cc: In function 'std::pair<double, double> tensorflow::grappler::ScaledMedianAbsoluteDeviation(const std::vector<double, std::allocator<double> >&)':
tensorflow/core/grappler/costs/robust_stats.cc:71: error: expected initializer before ':' token
tensorflow/core/grappler/costs/robust_stats.cc:75: error: expected primary-expression before 'return'
tensorflow/core/grappler/costs/robust_stats.cc:75: error: expected ')' before 'return'
tensorflow/core/grappler/costs/robust_stats.cc: In constructor 'tensorflow::grappler::RobustStats::RobustStats(const std::vector<double, std::allocator<double> >&)':
tensorflow/core/grappler/costs/robust_stats.cc:79: error: type 'tensorflow::grappler::RobustStats' is not a direct base of 'tensorflow::grappler::RobustStats'
tensorflow/core/grappler/costs/robust_stats.cc: In function 'double tensorflow::grappler::UpdateHuberMean(const std::vector<double, std::allocator<double> >&, double, double)':
tensorflow/core/grappler/costs/robust_stats.cc:95: error: expected initializer before ':' token
tensorflow/core/grappler/costs/robust_stats.cc:152: error: expected primary-expression at end of input
tensorflow/core/grappler/costs/robust_stats.cc:152: error: expected ';' at end of input
tensorflow/core/grappler/costs/robust_stats.cc:152: error: expected primary-expression at end of input
tensorflow/core/grappler/costs/robust_stats.cc:152: error: expected ')' at end of input
tensorflow/core/grappler/costs/robust_stats.cc:152: error: expected statement at end of input
tensorflow/core/grappler/costs/robust_stats.cc:92: warning: unused variable 'num_within'
tensorflow/core/grappler/costs/robust_stats.cc:93: warning: unused variable 'sum'
tensorflow/core/grappler/costs/robust_stats.cc:152: error: expected '}' at end of input
tensorflow/core/grappler/costs/robust_stats.cc:152: warning: no return statement in function returning non-void
tensorflow/core/grappler/costs/robust_stats.cc: At global scope:
tensorflow/core/grappler/costs/robust_stats.cc:152: error: expected '}' at end of input
tensorflow/core/grappler/costs/robust_stats.cc:152: error: expected '}' at end of input
tensorflow/core/grappler/costs/robust_stats.cc:63: warning: 'std::pair<double, double> tensorflow::grappler::ScaledMedianAbsoluteDeviation(const std::vector<double, std::allocator<double> >&)' defined but not used
cc1plus: warning: unrecognized command line option "-Wno-free-nonheap-object"
Target //tensorflow/tools/pip_package:build_pip_package failed to build
INFO: Elapsed time: 10.342s, Critical Path: 0.72s

Comments

I checked that it's not a memory issue.

Related issues

#8642

drpngx commented 6 years ago

Not sure, without looking at the code, maybe gcc is too old?

rezwan16 commented 6 years ago

I have updated my gcc to 4.8.2. Same compilation error shows up. A similar error might have been reported here.

tensorflowbutler commented 6 years ago

It has been 14 days with no activity and this issue has an assignee.Please update the label and/or status accordingly.

tensorflowbutler commented 6 years ago

Nagging Assigneee: It has been 14 days with no activity and this issue has an assignee. Please update the label and/or status accordingly.

drpngx commented 6 years ago

Was that fixed recently? I think I saw some PR that had parens around the initializer list!

tensorflowbutler commented 6 years ago

Nagging Assignee: It has been 14 days with no activity and this issue has an assignee. Please update the label and/or status accordingly.

drpngx commented 6 years ago

Automatically closing due to lack of recent activity. Please update the issue when new information becomes available, and we will reopen the issue. Thanks!