Skip to content

Instantly share code, notes, and snippets.

@zekefeu
Last active March 8, 2024 12:16
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save zekefeu/afb29296db34d2451cdddcc14dbeef3c to your computer and use it in GitHub Desktop.
Save zekefeu/afb29296db34d2451cdddcc14dbeef3c 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
# Create aliases
[ -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
alias bun="~/.sde/sde -chip-check-disable -- bun"
echo "The default supported shells are bash and zsh."
echo 'For other shells, add [ -d ~/.sde ] && alias bun="~/.sde/sde -chip-check-disable -- bun" to the config file.'
echo "When the issue will be fixed, remove ~/.sde."
rm -rf /tmp/bun-sde-fix
echo "Done, thank you."
@renhiyama
Copy link

Imagine no credits xD
(no problem btw)

@zekefeu
Copy link
Author

zekefeu commented Jul 9, 2022

I did credit you in the messages I sent, but not here. I'll do that in a sec.

@renhiyama
Copy link

👍

@renhiyama
Copy link

Please run the alias command along with writing that in zshrc/bashrc , so theres no need to restart the shell...

@zekefeu
Copy link
Author

zekefeu commented Jul 9, 2022

Please run the alias command along with writing that in zshrc/bashrc , so theres no need to restart the shell...

done

@khromov
Copy link

khromov commented Jul 13, 2022

Had to switch from ~/.sde/sde to ~/.sde/sde64 in the alias when installing under WSL2 for some reason, without it I would get the error zsh: no such file or directory: /home/k/.sde/sde

@renhiyama
Copy link

Had to switch from ~/.sde/sde to ~/.sde/sde64 in the alias when installing under WSL2 for some reason, without it I would get the error zsh: no such file or directory: /home/k/.sde/sde

That happens because "no such file" error even includes if the binary is for 32 bit instead of 64 bit...
@fuka-g replace sde with sde64 if the CPU is 64 bit (I'm sure there's some cheap command to do that 😄 )

@zekefeu
Copy link
Author

zekefeu commented Jul 13, 2022

I'm going on break for a week or two, can you work on a fix ? If not, I'll do it when I get back.

@spidy0x0
Copy link

Had to switch from ~/.sde/sde to ~/.sde/sde64 in the alias when installing under WSL2 for some reason, without it I would get the error zsh: no such file or directory: /home/k/.sde/sde

That happens because "no such file" error even includes if the binary is for 32 bit instead of 64 bit... @fuka-g replace sde with sde64 if the CPU is 64 bit (I'm sure there's some cheap command to do that smile )

Fixed here https://gist.github.com/spidyhackx/194108a0df2b4fc8df642f126edcc0e5

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