Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failure to build on arm #253

Open
brettowe opened this issue Jan 12, 2023 · 7 comments
Open

failure to build on arm #253

brettowe opened this issue Jan 12, 2023 · 7 comments

Comments

@brettowe
Copy link

while attempting to build this I get the below linking error:

[ 98%] Linking CXX executable SMHasher
/usr/bin/ld: /tmp/SMHasher.NXV2q9.ltrans0.ltrans.o: in function t1ha0_ia32aes_noavx_test(void const*, int, unsigned int, void*)': <artificial>:(.text+0x8518): undefined reference to t1ha0_ia32aes_noavx'
/usr/bin/ld: SMHasher: hidden symbol `t1ha0_ia32aes_noavx' isn't defined
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/SMHasher.dir/build.make:104: SMHasher] Error 1
make[2]: Leaving directory '/root/smhasher/build'
make[1]: *** [CMakeFiles/Makefile2:125: CMakeFiles/SMHasher.dir/all] Error 2
make[1]: Leaving directory '/root/smhasher/build'
make: *** [Makefile:160: all] Error 2
make: Leaving directory '/root/smhasher/build'

device is a odroid hc4
cat /proc/cpuinfo
processor : 0
BogoMIPS : 48.00
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x1
CPU part : 0xd05
CPU revision : 0

@jonesmz
Copy link

jonesmz commented Oct 15, 2023

I can reproduce this problem with this command

git clone https://github.com/rurban/smhasher.git --recursive ; cmake -S smhasher/ -B build-smhasher/ ; cmake --build build-smhasher

which was commit 0f6bf14 at the time

this gives:

lto-wrapper: warning: using serial compilation of 19 LTRANS jobs
/usr/bin/ld: /tmp/cckw8fLj.ltrans0.ltrans.o: in function `t1ha0_ia32aes_noavx_test(void const*, int, unsigned int, void*)':
<artificial>:(.text+0x8648): undefined reference to `t1ha0_ia32aes_noavx'
/usr/bin/ld: SMHasher: hidden symbol `t1ha0_ia32aes_noavx' isn't defined
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/SMHasher.dir/build.make:98: SMHasher] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:112: CMakeFiles/SMHasher.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2

lsb_release

No LSB modules are available.
Distributor ID:Ubuntu
Description:	Ubuntu 22.04.3 LTS
Release:	22.04
Codename:	jammy

gcc --version

gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0

lscpu

Architecture:           aarch64
  CPU op-mode(s):       32-bit, 64-bit
  Byte Order:           Little Endian
CPU(s):                 8
  On-line CPU(s) list:  0-7
Vendor ID:              APM
  Model:                2
  Thread(s) per core:   1
  Core(s) per cluster:  8
  Socket(s):            8
  Cluster(s):           1
  Stepping:             0x3
  BogoMIPS:             80.00
  Flags:                fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
NUMA:
  NUMA node(s):         1
  NUMA node0 CPU(s):    0-7
Vulnerabilities:
  Gather data sampling: Not affected
  Itlb multihit:        Not affected
  L1tf:                 Not affected
  Mds:                  Not affected
  Meltdown:             Mitigation; PTI
  Mmio stale data:      Not affected
  Retbleed:             Not affected
  Spec rstack overflow: Not affected
  Spec store bypass:    Vulnerable
  Spectre v1:           Mitigation; __user pointer sanitization
  Spectre v2:           Vulnerable
  Srbds:                Not affected
  Tsx async abort:      Not affected

uname -r

5.15.0-86-generic

@darkk
Copy link
Contributor

darkk commented Sep 28, 2024

@brettowe please, may I ask you to verify if it's still the case?

Some of aarch64-related build issues have been fixed in current master. CI cross-compiles aarch64 binary successfully & it passes self-test.

@brettowe
Copy link
Author

looks like there is still some issues.

[ 97%] Linking CXX static library libSMHasherSupport.a
[ 97%] Built target SMHasherSupport
[ 98%] Building CXX object CMakeFiles/SMHasher.dir/main.cpp.o
In file included from /home/bret/smhasher/main.cpp:2:
/home/bret/smhasher/Platform.h:10:10: warning: "NCPU" redefined
10 | # define NCPU 0
| ^~~~
: note: this is the location of the previous definition
/home/bret/smhasher/Platform.h:173:3: warning: #warning neither CLOCK_MONOTONIC nor CLOCK_MONOTONIC_RAW is defined, no nanosecond precision. [-Wcpp]
173 | # warning neither CLOCK_MONOTONIC nor CLOCK_MONOTONIC_RAW is defined, no nanosecond precision.
| ^~~~~~~
[100%] Linking CXX executable SMHasher
/usr/bin/ld: /tmp/ccXiCuo0.ltrans0.ltrans.o: in function t1ha0_ia32aes_noavx_test(void const*, int, unsigned int, void*)': <artificial>:(.text+0x9428): undefined reference to t1ha0_ia32aes_noavx'
/usr/bin/ld: SMHasher: hidden symbol `t1ha0_ia32aes_noavx' isn't defined
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/SMHasher.dir/build.make:98: SMHasher] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:112: CMakeFiles/SMHasher.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2

lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux trixie/sid
Release: n/a
Codename: trixie

gcc --version
gcc (Debian 14.2.0-1) 14.2.0

@brettowe
Copy link
Author

i also tested on opensuse tumbleweed, has the same error

gcc --version
gcc (SUSE Linux) 14.2.0

@DrYak
Copy link

DrYak commented Oct 16, 2024

Similarly here.

Culprit is that the hardware-acceleretard T1HA code is only compiled on Intel

But the hardware accelerated t1ha test is included whenever AES instructions are available

There are ARM processor nowadays which do have AES hardware acceleration (in my case, RK3399S powered PinePhone Pro).

So the function t1ha0_ia32aes_noavx_test in Hashes.cpp is built (because AES instruction are available) but the file t1ha/t1ha0_ia32aes_noavx.c is never part of the build (because no Intel CPU) and thus the function t1ha0_ia32aes_noavx is missing.

Suggested(*) fix:

$ git diff
diff --git a/Hashes.h b/Hashes.h
index d1631d7..e77968a 100644
--- a/Hashes.h
+++ b/Hashes.h
@@ -466,7 +466,7 @@ inline void mum_low_test ( const void * key, int len, uint32_t seed, void * out
 //-----------------------------------------------------------------------------
 
 #define T1HA0_RUNTIME_SELECT 0
-#ifdef HAVE_AESNI
+#if defined(HAVE_AESNI) && ((defined(__i686__) || defined(__x86_64__)))
 # define T1HA0_AESNI_AVAILABLE 1
 #else
 # define T1HA0_AESNI_AVAILABLE 0

(*): I haven't checked the actual code inside t1ha0_ia32aes_noavx.c to see if it could compile (my knowledge of intrinsics is too rusty), but just by the name of the function (IA32) I would expect it's written targeting Intel CPUs.

@DrYak
Copy link

DrYak commented Oct 16, 2024

(Note: that maybe my fix is wrong and using sse2neon and/or SIMDe it would be possible to instead get the hardware accelerated to compile on ARM. Again don't trust my (very limited) level of knowledge about intrinsic)

@rurban
Copy link
Owner

rurban commented Dec 12, 2024

i'll rather add the aes build to arm archs, if possible. as with gxhash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants