title: LuaJIT undefined references
body: <p>I'm trying to compile and link the following C program against <code>liblluajit-5.1</code> (I have LuaJIT version <code>2.0.5</code> installed on Linux):</p>
  <pre><code>#include &quot;lua.h&quot;
  #include &quot;lauxlib.h&quot;
  #include &quot;lualib.h&quot;
  
  int main(int argc, char **argv)
  {
    int status;
  
    lua_State *L = luaL_newstate();
    luaL_openlibs(L);
  
    lua_getglobal(L, &quot;require&quot;);
    lua_pushliteral(L, &quot;mod&quot;);
  
    lua_pcall(L, 1, 0, 0);
  
    // ...
  
    return 0;
  }
  </code></pre>
  <p>This fails because of undefined references to <code>lua_getglobal</code> and <code>lua_pcallk</code>. Why? Does LuaJIT only implement a subset of the C API and I have to additionally link against <code>liblua</code>?</p>
  <p>I'm compiling and linking with:</p>
  <pre><code>gcc -Wl,-E -o prog prog.c -lluajit-5.1 -lm -ldl
  </code></pre>