Opened 10 years ago

Closed 5 years ago

#45343 closed defect (fixed)

LuaJIT @2.0.3 distribution broken by MacPorts: "Segmentation fault: 11"

Reported by: macports.jgonggrijp@… Owned by: stromnov (Andrey Stromnov)
Priority: Normal Milestone:
Component: ports Version: 2.3.1
Keywords: lion mountainlion mavericks Cc:
Port: luajit

Description

OS X 10.9.5, Xcode 6.0.1

While trying to run my project Euler solutions (that I wrote in Lua), I found that MacPorts-installed LuaJIT 2.0.3 crashes on nearly all scripts with "Segmentation fault: 11". Only two, extremely trivial scripts run as expected. I will attach two example scripts: 052.lua (project Euler spoiler alert), which crashes, and loops.lua, which doesn't.

I have verified that the fault is with MacPorts by downloading LuaJIT 2.0.3 directly from luajit.org and running the plain vanilla installation with make && make install. The resulting executable (installed under /usr/local/bin) runs all scripts perfectly fine.

Uninstalling, cleaning and reinstalling the port does not help. The problem persists.

The LuaJIT installation page contains some instructions for distribution maintainer (see bottom of http://luajit.org/install.html), which seem to indicate that the software can be easily broken by changing too much about the installation procedure.

Attachments (2)

052.lua (1.0 KB) - added by macports.jgonggrijp@… 10 years ago.
example of a script on which luajit crashes with segmentation fault 11
loops.lua (190 bytes) - added by macports.jgonggrijp@… 10 years ago.
example of a script on which luajit does not crash

Download all attachments as: .zip

Change History (7)

Changed 10 years ago by macports.jgonggrijp@…

Attachment: 052.lua added

example of a script on which luajit crashes with segmentation fault 11

Changed 10 years ago by macports.jgonggrijp@…

Attachment: loops.lua added

example of a script on which luajit does not crash

comment:1 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

I can confirm that 052.lua crashes for me too.

But I'm not sure what we should do. We're not doing anything strange in the luajit portfile that I can see. I looked over the aforementioned Admonishments for Distribution Maintainers and I don't think we're violating any of those directives. We are making the amalg target; we aren't patching Makefiles or luaconf.h.

On my system the crash log shows the crash is in libunwind.dylib, in libunwind::CompactUnwinder_x86_64. That's a bit weird.

comment:2 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

Owner: changed from macports-tickets@… to stromnov
Status: newassigned

I tried the attached 052.lua script with luajit @2.0.5 on some different OS versions:

  • ✅ works on Mac OS X 10.6.8, Xcode 3.2.6, gcc 4.2.1
  • 💣 crashes on Mac OS X 10.7.5, Xcode 4.6.3, clang-425.0.28
  • 💣 crashes on OS X 10.8.5, Xcode 5.1.1, clang-503.0.40
  • 💣 crashes on OS X 10.9.5, Xcode 6.2, clang-600.0.57
  • ✅ works on OS X 10.10.5, Xcode 7.2.1, clang-700.1.81
  • ✅ works on OS X 10.11.6, Xcode 8.2.1, clang-800.0.42.1
  • ✅ works on macOS 10.12.6, Xcode 9.2, clang-900.0.39.2
  • ✅ works on macOS 10.13.6, Xcode 9.4.1, clang-902.0.39.2

This makes me think maybe the following should be added to the portfile:

PortGroup compiler_blacklist_versions 1.0
compiler.blacklist-append {clang < 700}

I can test this next and see if it helps.

comment:3 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: assignedclosed

In f3c476e954e258ed5938447db9669321aa894871/macports-ports (master):

luajit: Blacklist clang < 700

Fixes runtime crash on Mac OS X 10.7, 10.8, 10.9.

Closes: #45343

comment:4 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: lion mountainlion mavericks added
Resolution: fixed
Status: closedreopened

I should've tested on more systems before committing. I only tested on 10.9; since that's a libc++ system MacPorts picked the macports-clang-5.0 compiler which compiles working luajit code. But on 10.8, which is a libstdc++ system, MacPorts picked the older macports-clang-3.4, which still miscompiles luajit.

comment:5 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: reopenedclosed

In 27b5cf42f99e0639a910756d62456d7cc2733d3f/macports-ports (master):

luajit: Blacklist MacPorts clang 3.3 and 3.4

Fixes runtime crash on Mac OS X 10.7 and 10.8.

Closes: #45343

Note: See TracTickets for help on using tickets.