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

Tests cannot be run on non-x86 architectures #774

Closed
bdrung opened this issue Oct 20, 2023 · 8 comments
Closed

Tests cannot be run on non-x86 architectures #774

bdrung opened this issue Oct 20, 2023 · 8 comments

Comments

@bdrung
Copy link

bdrung commented Oct 20, 2023

The Debian/Ubuntu packages runs the tests cases, but they fail on non-x86 architectures:

make[4]: Entering directory '/<<PKGBUILDDIR>>/src/test'
[ 1%] Building C object CMakeFiles/mont.dir/<<PKGBUILDDIR>>/src/mont.c.o
cc: error: unrecognized command-line option ‘-mssse3’
cc: error: unrecognized command-line option ‘-mpclmul’
cc: error: unrecognized command-line option ‘-maes’
make[4]: *** [CMakeFiles/mont.dir/build.make:76: CMakeFiles/mont.dir/<<PKGBUILDDIR>>/src/mont.c.o] Error 1

I tried to build the tests without SSE and AES disabled on ARM:

cd src/test/
export PYTHON=python3
cmake -DPYTHON=python3 -DSSE=OFF -DAESNI=OFF
make

It fails then:

[  1%] Building C object CMakeFiles/mont.dir/[...]/src/mont.c.o
cc: error: unrecognized command-line option '-mstackrealign'
make[2]: *** [CMakeFiles/mont.dir/build.make:76: CMakeFiles/mont.dir/[...]/src/mont.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:131: CMakeFiles/mont.dir/all] Error 2
make: *** [Makefile:101: all] Error 2

I disabled add_compile_options(-mstackrealign) in CMakeLists.txt and then it failed with:

[ 97%] Building C object CMakeFiles/test_aesni.dir/test_aesni.c.o
[...]/src/test/test_aesni.c:2:10: fatal error: wmmintrin.h: No such file or directory
    2 | #include <wmmintrin.h>
      |          ^~~~~~~~~~~~~

The header wmmintrin.h seems to be x86-specific.

Please support building/running the tests on non-x86 architectures.

Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1053328
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/pycryptodome/+bug/2039968

@Bl4omArchie
Copy link

Hello, indeed, AES New Instructions are specific to x86 architectures: https://en.wikipedia.org/wiki/AES_instruction_set#Supporting_x86_CPUs
It is because instructions are implemented within your processor. If your request hasn't been fulfilled, I can look at the code and fix it for your architectures.

@Legrandin
Copy link
Owner

This is fixed in master

@bdrung
Copy link
Author

bdrung commented Jan 5, 2024

Are you referring to those three commits?

@Bl4omArchie
Copy link

yes, did it solved your issue ?

@bdrung
Copy link
Author

bdrung commented Jan 5, 2024

I haven't tried yet, but I will next week.

@Legrandin
Copy link
Owner

This is fixed in v3.20.0.

@bdrung
Copy link
Author

bdrung commented Jan 11, 2024

I just uploaded pycryptodome 3.20.0+dfsg-1 to Debian unstable. In the next hours we will see if the tests succeed on non-x86:

@bdrung
Copy link
Author

bdrung commented Jan 11, 2024

pycryptodome 3.20.0+dfsg-1 builds on most architectures now. So the SSE/AES config changes work. I filed two bug reports for the remaining failures:

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

No branches or pull requests

3 participants