Build Tensorflow on RPi3 with Bazel: C++ compilation of rule '@boringssl//:crypto' failed

久未见 提交于 2019-12-11 11:53:24

问题


Trying to run tensorflow on Raspberry PI 3B.

Following the Guide on: https://github.com/samjabrahams/tensorflow-on-raspberry-pi/blob/master/GUIDE.md#3-build-bazel

Everything goes fine until the following step:

pi@raspberrypi:~/tf/tensorflow $ bazel build -c opt --jobs 1 --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

gcc is 4.8, bazel is 5.4 Raspbian 9 (Stretch)

ERROR: /home/pi/.cache/bazel/_bazel_pi/477..6d/external/boringssl/BUILD:115:1: C++ compilation of rule '@boringssl//:crypto' failed (Exit 1): gcc failed: error executing command

Here is what follows after the error-message:

     (cd /home/pi/.cache/bazel/_bazel_pi/477..6d/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_aesgcmsiv.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_aesgcmsiv.c -o bazel-out/local-opt/bin/external/boringssl/_objs/crypto/external/boringssl/src/crypto/cipher_extra/e_aesgcmsiv.pic.o).
            external/boringssl/src/crypto/cipher_extra/e_aesgcmsiv.c: In function 'gcm_siv_crypt':
            external/boringssl/src/crypto/cipher_extra/e_aesgcmsiv.c:616:3: 

    error: 'for' loop initial declarations are only allowed in C99 mode
               for (size_t done = 0; done < in_len;) {
               ^
            external/boringssl/src/crypto/cipher_extra/e_aesgcmsiv.c:616:3: note: use option -std=c99 or -std=gnu99 to compile your code
            external/boringssl/src/crypto/cipher_extra/e_aesgcmsiv.c:626:5: 

    error: 'for' loop initial declarations are only allowed in C99 mode
                 for (size_t i = 0; i < todo; i++) {
                 ^
            external/boringssl/src/crypto/cipher_extra/e_aesgcmsiv.c: In function 'gcm_siv_polyval':
            external/boringssl/src/crypto/cipher_extra/e_aesgcmsiv.c:673:3: error: 'for' loop initial declarations are only allowed in C99 mode
               for (size_t i = 0; i < EVP_AEAD_AES_GCM_SIV_NONCE_LEN; i++) {
               ^
            external/boringssl/src/crypto/cipher_extra/e_aesgcmsiv.c: In function 'gcm_siv_keys':
            external/boringssl/src/crypto/cipher_extra/e_aesgcmsiv.c:703:3: error: 'for' loop initial declarations are only allowed in C99 mode
               for (size_t i = 0; i < blocks_needed; i++) {
               ^
            Target //tensorflow/tools/pip_package:build_pip_package failed to build
            INFO: Elapsed time: 69.995s, Critical Path: 1.36s

Found several different issues for this but nothing worked so far. I think it could be the gcc version.

来源:https://stackoverflow.com/questions/47075078/build-tensorflow-on-rpi3-with-bazel-c-compilation-of-rule-boringssl-crypt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!