nnn: "illegal hardware instruction" on macOS compiled nnn when invoking any plugin
Environment details (Put x in the checkbox along with the information)
[x] Operating System: macOS Catalina 10.15.7
[ ] Desktop Environment:
[x] Terminal Emulator: iTerm2 (also occurs on Terminal)
[x] Shell: zsh 5.7.1 (also occurs on bash 5.0.18)
[ ] Custom desktop opener (if applicable):
[ ] Program options used:
[x] Configuration options set: NNN_PLUG='i:ipinfo' NNN_FIFO='/tmp/nnn.fifo'
[x] Issue exists on nnn master
Exact steps to reproduce the issue
- Compile nnn with or without flags.
- Install plugins to
~/.config/nnn/plugins - Enable any plugin with
NNN_PLUG. - Start nnn
- Invoke any plugin
- nnn crashes, leaving the line:
zsh: illegal hardware instruction ./nnn
This does not occur when installing nnn via homebrew. I initially discovered the issue when compiling with O_NERD=1 for the icons, but it occurs without any flags set as well.
Debug output:
$ cat /tmp/nnndbg
ln 7686: VERSION=3.5
ln 7714: home=/Users/p
ln 7445: cfgpath=/Users/p/.config
ln 7451: cfgpath=/Users/p/.config/nnn
ln 7477: selpath=/Users/p/.config/nnn/.selection
ln 7721: opener=/usr/bin/open
ln 7802: getenv(envs[ENV_VISUAL])=(null)
ln 7803: getenv(envs[ENV_EDITOR])=nvim
ln 7804: editor=nvim
ln 7808: pager=less
ln 7812: shell=/bin/zsh
ln 7814: getenv("PWD")=/Users/p/Code/nnn
ln 1712: COLORS=256
ln 1713: COLOR_PAIRS=32767
ln 4972: __FUNCTION__=dentfill
ln 5209: ts2.tv_nsec - ts1.tv_nsec=237000
ln 5712: __FUNCTION__=redraw
ln 5727: path=/Users/p/Code/nnn
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 51 (34 by maintainers)
And running the tests.
No, thank you so much for reporting the issue!
The issue is fixed in master now, thank you!
For later reference, found a similar defect here.
The following patch should work for you:
Sorry, I guess I am sleepy. Ignore the above comment. Let’s try the next version.
Can repro with
-O3and-O2.-O1works fine. As does-Os -march=native, which is what I would personally choose. Homebrew strips-O3and replaces it with something to that effect, except with an explicit arch, e.g.nehalam. The cc shim that does that can be found at/usr/local/Homebrew/Library/Homebrew/shims/mac/super/cc(shims for other compilers and stuff can be found in the same folder). That’s why the Homebrew build works.Aside: You can find the actual compiler invocation at
~/Library/Logs/Homebrew/nnn/01.make.ccif you install from source with brew:brew install -s nnn. It would look likeEnd of aside.
Not sure why even
-O2generates wrong code. Let me know if you want to chase this further, but I probably don’t have time for that until the weekend.