Skip to content

Build on riscv64 / aarch64 #317

Description

@Forza-tng

I am having issues building SMHasher on Gentoo Linux on aarch64 and riscv64 platform.

For aarch64, it fails at gxhash:

[ 75%] Building C object CMakeFiles/SMHasherSupport.dir/sha2/sha512_256.c.o
/opt/smhasher/smhasher/gxhash.c: In function ‘get_partial’:
/opt/smhasher/smhasher/gxhash.c:198:9: note: use ‘-flax-vector-conversions’ to permit conversions between vectors with differing element types or numbers of subparts
  198 |         int8x16_t mask = vcgtq_s8(vdupq_n_u8(len), vld1q_s8(indices));
      |         ^~~~~~~~~
/opt/smhasher/smhasher/gxhash.c:198:35: error: incompatible type for argument 1 of ‘vcgtq_s8’
  198 |         int8x16_t mask = vcgtq_s8(vdupq_n_u8(len), vld1q_s8(indices));
      |                                   ^~~~~~~~~~~~~~~
      |                                   |
      |                                   uint8x16_t
In file included from /opt/smhasher/smhasher/gxhash.c:171:
/usr/lib/gcc/aarch64-unknown-linux-gnu/14/include/arm_neon.h:8492:21: note: expected ‘int8x16_t’ but argument is of type ‘uint8x16_t’
 8492 | vcgtq_s8 (int8x16_t __a, int8x16_t __b)
      |           ~~~~~~~~~~^~~
/opt/smhasher/smhasher/gxhash.c:208:21: error: incompatible type for argument 1 of ‘vaddq_u8’
  208 |     return vaddq_u8(partial, vdupq_n_u8(len));
      |                     ^~~~~~~
      |                     |
      |                     int8x16_t
/usr/lib/gcc/aarch64-unknown-linux-gnu/14/include/arm_neon.h:350:22: note: expected ‘uint8x16_t’ but argument is of type ‘int8x16_t’
  350 | vaddq_u8 (uint8x16_t __a, uint8x16_t __b)
      |           ~~~~~~~~~~~^~~
/opt/smhasher/smhasher/gxhash.c: In function ‘compress’:
/opt/smhasher/smhasher/gxhash.c:226:21: error: incompatible type for argument 1 of ‘aes_encrypt’
  226 |     b = aes_encrypt(b, vld1q_u32(keys_1));
      |                     ^
      |                     |
      |                     state {aka int8x16_t}
