openresty / luajit2

OpenResty's Branch of LuaJIT 2
https://luajit.org/luajit.html
Other
1.2k stars 193 forks source link

s390x - attempt to call global 'require' (a nil value) #140

Open kozross opened 2 years ago

kozross commented 2 years ago

Issue

This issue occurs on Alpine (specifically, in a Docker container). When I try to run a file foo.lua with the following code in it:

local ffi = require('ffi')

ffi.cdef[[
typedef struct {
  size_t total_size;
  size_t off;
  size_t len;
  uint8_t * src;
  uint8_t byte;
} count_eq_data;
]]

I get an error message like so:

/usr/bin/luajit: foo.lua:1: attempt to call global 'require' (a nil value)

How to reproduce

You will need Docker available, and the daemon running.

  1. Run docker run --privileged multiarch/qemu-user-static --reset -p yes
  2. Run docker run --rm -i -t s390x/alpine:latest to start a shell in the emulated Alpine container.
  3. Run apk update followed by apk add luajit.
  4. Put the contents of the above Lua code into a file foo.lua.
  5. Attempt luajit foo.lua,
  6. Enjoy the error.

Expected behaviour

The script should execute (doing nothing), and return a success status code.