tensorflow-on-raspberry-pi
tensorflow-on-raspberry-pi copied to clipboard
configure problem in the latest version of tensorflow
Environment info
Operating System: raspbian
Steps to reproduce
- 1.Follow the README to install the tensorflow raspbian core lib
- 2.Try to building from source
- 3.When come to the step 4. Compiling TensorFlow and use the command
./configure
, i meet the problem thatplease upgrade your bazel installation to version 0.5.4 or higher to build Tensorflow.
Seems like the tensorflow don't support bazel 0.4.5 anymore, can you give some guidance about how to build a RPI-friendly bazel in this situation? many thanks
After this
download bazel 0.5.4
follow all the instruction in the guidance except
use
nano tools/cpp/lib_cc_configure.bzl
instead of
nano tools/cpp/cc_configure.bzl
and pass the step CUZ tensorflow update this code and the url is not cloudflare anymore
sudo nano WORKSPACE http_file( name = "numericjs_numeric_min_js", url = "http://cdnjs.cloudflare.com/ajax/libs/numeric/1.2.6/numeric.min.js", )
then meet another problem:
At global scope: cc1plus: warning: unrecognized command line option "-Wno-shift-negative-value" [enabled by default] ERROR: /home/pi/.cache/bazel/bazel_pi/4770c5ca1786316d370c900c0b614a6d/external/boringssl/BUILD:115:1: C++ compilation of rule '@boringssl//:crypto' failed (Exit 1): gcc failed: error executing command (cd /home/pi/.cache/bazel/bazel_pi/4770c5ca1786316d370c900c0b614a6d/execroot/org_tensorflow &&
exec env -
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
PWD=/proc/self/cwd
PYTHON_BIN_PATH=/usr/bin/python
PYTHON_LIB_PATH=/usr/local/lib/python2.7/dist-packages
TF_NEED_CUDA=0
TF_NEED_OPENCL=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 '-mfpu=neon-vfpv4' -funsafe-math-optimizations -ftree-vectorize -fomit-frame-pointer -MD -MF bazel-out/local-opt/bin/external/boringssl/objs/crypto/external/boringssl/src/crypto/cipher_extra/e_chacha20poly1305.pic.d -fPIC -iquote external/boringssl -iquote bazel-out/local-opt/genfiles/external/boringssl -iquote external/bazel_tools -iquote bazel-out/local-opt/genfiles/external/bazel_tools -isystem external/boringssl/src/include -isystem bazel-out/local-opt/genfiles/external/boringssl/src/include -isystem external/bazel_tools/tools/cpp/gcc3 -DOPENSSL_NO_ASM -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE="redacted"' '-D__TIMESTAMP_="redacted"' '-D__TIME__="redacted"' -c external/boringssl/src/crypto/cipher_extra/e_chacha20poly1305.c -o bazel-out/local-opt/bin/external/boringssl/_objs/crypto/external/boringssl/src/crypto/cipher_extra/e_chacha20poly1305.pic.o). external/boringssl/src/crypto/cipher_extra/e_chacha20poly1305.c: In function 'poly1305_update_length': external/boringssl/src/crypto/cipher_extra/e_chacha20poly1305.c:145:3: error: 'for' loop initial declarations are only allowed in C99 mode for (unsigned i = 0; i < sizeof(length_bytes); i++) { ^ external/boringssl/src/crypto/cipher_extra/e_chacha20poly1305.c:145:3: note: use option -std=c99 or -std=gnu99 to compile your code external/boringssl/src/crypto/cipher_extra/e_chacha20poly1305.c: In function 'aead_chacha20_poly1305_seal_scatter': external/boringssl/src/crypto/cipher_extra/e_chacha20poly1305.c:229:5: error: 'for' loop initial declarations are only allowed in C99 mode for (size_t done = 0; done < extra_in_len; block_counter++) { ^ external/boringssl/src/crypto/cipher_extra/e_chacha20poly1305.c:233:7: error: 'for' loop initial declarations are only allowed in C99 mode for (size_t i = offset; i < sizeof(block) && done < extra_in_len; ^ Target //tensorflow/tools/pip_package:build_pip_package failed to build INFO: Elapsed time: 307.086s, Critical Path: 90.89s
so.......T_T
After fixed up this problem.. there are also numerous problems .. seems to be caused by the least version of bazel.. so does anyone have the source of tensorflow in 1.1.0 version? like i can get a consequence similar to git clone --recurse-submodules https://github.com/tensorflow/tensorflow.git
but in the version of 1.1.0
hey, I got the same problem as well. How did u solve this problem and did you get tensorflow working on raspberry Pi yet?
@turkeyB I have the same problem as you are having, have you found a way to get the 1.1.0 version?
Any fix for the above error? Unable to proceed further to build tensorflow. Need help on this urgently. ERROR: /home/pi/.cache/bazel/bazel_pi/4770c5ca1786316d370c900c0b614a6d/external/boringssl/BUILD:115:1: C++ compilation of rule '@boringssl//:crypto' failed (Exit 1): gcc failed: error executing command (cd /home/pi/.cache/bazel/bazel_pi/4770c5ca1786316d370c900c0b614a6d/execroot/org_tensorflow && exec env - PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games PWD=/proc/self/cwd PYTHON_BIN_PATH=/usr/bin/python PYTHON_LIB_PATH=/usr/local/lib/python2.7/dist-packages TF_NEED_CUDA=0 TF_NEED_OPENCL=0
Thanks
Getting same error. Any updates to this ?
getting this error at the end of the installation of the this: sudo pip install /tmp/tensorflow_pkg/tensorflow-1.6.0rca1-cp27-none-linux_armv7l.whl
Command /usr/bin/python -c "import setuptools, tokenize;file='/tmp/pip-build-3841DS/grpcio/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-k5wlV_-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-3841DS/grpcio
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in
PLease help?
Newer version of BoringSSL doesn't support gcc on an ARM host cpu. In my case, the patch, boringssl_fix_rpi.patch works fine: https://github.com/thortex/rpi3-tensorflow/blob/fb3b7647c0a676c98f707edeff111f2b4c3b87d3/setup/boringssl_fix_rpi.patch
similar issue is reported for ppc: https://github.com/tensorflow/tensorflow/issues/20677 with PR: https://github.com/wdirons/tensorflow/commit/8a5c6c4c305905a206065b0f5fa9a86c03876428
My build script of TensorFlow v1.9.0, https://github.com/thortex/rpi3-tensorflow/blob/fb3b7647c0a676c98f707edeff111f2b4c3b87d3/setup/045_build_tf_py3.sh has successfully completed on Raspberry Pi 3, and I had to apply four patches for TensorFlow v1.9.0 to run my neural net model:
- Substitute 'lib' for 'lib64'.
cd tensorflow-$V && grep -Rl 'lib64' | xargs sed -i 's/lib64/lib/g'
- If you don't use ConcatCPU function, just comment it out as-a-work-around to fix a link error of tensorflow::ConcatCPU() method.
sed -i 's/ ConcatCPU/ \/\/ConcatCPU/;' tensorflow/core/kernels/list_kernels.h
- Apply this to fix a runtime exception error of PeriodicResample Python function.
sed -i 's/assert/if op_def.name == "PeriodicResample": continue\n assert/;' tensorflow/python/framework/op_def_registry.py
- Apply patches to fix a compile error of newer BoringSSL, and use a patched BoringSSL archive, e.g., https://github.com/thortex/rpi3-tensorflow/blob/fb3b7647c0a676c98f707edeff111f2b4c3b87d3/setup/045_build_tf_py3.sh#L40
Instructions, shell scripts, and/or prebuilt wheel packages are located in my Github; https://github.com/thortex/rpi3-tensorflow/
I used gcc v4.8, bazel v0.10.0, TensorFlow v1.9.0, and Raspberry Pi 3. A USB memory as swap is required to expand Pi's main memory: https://github.com/samjabrahams/tensorflow-on-raspberry-pi/blob/master/GUIDE.md
If your Bazel gets stuck while building, '--jobs 0' option would be useful.