/opt/smhasher/smhasher/gxhash.c:211:49: note: expected ‘uint8x16_t’ but argument is of
type ‘state’ {aka ‘int8x16_t’}
  211 | static inline uint8x16_t aes_encrypt(uint8x16_t data, uint8x16_t keys) {
      |                                      ~~~~~~~~~~~^~~~
/opt/smhasher/smhasher/gxhash.c:226:24: error: incompatible type for argument 2 of ‘aes_encrypt’
  226 |     b = aes_encrypt(b, vld1q_u32(keys_1));
      |                        ^~~~~~~~~~~~~~~~~
      |                        |
      |                        uint32x4_t
/opt/smhasher/smhasher/gxhash.c:211:66: note: expected ‘uint8x16_t’ but argument is of
type ‘uint32x4_t’
  211 | static inline uint8x16_t aes_encrypt(uint8x16_t data, uint8x16_t keys) {
      |                                                       ~~~~~~~~~~~^~~~
/opt/smhasher/smhasher/gxhash.c:227:21: error: incompatible type for argument 1 of ‘aes_encrypt’
  227 |     b = aes_encrypt(b, vld1q_u32(keys_2));
      |                     ^
      |                     |
      |                     state {aka int8x16_t}
/opt/smhasher/smhasher/gxhash.c:211:49: note: expected ‘uint8x16_t’ but argument is of
type ‘state’ {aka ‘int8x16_t’}
  211 | static inline uint8x16_t aes_encrypt(uint8x16_t data, uint8x16_t keys) {
      |                                      ~~~~~~~~~~~^~~~
/opt/smhasher/smhasher/gxhash.c:227:24: error: incompatible type for argument 2 of ‘aes_encrypt’
  227 |     b = aes_encrypt(b, vld1q_u32(keys_2));
      |                        ^~~~~~~~~~~~~~~~~
      |                        |
      |                        uint32x4_t
/opt/smhasher/smhasher/gxhash.c:211:66: note: expected ‘uint8x16_t’ but argument is of
type ‘uint32x4_t’
  211 | static inline uint8x16_t aes_encrypt(uint8x16_t data, uint8x16_t keys) {
      |                                                       ~~~~~~~~~~~^~~~
/opt/smhasher/smhasher/gxhash.c:229:29: error: incompatible type for argument 1 of ‘aes_encrypt_last’
  229 |     return aes_encrypt_last(a, b);
      |                             ^
      |                             |
      |                             state {aka int8x16_t}
/opt/smhasher/smhasher/gxhash.c:217:54: note: expected ‘uint8x16_t’ but argument is of
type ‘state’ {aka ‘int8x16_t’}
  217 | static inline uint8x16_t aes_encrypt_last(uint8x16_t data, uint8x16_t keys) {
      |                                           ~~~~~~~~~~~^~~~
/opt/smhasher/smhasher/gxhash.c:229:32: error: incompatible type for argument 2 of ‘aes_encrypt_last’
  229 |     return aes_encrypt_last(a, b);
      |                                ^
      |                                |
      |                                state {aka int8x16_t}
/opt/smhasher/smhasher/gxhash.c:217:71: note: expected ‘uint8x16_t’ but argument is of
type ‘state’ {aka ‘int8x16_t’}
  217 | static inline uint8x16_t aes_encrypt_last(uint8x16_t data, uint8x16_t keys) {
      |                                                            ~~~~~~~~~~~^~~~
/opt/smhasher/smhasher/gxhash.c: In function ‘compress_fast’:
/opt/smhasher/smhasher/gxhash.c:233:24: error: incompatible type for argument 1 of ‘aes_encrypt’
  233 |     return aes_encrypt(a, b);
      |                        ^
      |                        |
      |                        state {aka int8x16_t}
/opt/smhasher/smhasher/gxhash.c:211:49: note: expected ‘uint8x16_t’ but argument is of
type ‘state’ {aka ‘int8x16_t’}
  211 | static inline uint8x16_t aes_encrypt(uint8x16_t data, uint8x16_t keys) {
      |                                      ~~~~~~~~~~~^~~~
/opt/smhasher/smhasher/gxhash.c:233:27: error: incompatible type for argument 2 of ‘aes_encrypt’
  233 |     return aes_encrypt(a, b);
      |                           ^
      |                           |
      |                           state {aka int8x16_t}
/opt/smhasher/smhasher/gxhash.c:211:66: note: expected ‘uint8x16_t’ but argument is of
type ‘state’ {aka ‘int8x16_t’}
  211 | static inline uint8x16_t aes_encrypt(uint8x16_t data, uint8x16_t keys) {
      |                                                       ~~~~~~~~~~~^~~~
/opt/smhasher/smhasher/gxhash.c: In function ‘finalize’:
/opt/smhasher/smhasher/gxhash.c:241:24: error: incompatible type for argument 1 of ‘aes_encrypt’
  241 |     hash = aes_encrypt(hash, vdupq_n_u32(seed + 0xC992E848));
      |                        ^~~~
      |                        |
      |                        state {aka int8x16_t}
/opt/smhasher/smhasher/gxhash.c:211:49: note: expected ‘uint8x16_t’ but argument is of
type ‘state’ {aka ‘int8x16_t’}
  211 | static inline uint8x16_t aes_encrypt(uint8x16_t data, uint8x16_t keys) {
      |                                      ~~~~~~~~~~~^~~~
/opt/smhasher/smhasher/gxhash.c:241:30: error: incompatible type for argument 2 of ‘aes_encrypt’
  241 |     hash = aes_encrypt(hash, vdupq_n_u32(seed + 0xC992E848));
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                              |
      |                              uint32x4_t
/opt/smhasher/smhasher/gxhash.c:211:66: note: expected ‘uint8x16_t’ but argument is of
type ‘uint32x4_t’
  211 | static inline uint8x16_t aes_encrypt(uint8x16_t data, uint8x16_t keys) {
      |                                                       ~~~~~~~~~~~^~~~
/opt/smhasher/smhasher/gxhash.c:242:24: error: incompatible type for argument 1 of ‘aes_encrypt’
  242 |     hash = aes_encrypt(hash, vld1q_u32(keys_1));
      |                        ^~~~
      |                        |
      |                        state {aka int8x16_t}
/opt/smhasher/smhasher/gxhash.c:211:49: note: expected ‘uint8x16_t’ but argument is of
type ‘state’ {aka ‘int8x16_t’}
  211 | static inline uint8x16_t aes_encrypt(uint8x16_t data, uint8x16_t keys) {
      |                                      ~~~~~~~~~~~^~~~
/opt/smhasher/smhasher/gxhash.c:242:30: error: incompatible type for argument 2 of ‘aes_encrypt’
  242 |     hash = aes_encrypt(hash, vld1q_u32(keys_1));
      |                              ^~~~~~~~~~~~~~~~~
      |                              |
      |                              uint32x4_t
/opt/smhasher/smhasher/gxhash.c:211:66: note: expected ‘uint8x16_t’ but argument is of
type ‘uint32x4_t’
  211 | static inline uint8x16_t aes_encrypt(uint8x16_t data, uint8x16_t keys) {
      |                                                       ~~~~~~~~~~~^~~~
/opt/smhasher/smhasher/gxhash.c:243:24: error: incompatible type for argument 1 of ‘aes_encrypt’
  243 |     hash = aes_encrypt(hash, vld1q_u32(keys_2));
      |                        ^~~~
      |                        |
      |                        state {aka int8x16_t}
/opt/smhasher/smhasher/gxhash.c:211:49: note: expected ‘uint8x16_t’ but argument is of
type ‘state’ {aka ‘int8x16_t’}
  211 | static inline uint8x16_t aes_encrypt(uint8x16_t data, uint8x16_t keys) {
      |                                      ~~~~~~~~~~~^~~~
/opt/smhasher/smhasher/gxhash.c:243:30: error: incompatible type for argument 2 of ‘aes_encrypt’
  243 |     hash = aes_encrypt(hash, vld1q_u32(keys_2));
      |                              ^~~~~~~~~~~~~~~~~
      |                              |
      |                              uint32x4_t
/opt/smhasher/smhasher/gxhash.c:211:66: note: expected ‘uint8x16_t’ but argument is of
type ‘uint32x4_t’
  211 | static inline uint8x16_t aes_encrypt(uint8x16_t data, uint8x16_t keys) {
      |                                                       ~~~~~~~~~~~^~~~
/opt/smhasher/smhasher/gxhash.c:244:29: error: incompatible type for argument 1 of ‘aes_encrypt_last’
  244 |     hash = aes_encrypt_last(hash, vld1q_u32(keys_3));
      |                             ^~~~
      |                             |
      |                             state {aka int8x16_t}
/opt/smhasher/smhasher/gxhash.c:217:54: note: expected ‘uint8x16_t’ but argument is of
type ‘state’ {aka ‘int8x16_t’}
  217 | static inline uint8x16_t aes_encrypt_last(uint8x16_t data, uint8x16_t keys) {
      |                                           ~~~~~~~~~~~^~~~
/opt/smhasher/smhasher/gxhash.c:244:35: error: incompatible type for argument 2 of ‘aes_encrypt_last’
  244 |     hash = aes_encrypt_last(hash, vld1q_u32(keys_3));
      |                                   ^~~~~~~~~~~~~~~~~
      |                                   |
      |                                   uint32x4_t
/opt/smhasher/smhasher/gxhash.c:217:71: note: expected ‘uint8x16_t’ but argument is of
type ‘uint32x4_t’
  217 | static inline uint8x16_t aes_encrypt_last(uint8x16_t data, uint8x16_t keys) {
      |                                                            ~~~~~~~~~~~^~~~
[ 76%] Building C object CMakeFiles/SMHasherSupport.dir/sha3.c.o
make[2]: *** [CMakeFiles/SMHasherSupport.dir/build.make:692: CMakeFiles/SMHasherSupport.dir/gxhash.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 78%] Building CXX object CMakeFiles/SMHasherSupport.dir/vmac.cpp.o
[ 79%] Building C object CMakeFiles/SMHasherSupport.dir/rijndael-alg-fst.c.o
make[1]: *** [CMakeFiles/Makefile2:86: CMakeFiles/SMHasherSupport.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
cp: cannot stat 'SMHasher': No such file or directory

For riscv64 it fails at (after removing -march=native which isn't supported):

[ 76%] Building CXX object CMakeFiles/SMHasherSupport.dir/PMP_Multilinear_64.cpp.o
[ 77%] Building CXX object CMakeFiles/SMHasherSupport.dir/PMP_Multilinear_test.cpp.o
[ 78%] Building CXX object CMakeFiles/SMHasherSupport.dir/vmac.cpp.o
In file included from /opt/smhasher/smhasher/PMP_Multilinear.cpp:36:
/opt/smhasher/smhasher/PMP_Multilinear_common.h:157:10: fatal error: emmintrin.h: No sy  157 | #include <emmintrin.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/SMHasherSupport.dir/build.make:905: CMakeFiles/SMHasherSuppor1make[2]: *** Waiting for unfinished jobs....
[ 80%] Building C object CMakeFiles/SMHasherSupport.dir/rijndael-alg-fst.c.o
[ 81%] Building C object CMakeFiles/SMHasherSupport.dir/blake3/blake3.c.o
In file included from /opt/smhasher/smhasher/PMP_Multilinear_64.cpp:36:
/opt/smhasher/smhasher/PMP_Multilinear_common.h:157:10: fatal error: emmintrin.h: No sy  157 | #include <emmintrin.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/SMHasherSupport.dir/build.make:919: CMakeFiles/SMHasherSuppor1In file included from /opt/smhasher/smhasher/PMP_Multilinear_test.cpp:37:
/opt/smhasher/smhasher/PMP_Multilinear_common.h:157:10: fatal error: emmintrin.h: No sy  157 | #include <emmintrin.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/SMHasherSupport.dir/build.make:933: CMakeFiles/SMHasherSuppor1make[1]: *** [CMakeFiles/Makefile2:91: CMakeFiles/SMHasherSupport.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
cp: cannot stat 'SMHasher': No such file or directory

I removed the following:

#if !(defined __arm__ || defined __aarch64__)
#define PMPML_USE_SSE // makes sense for x86 processors only with SSE
#ifdef PMPML_USE_SSE
#define PMPML_USE_SSE_SIZE 128 // 128 or 256
#if PMPML_USE_SSE_SIZE == 128
#include <emmintrin.h>
#elif PMPML_USE_SSE_SIZE == 256
#include <immintrin.h>
#endif // PMPML_USE_SSE_SIZE
#endif // PMPML_USE_SSE

However it still fails building with many rows like these:

[ 98%] Building CXX object CMakeFiles/SMHasher.dir/main.cpp.o
[100%] Linking CXX executable SMHasher
In function ‘mul32x32to64addto96’,
    inlined from ‘hash_of_string_chunk_compact’ at /opt/smhasher/smhasher/PMP_Multilinear.h:984:3,
    inlined from ‘_hash_noRecursionNoInline_type2.constprop’ at /opt/smhasher/smhasher/PMP_Multilinear.h:1774:53:
/opt/smhasher/smhasher/PMP_Multilinear.h:262:1: error: unknown register name ‘edx’ in
asm’
  262 | __asm__( "mull %5\n"
      | ^
In function ‘mul32x32to64addto96’,
    inlined from ‘hash_of_string_chunk_compact’ at /opt/smhasher/smhasher/PMP_Multilinear.h:985:3,
    inlined from ‘_hash_noRecursionNoInline_type2.constprop’ at /opt/smhasher/smhasher/PMP_Multilinear.h:1774:53:
/opt/smhasher/smhasher/PMP_Multilinear.h:262:1: error: unknown register name ‘edx’ in
asm’
  262 | __asm__( "mull %5\n"
      | ^
In function ‘mul32x32to64addto96’,
    inlined from ‘hash_of_string_chunk_compact’ at /opt/smhasher/smhasher/PMP_Multilinear.h:986:3,
    inlined from ‘_hash_noRecursionNoInline_type2.constprop’ at /opt/smhasher/smhasher/PMP_Multilinear.h:1774:53:
/opt/smhasher/smhasher/PMP_Multilinear.h:262:1: error: unknown register name ‘edx’ in
asm’
  262 | __asm__( "mull %5\n"
      | ^

Using gcc 14.2.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions