Repository navigation
Syntax Error on bazel build #27
Description
Activity
The issue comes from the Python version used, we only support Python 3.5 for now. If you can use 3.5 then downgrading is the easiest way.
If you want to try with 3.7 then I suggest you bump the Cython version to 0.29 (as suggested here):
- replace the 3 occurences of
3732784c45cfb040a5b0936951d196f83a12ea17by443369fc35ac35525eb4241548cad79d0c94f8dcin thistf_http_archive - replace the
sha256field by the correctsha256sumof the tarball (or an empty string), in this case6dcd30b5ceb887b2b965ee7ceb82ea3acb5f0642fe2206c7636b45acea4798e5->e49631f8f2eb8910b4b341e883d29db16b83d11b71bee04ca853c113c2cb5612
This may bring more issues which I could help with if needed.
- replace the 3 occurences of
Thanks, I'm trying. I'll give you some news in a couple of hours (bazel is not fast at all...)
Right, it goes further, but failed :)
ERROR: /home/pafer/.cache/bazel/_bazel_pafer/e35f46a077ab640c6c436e2e9faf4c45/external/grpc/BUILD:502:1: C++ compilation of rule '@grpc//:gpr_base' failed (Exit 1): gcc failed: error executing command (cd /home/pafer/.cache/bazel/_bazel_pafer/e35f46a077ab640c6c436e2e9faf4c45/execroot/org_tensorflow && \ exec env - \ LD_LIBRARY_PATH=../ComputeCpp-CE-1.3.0-CentOS-x86_64//lib \ PATH=/home/pafer/.nvm/versions/node/v12.10.0/bin:/home/pafer/Envs/google-cloud-sdk/bin:/home/pafer/.local/bin:/home/pafer/bin:/home/pafer/.local/bin:/home/pafer/bin:/usr/share/Modules/bin:/usr/condabin:/home/pafer/.go/path/go-1.13/bin:/home/pafer/.go/root/go-1.13/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin \ PWD=/proc/self/cwd \ /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 '-std=c++0x' -MD -MF bazel-out/host/bin/external/grpc/_objs/gpr_base/log_linux.pic.d '-frandom-seed=bazel-out/host/bin/external/grpc/_objs/gpr_base/log_linux.pic.o' -fPIC '-DGRPC_ARES=0' -iquote external/grpc -iquote bazel-out/host/genfiles/external/grpc -iquote bazel-out/host/bin/external/grpc -iquote external/bazel_tools -iquote bazel-out/host/genfiles/external/bazel_tools -iquote bazel-out/host/bin/external/bazel_tools -isystem external/grpc/include -isystem bazel-out/host/genfiles/external/grpc/include -isystem bazel-out/host/bin/external/grpc/include -g0 '-march=native' -g0 -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/grpc/src/core/lib/gpr/log_linux.cc -o bazel-out/host/bin/external/grpc/_objs/gpr_base/log_linux.pic.o) external/grpc/src/core/lib/gpr/log_linux.cc:43:13: error: ambiguating new declaration of 'long int gettid()' 43 | static long gettid(void) { return syscall(__NR_gettid); } | ^~~~~~ In file included from /usr/include/unistd.h:1170, from external/grpc/src/core/lib/gpr/log_linux.cc:41: /usr/include/bits/unistd_ext.h:34:16: note: old declaration '__pid_t gettid()' 34 | extern __pid_t gettid (void) __THROW; | ^~~~~~ external/grpc/src/core/lib/gpr/log_linux.cc:43:13: warning: 'long int gettid()' defined but not used [-Wunused-function] 43 | static long gettid(void) { return syscall(__NR_gettid); } | ^~~~~~ Target //tensorflow/tools/pip_package:build_pip_package failed to build INFO: Elapsed time: 60.054s, Critical Path: 15.39s INFO: 388 processes: 388 local. FAILED: Build did NOT complete successfullyDon't know if I should open a new issue, or leave it like that and check when it will be possible to compile with Python 3.7.x
Thanks for your help
Thank you for trying it :)
So this is now hitting this issue: grpc/grpc#18950
Similarly we would need to bump grpc to 1.24 by replacing in tensorflow/workspace.bzl:d184fa229d75d336aedea0041bd59cb93e7e267f->2de2e8dd8921e1f7d043e01faf7fe8a291fbb072895b31310e718a61f7335759a778c068a6edde1c089883598a0830cbb7075673->c396cabdf18650a61c0ecb171fec8bae6580f686b52558f59f410809bdbe0bae
I'm happy to keep this issue open to discuss on how to enable support for Python 3.7. I may give it a go myself at some point so that we have an experimental branch for 3.7.
Ok, I will try today (I'm a bit busy for a couple of hours)
Thanks for your helpMy experiments suggest that it will be to difficult to cherry pick the right changes. The only solution is to bump the fork to at least TF 1.11 which is not planned at the moment.
I am trying to build tensorflow on bazel 0.5.4 and bump into this error. I am running this on an ubuntu 16.04 instance. Python version is 3.6.3 and Cython is 0.29. Any idea how to go about this?
root@c3c16b3207f1:/salus/tensorflow-salus# cython -V Cython version 0.29.24 root@c3c16b3207f1:/salus/tensorflow-salus# python -V Python 3.6.3 root@c3c16b3207f1:/salus/tensorflow-salus# inv build bazel build -c opt --config=cuda //tensorflow:libtensorflow_framework.so //tensorflow:libtensorflow_kernels.so //tensorflow/tools/pip_package:build_pip_package ................... WARNING: /salus/tensorflow-salus/tensorflow/core/BUILD:1814: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 /salus/tensorflow-salus/tensorflow/tensorflow.bzl:1138:30. WARNING: /salus/tensorflow-salus/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: /salus/tensorflow-salus/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 3 targets... ERROR: /salus/tensorflow-salus/tensorflow/python/BUILD:4586:1: Executing genrule //tensorflow/python:framework_fast_tensor_util_cython_translation failed (Exit 1). Traceback (most recent call last): File "/root/.cache/bazel/_bazel_root/ef6f2d7aa9e625bf367e9f2cf4a24bad/execroot/org_tensorflow/bazel-out/host/bin/external/cython/cython_binary.runfiles/org_tensorflow/../cython/cython.py", line 17, in <module> main(command_line = 1) File "/root/.cache/bazel/_bazel_root/ef6f2d7aa9e625bf367e9f2cf4a24bad/external/cython/Cython/Compiler/Main.py", line 720, in main result = compile(sources, options) File "/root/.cache/bazel/_bazel_root/ef6f2d7aa9e625bf367e9f2cf4a24bad/external/cython/Cython/Compiler/Main.py", line 695, in compile return compile_multiple(source, options) File "/root/.cache/bazel/_bazel_root/ef6f2d7aa9e625bf367e9f2cf4a24bad/external/cython/Cython/Compiler/Main.py", line 666, in compile_multiple context = options.create_context() File "/root/.cache/bazel/_bazel_root/ef6f2d7aa9e625bf367e9f2cf4a24bad/external/cython/Cython/Compiler/Main.py", line 589, in create_context return Context(self.include_path, self.compiler_directives, File "/root/.cache/bazel/_bazel_root/ef6f2d7aa9e625bf367e9f2cf4a24bad/external/cython/Cython/Compiler/Main.py", line 75, in __init__ from . import Builtin, CythonScope File "/root/.cache/bazel/_bazel_root/ef6f2d7aa9e625bf367e9f2cf4a24bad/external/cython/Cython/Compiler/CythonScope.py", line 5, in <module> from .UtilityCode import CythonUtilityCode File "/root/.cache/bazel/_bazel_root/ef6f2d7aa9e625bf367e9f2cf4a24bad/external/cython/Cython/Compiler/UtilityCode.py", line 3, in <module> from .TreeFragment import parse_from_strings, StringParseContext File "/root/.cache/bazel/_bazel_root/ef6f2d7aa9e625bf367e9f2cf4a24bad/external/cython/Cython/Compiler/TreeFragment.py", line 17, in <module> from .Visitor import VisitorTransform File "/root/.cache/bazel/_bazel_root/ef6f2d7aa9e625bf367e9f2cf4a24bad/external/cython/Cython/Compiler/Visitor.py", line 15, in <module> from . import ExprNodes File "/root/.cache/bazel/_bazel_root/ef6f2d7aa9e625bf367e9f2cf4a24bad/external/cython/Cython/Compiler/ExprNodes.py", line 2875 await = None ^ SyntaxError: invalid syntax INFO: Elapsed time: 44.710s, Critical Path: 7.53s@ShreyasheeSinha what target are you building for? Are you using the SYCL build option listed in the original report in this issue? If not then I would raise a new issue with the information about how you are trying to build TensorFlow.
System information
bazel build --verbose_failures --jobs=6 --config=sycl --config=opt //tensorflow/tools/pip_package:build_pip_packageDescribe the problem
I try to build with SYSCL support following https://developer.codeplay.com/products/computecpp/ce/guides/tensorflow-guide/tensorflow-native-compilation, it fails
Source code / logs
My bazel config:
Regards,