embag icon indicating copy to clipboard operation
embag copied to clipboard

Unable to Build on ARM 64 Machines

Open ansar-z-khan opened this issue 3 years ago • 1 comments

I am trying to add functionality to Embag for the simulation team but am blocked because it cannot be built.

Embag depends on https://github.com/kobolabs/liblzma which in turn uses Intel Intrinsics this is not supported on non-intel machines.

When building on an M1 Mac I get failures in liblzma both in the host MacOS and when trying to build in a Ubuntu 20 VM running on the Mac.

As people move away from intel Macs this is going to become an issue for a lot more users. Can I get help removing this dependence on Intel machines.

FYI: @liamembark

On Ubuntu VM:


Use --sandbox_debug to see verbose messages from the sandbox gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -MD -MF ... (remaining 66 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
In file included from external/org_lzma_lzma/src/liblzma/lzma/lzma_encoder_optimum_normal.c:14:
external/org_lzma_lzma/src/liblzma/common/memcmplen.h:19:11: fatal error: immintrin.h: No such file or directory
   19 | # include <immintrin.h>
      |           ^~~~~~~~~~~~~
compilation terminated.
Target //embag_echo:embag_echo failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 18.122s, Critical Path: 7.68s
INFO: 29 processes: 9 internal, 20 linux-sandbox.
FAILED: Build did NOT complete successfully

On Mac OS:

ERROR: /private/var/tmp/_bazel_ansarkhan/ee5b0c8acbd65174510f799a7c92e4f4/external/org_lzma_lzma/BUILD.bazel:32:11: Compiling src/liblzma/lz/lz_encoder.c failed: (Aborted): wrapped_clang failed: error executing command external/local_config_cc/wrapped_clang '-D_FORTIFY_SOURCE=1' -fstack-protector -fcolor-diagnostics -Wall -Wthread-safety -Wself-assign -fno-omit-frame-pointer -O0 -DDEBUG 'DEBUG_PREFIX_MAP_PWD=.' ... (remaining 74 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
In file included from external/org_lzma_lzma/src/liblzma/lz/lz_encoder.c:23:
In file included from external/org_lzma_lzma/src/liblzma/common/memcmplen.h:19:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/include/immintrin.h:13:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/include/x86gprintrin.h:15:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/include/hresetintrin.h:42:27: error: invalid input constraint 'a' in asm
  __asm__ ("hreset $0" :: "a"(__eax));
                          ^
In file included from external/org_lzma_lzma/src/liblzma/lz/lz_encoder.c:23:
In file included from external/org_lzma_lzma/src/liblzma/common/memcmplen.h:19:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/include/immintrin.h:17:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/include/mmintrin.h:50:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/include/mmintrin.h:129:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ansar-z-khan avatar Apr 27 '22 21:04 ansar-z-khan

Finally got an M1 mac so I can now reproduce. #52 should solve this!

liambenson avatar Sep 02 '22 00:09 liambenson