Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save KlausEverWalkingDev/87441f9602ceb8d3f8b78853a196f506 to your computer and use it in GitHub Desktop.
Save KlausEverWalkingDev/87441f9602ceb8d3f8b78853a196f506 to your computer and use it in GitHub Desktop.
This script automates the installation of the Intel SDE, to fix compatibility issues with older CPU's that do not support the AVX2 instruction set. It fixes the "Illegal hardware instruction" error.
#!/bin/bash
# Solution provided by https://github.com/renhiyama
# (https://github.com/Jarred-Sumner/bun/issues/282#issuecomment-1177154684)
# License agreement
echo "The Intel Software Development Emulator is distributed under the Intel Software License Agreement, available at https://www.intel.com/content/dam/develop/external/us/en/documents/pdf/intel-simplified-software-license-version-august-2021.pdf"
echo ""
echo "If you do not accept the terms of the license agreement, you have 10 seconds to stop this script (Ctrl+C)"
sleep 10
# Create directories
[ ! -d /tmp/bun-sde-fix ] && mkdir /tmp/bun-sde-fix
[ ! -d ~/.sde ] && mkdir ~/.sde
echo "Downloading SDE package" && \
curl -sS https://downloadmirror.intel.com/732268/sde-external-9.7.0-2022-05-09-lin.tar.xz -o /tmp/bun-sde-fix/sde-package.tar.xz && \
echo "Extracting into ~/.sde" && \
tar -xf /tmp/bun-sde-fix/sde-package.tar.xz --strip-components=1 -C ~/.sde
# Check architecture type the create aliases
if [ `getconf LONG_BIT` = "64" ]
then
[ -f ~/.bashrc ] && echo '[ -d ~/.sde ] && alias bun="~/.sde/sde64 -chip-check-disable -- bun"' >> ~/.bashrc
[ -f ~/.zshrc ] && echo '[ -d ~/.sde ] && alias bun="~/.sde/sde64 -chip-check-disable -- bun"' >> ~/.zshrc
else
[ -f ~/.bashrc ] && echo '[ -d ~/.sde ] && alias bun="~/.sde/sde -chip-check-disable -- bun"' >> ~/.bashrc
[ -f ~/.zshrc ] && echo '[ -d ~/.sde ] && alias bun="~/.sde/sde -chip-check-disable -- bun"' >> ~/.zshrc
fi
echo "The default supported shells are bash and zsh."
echo 'For other shells, add this to the bashrc file.
[ -d ~/.sde ] && alias bun="~/.sde/sde -chip-check-disable -- bun" for 32-bit archs or
[ -d ~/.sde ] && alias bun="~/.sde/sde64 -chip-check-disable -- bun" for 64-bit archs'
echo 'run "getconf LONG_BIT" to get your architecture type'
echo "When the issue is fixed, remove ~/.sde."
rm -rf /tmp/bun-sde-fix
echo "Done, thank you."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment