Illegal instruction crash on import
When attempting to import hyperscan (0.7.7) on my machine that has an Intel Xeon E5-2690 CPU, it crashes my Python (3.12) interpreter with an illegal instruction error.
I understand that my cpu doesn't support avx2, which is required, but I don't think it should crash on import.
Was able to reproduce this issue on the latest 0.7.13 (0.7.16) wheel published on Github. To reproduce:
- Install Ubuntu 24.04 in a VM
- Disable AVX instructions in grub by adding
noxsaveto the kernel bootargs. For example, add the following to /etc/default/grub:GRUB_CMDLINE_LINUX_DEFAULT="quiet splash noxsave" - Update grub/cmdline args for kernel:
sudo apt update-grub - Reboot
- Install hyperscan 0.7.13
import hyperscan:
(venv312) user@user-VM2404:~/Downloads$ python
Python 3.12.3 (main, Jun 18 2025, 17:59:45) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import hyperscan
Illegal instruction (core dumped)
Following up on this again, it should be solvable by simply adding -DSIMDE_BACKEND=ON to your list of passed cmake args here
This should enable the SIMDe (SIMD everywhere) option, as mentioned in Vectorscan's configuration documentation
Since this project comes with a statically linked version of Vectorscan (a huge plus!), this change seems necessary to support the "most" platforms out there, even if it comes at a marginal cost to performance