Subject: Can't start neovim

From: Samarul Meu <[email-masked]>
Date: Fri, 27 May 2022 07:42:10 +0300

I am on Alpine 3.16 (upgraded on Wednesday) and yesterday I installed
neovim. When I try to launch it I only get this `Illegal instruction`

Some more information

$ uname -a
Linux alpine.cfd 5.15.41-0-lts #1-Alpine SMP Fri, 20 May 2022 21:42:55
+0000 x86_64 GNU/Linux

$ nvim -v
NVIM v0.7.0
Illegal instruction

$ cat /etc/apk/repositories
http://ftp.halifax.rwth-aachen.de/alpine/latest-stable/main
http://ftp.halifax.rwth-aachen.de/alpine/latest-stable/community
@edge http://ftp.halifax.rwth-aachen.de/alpine/edge/main
@edge http://ftp.halifax.rwth-aachen.de/alpine/edge/community
@testing http://ftp.halifax.rwth-aachen.de/alpine/edge/testing

$ doas dmesg | grep nvim
[  818.148617] traps: nvim[3261] trap invalid opcode ip:7f61f0d819d3
sp:7fffaad810e0 error:0 in libluajit-5.1.so.2.1.0[7f61f0d6f000+4c000]
[ 1081.218916] traps: nvim[3461] trap invalid opcode ip:7f8742fa79d3
sp:7fffcecf42c0 error:0 in libluajit-5.1.so.2.1.0[7f8742f95000+4c000]
[ 1160.212726] traps: nvim[3522] trap invalid opcode ip:7f65de9b29d3
sp:7fff3de8ed60 error:0 in libluajit-5.1.so.2.1.0[7f65de9a0000+4c000]
[ 1163.965717] traps: nvim[3527] trap invalid opcode ip:7f67763929d3
sp:7ffcc468ead0 error:0 in libluajit-5.1.so.2.1.0[7f6776380000+4c000]

Thanks for your help!

---

From: "alice" <[email-masked]>
Date: Fri, 27 May 2022 08:16:34 +0200

> Linux alpine.cfd 5.15.41-0-lts #1-Alpine SMP Fri, 20 May 2022 21:42:55
this is probably because the luajit apkbuild has -msse4.2 for x86_64.
there is already an issue for it[0], not sure i remember why it was set
that way (aside from being recommended).

you can see by crashing it in gdb:  

gdb nvim
run
(see it crash)
x/3i $pc (last 3 instructions)

(last instructions will have names, look up the one marked with >,
probably an sse4/3 one)

> @testing http://ftp.halifax.rwth-aachen.de/alpine/edge/testing
(as an aside, you should not mix edge with stable)

> sp:7ffcc468ead0 error:0 in libluajit-5.1.so.2.1.0[7f6776380000+4c000]

[0]: https://gitlab.alpinelinux.org/alpine/aports/-/issues/13688

---

From: Samarul Meu <[email-masked]>
Date: Fri, 27 May 2022 09:53:48 +0300

> that way (aside from being recommended).
This means I will not be able to run nvim on my machine?

> (last instructions will have names, look up the one marked with >,
This is all I get from debugging
Thread 1 "nvim" received signal SIGILL, Illegal instruction.
0x00007ffff7e549d3 in ?? () from /usr/lib/libluajit-5.1.so.2

> (as an aside, you should not mix edge with stable)
I know I should not do it, but there a lot of packages I need I cannot
find in stable.

---

From: "alice" <[email-masked]>
Date: Fri, 27 May 2022 09:33:45 +0200

> This means I will not be able to run nvim on my machine?
probably, post in the issue and see if perhaps jirutka feels like
changing it

---

From: "Winston Weinert" <[email-masked]>
Date: Fri, 27 May 2022 09:23:41 -0500

This was a problem with openttd as well. Same exact issue. I'm wondering if there's impact beyond these two packages? Any way to audit releases to verify correct cpu features are targeted? It seems like an easy pitfall for packagers. 

-- 
  Winston Weinert
  [email-masked]
  https://winny.tech/

---

From: Roger <[email-masked]>
Date: Fri, 27 May 2022 11:52:27 -0400

Quite funny and odd neovim would pull in SSE2 (...) opts!

From my recent experience with a recent laptop (Dell Inspiron 8100) laptop 
install of Alpine 3.15.4, everything seems to be compiled just fine for 
non-SSE2 CPUs.

Sounds like SSE2 CPU opts are now creeping into Alpine Linux 3.16, like so many 
other packages.  (From reading many forum posts for the past years, seems some 
are having fun with this issue, anything to cause a problem for others!)

I started a forum thread on Linux Questions recently, due to the amount of 
Linux distributions stating support for older CPUs.

Distributions Falsely Advertising <= i686/Pentium3 support, or CPUs without SSE2!
https://www.linuxquestions.org/questions/slackware-14/distributions-falsely-advertising-=-i686-pentium3-support-or-cpus-without-sse2-4175712442/

At the time of the posting, I was agnostically suggesting other Linux 
distributions.  I've been monitoring CPU SSE2 opt (eg. CFLAG, CXXFLAGS, ...) 
inclusion for the recent few years now, as I have two well maintained x86 
Pentium 3 non-SSE2 platforms.

Roger

> On Fri, May 27, 2022 at 08:16:34AM +0200, alice wrote:

---

From: "alice" <[email-masked]>
Date: Fri, 27 May 2022 18:28:54 +0200

> Pentium 3 non-SSE2 platforms.

this isn't related to sse2 on x86 though, it's related to sse4.2 on
x86_64, which is quite different (and what luajit is pulling in in this
case. for all i know, the x86 version also wants sse2, but this i didn't
check)

also, even x86 will now officially be sse2[0] (the target will be
-march=pentium4), so we won't be advertising any non-sse support, so
your recommendations of other distros will remain valid :)

[0]: https://gitlab.alpinelinux.org/alpine/tsc/-/issues/35