google / ruy

Apache License 2.0
303 stars 83 forks source link

Compile failure on armv7a #347

Closed oberluz closed 12 months ago

oberluz commented 1 year ago

Hi, I'm trying to build PyCoral with Tensorflow 2.7.0 for arm7a and it fails as follows:

$ git clone https://github.com/oberluz/pycoral.git
$ git checkout 2_7_0
$ git submodule update --init --recursive 
$ DOCKER_CPUS="armv7a" ./scripts/build.sh --python_versions "310"
...
(cd /home/eyeot-demo/.cache/bazel/_bazel_eyeot-demo/eab0d61a99b6696edb3d2aff87b585e8/execroot/pycoral && \
  exec env - \
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin \
    PWD=/proc/self/cwd \
  /usr/bin/arm-linux-gnueabihf-gcc -fPIC -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-march=armv7-a' '-mfpu=neon-vfpv4' -g0 -O3 -DNDEBUG '-D_FORTIFY_SOURCE=2' -ffunction-sections -fdata-sections -funsafe-math-optimizations -ftree-vectorize '-std=c++17' -MD -MF bazel-out/armv7a-opt/bin/external/org_tensorflow/tensorflow/lite/_objs/minimal_logging/minimal_logging_default.d '-frandom-seed=bazel-out/armv7a-opt/bin/external/org_tensorflow/tensorflow/lite/_objs/minimal_logging/minimal_logging_default.o' -iquote external/org_tensorflow -iquote bazel-out/armv7a-opt/bin/external/org_tensorflow '-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION' '-ffp-contract=off' -Wall -DFARMHASH_NO_CXX_STRING -Wno-sign-compare -O3 -fno-exceptions -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/org_tensorflow/tensorflow/lite/minimal_logging_default.cc -o bazel-out/armv7a-opt/bin/external/org_tensorflow/tensorflow/lite/_objs/minimal_logging/minimal_logging_default.o)
INFO: From Compiling tensorflow/lite/minimal_logging_default.cc:
external/org_tensorflow/tensorflow/lite/minimal_logging_default.cc:28: warning: ignoring '#pragma clang diagnostic' [-Wunknown-pragmas]
   28 | #pragma clang diagnostic push
      | 
external/org_tensorflow/tensorflow/lite/minimal_logging_default.cc:29: warning: ignoring '#pragma clang diagnostic' [-Wunknown-pragmas]
   29 | #pragma clang diagnostic ignored "-Wformat-nonliteral"
      | 
external/org_tensorflow/tensorflow/lite/minimal_logging_default.cc:31: warning: ignoring '#pragma clang diagnostic' [-Wunknown-pragmas]
   31 | #pragma clang diagnostic pop
      | 
SUBCOMMAND: # @org_tensorflow//tensorflow/lite:minimal_logging [action 'Linking external/org_tensorflow/tensorflow/lite/libminimal_logging.a', configuration: 11cae9684ea823b3911201bf8ead584031fd2c07b224432188557a50a44d29ae, execution platform: @local_execution_config_platform//:platform]
(cd /home/eyeot-demo/.cache/bazel/_bazel_eyeot-demo/eab0d61a99b6696edb3d2aff87b585e8/execroot/pycoral && \
  exec env - \
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin \
    PWD=/proc/self/cwd \
  /usr/bin/arm-linux-gnueabihf-ar @bazel-out/armv7a-opt/bin/external/org_tensorflow/tensorflow/lite/libminimal_logging.a-2.params)
SUBCOMMAND: # @com_google_absl//absl/time/internal/cctz:civil_time [action 'Compiling absl/time/internal/cctz/src/civil_time_detail.cc', configuration: 11cae9684ea823b3911201bf8ead584031fd2c07b224432188557a50a44d29ae, execution platform: @local_execution_config_platform//:platform]
(cd /home/eyeot-demo/.cache/bazel/_bazel_eyeot-demo/eab0d61a99b6696edb3d2aff87b585e8/execroot/pycoral && \
  exec env - \
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin \
    PWD=/proc/self/cwd \
  /usr/bin/arm-linux-gnueabihf-gcc -fPIC -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-march=armv7-a' '-mfpu=neon-vfpv4' -g0 -O3 -DNDEBUG '-D_FORTIFY_SOURCE=2' -ffunction-sections -fdata-sections -funsafe-math-optimizations -ftree-vectorize '-std=c++17' -MD -MF bazel-out/armv7a-opt/bin/external/com_google_absl/absl/time/internal/cctz/_objs/civil_time/civil_time_detail.d '-frandom-seed=bazel-out/armv7a-opt/bin/external/com_google_absl/absl/time/internal/cctz/_objs/civil_time/civil_time_detail.o' -iquote external/com_google_absl -iquote bazel-out/armv7a-opt/bin/external/com_google_absl '-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION' '-ffp-contract=off' -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/com_google_absl/absl/time/internal/cctz/src/civil_time_detail.cc -o bazel-out/armv7a-opt/bin/external/com_google_absl/absl/time/internal/cctz/_objs/civil_time/civil_time_detail.o)
ERROR: /home/eyeot-demo/.cache/bazel/_bazel_eyeot-demo/eab0d61a99b6696edb3d2aff87b585e8/external/ruy/ruy/BUILD:585:11: Compiling ruy/pack_arm.cc failed: (Exit 1): arm-linux-gnueabihf-gcc failed: error executing command 
  (cd /home/eyeot-demo/.cache/bazel/_bazel_eyeot-demo/eab0d61a99b6696edb3d2aff87b585e8/sandbox/processwrapper-sandbox/375/execroot/pycoral && \
  exec env - \
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin \
    PWD=/proc/self/cwd \
  /usr/bin/arm-linux-gnueabihf-gcc -fPIC -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-march=armv7-a' '-mfpu=neon-vfpv4' -g0 -O3 -DNDEBUG '-D_FORTIFY_SOURCE=2' -ffunction-sections -fdata-sections -funsafe-math-optimizations -ftree-vectorize '-std=c++17' -MD -MF bazel-out/armv7a-opt/bin/external/ruy/ruy/_objs/pack_arm/pack_arm.d '-frandom-seed=bazel-out/armv7a-opt/bin/external/ruy/ruy/_objs/pack_arm/pack_arm.o' -iquote external/ruy -iquote bazel-out/armv7a-opt/bin/external/ruy -iquote external/cpuinfo -iquote bazel-out/armv7a-opt/bin/external/cpuinfo -iquote external/clog -iquote bazel-out/armv7a-opt/bin/external/clog -Ibazel-out/armv7a-opt/bin/external/cpuinfo/_virtual_includes/cpuinfo -Ibazel-out/armv7a-opt/bin/external/clog/_virtual_includes/clog '-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION' '-ffp-contract=off' -Wall -Wextra -Wc++14-compat -Wundef '-mfpu=neon' -O3 -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/ruy/ruy/pack_arm.cc -o bazel-out/armv7a-opt/bin/external/ruy/ruy/_objs/pack_arm/pack_arm.o)
Execution platform: @local_execution_config_platform//:platform

Use --sandbox_debug to see verbose messages from the sandbox arm-linux-gnueabihf-gcc failed: error executing command 
  (cd /home/eyeot-demo/.cache/bazel/_bazel_eyeot-demo/eab0d61a99b6696edb3d2aff87b585e8/sandbox/processwrapper-sandbox/375/execroot/pycoral && \
  exec env - \
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin \
    PWD=/proc/self/cwd \
  /usr/bin/arm-linux-gnueabihf-gcc -fPIC -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-march=armv7-a' '-mfpu=neon-vfpv4' -g0 -O3 -DNDEBUG '-D_FORTIFY_SOURCE=2' -ffunction-sections -fdata-sections -funsafe-math-optimizations -ftree-vectorize '-std=c++17' -MD -MF bazel-out/armv7a-opt/bin/external/ruy/ruy/_objs/pack_arm/pack_arm.d '-frandom-seed=bazel-out/armv7a-opt/bin/external/ruy/ruy/_objs/pack_arm/pack_arm.o' -iquote external/ruy -iquote bazel-out/armv7a-opt/bin/external/ruy -iquote external/cpuinfo -iquote bazel-out/armv7a-opt/bin/external/cpuinfo -iquote external/clog -iquote bazel-out/armv7a-opt/bin/external/clog -Ibazel-out/armv7a-opt/bin/external/cpuinfo/_virtual_includes/cpuinfo -Ibazel-out/armv7a-opt/bin/external/clog/_virtual_includes/clog '-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION' '-ffp-contract=off' -Wall -Wextra -Wc++14-compat -Wundef '-mfpu=neon' -O3 -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/ruy/ruy/pack_arm.cc -o bazel-out/armv7a-opt/bin/external/ruy/ruy/_objs/pack_arm/pack_arm.o)
Execution platform: @local_execution_config_platform//:platform

Use --sandbox_debug to see verbose messages from the sandbox
In file included from external/ruy/ruy/pack_arm.cc:16:
external/ruy/ruy/pack_arm.h:492:9: warning: multi-line comment [-Wcomment]
  492 | #endif  // (RUY_PLATFORM_NEON_64 || RUY_PLATFORM_NEON_32) && \
      |         ^
external/ruy/ruy/pack_arm.cc: In function 'void ruy::Pack8bitColMajorForNeon4Cols(const ruy::PackParams8bit&)':
external/ruy/ruy/pack_arm.cc:264:3: error: 'asm' operand has impossible constraints
  264 |   asm volatile(
      |   ^~~
Target //src:_pywrap_coral failed to build
INFO: Elapsed time: 234.588s, Critical Path: 88.61s
INFO: 576 processes: 204 internal, 372 processwrapper-sandbox.
FAILED: Build did NOT complete successfully
make: *** [Makefile:152: pybind] Error 1
make: Leaving directory '/workspace'

Building for other versions of python (36 37 38 39, see scripts/build.sh) words. But it fails for 310 which uses ubuntu 22.04

Any ideas?

oberluz commented 12 months ago

Ok, I seem to have worked out why. It fails with arm-linux-gnueabihf-gcc (Debian 10.2.1-6) but not gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0