Re: Segmentation fault on FFI call containing OpenMP clause

  • From: Mike Pall <mike-1412@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Tue, 9 Dec 2014 21:01:11 +0100

Ciprian Tomoiaga wrote:
> I have a C function containing OpenMP clause which I call with ffi. On my
> machine, the program terminates with a segmentation fault. However, it
> works without a problem on a Mac and on another machine.

The most likely cause is the dreaded pthread issue: the main
executable must be compiled/linked with -pthread (note: this is
not the same as -lpthread!). Otherwise a shared library which is
loaded later on and uses threads may cause a crash.

The easiest way to test this hypothesis is to rebuild LuaJIT with:

  make TARGET_FLAGS=-pthread

... and then try again.

--Mike

Other related posts: