Skip to content

Cannot build with LuaJIT #4

@sewbacca

Description

@sewbacca

I get compilation failures compiling for LuaJIT on MinGW and possibly every other plattform, since there are headers missing for libc functions:

$ luarocks make --lua-version=5.1

luachild scm-1 depends on lua >= 5.1 (5.1-1 provided by VM: success)
luarocks-build-hook: running hook
gcc -O2 -fPIC -c -o luachild_common.o -IC:/msys64/ucrt64/include/luajit-2.1 luachild_common.c -DUSE_WINDOWS -I./
gcc -O2 -fPIC -c -o luachild_lua_5_3.o -IC:/msys64/ucrt64/include/luajit-2.1 luachild_lua_5_3.c -DUSE_WINDOWS -I./
gcc -O2 -fPIC -c -o luachild_luajit_2_1.o -IC:/msys64/ucrt64/include/luajit-2.1 luachild_luajit_2_1.c -DUSE_WINDOWS -I./
luachild_luajit_2_1.c: In function 'file_handler_creator':
luachild_luajit_2_1.c:37:24: error: implicit declaration of function 'strdup' [-Wimplicit-function-declaration]
   37 |       temp_file_path = strdup(getenv(file_path));
      |                        ^~~~~~
luachild_luajit_2_1.c:37:24: warning: incompatible implicit declaration of built-in function 'strdup' [-Wbuiltin-declaration-mismatch]
luachild_luajit_2_1.c:37:31: error: implicit declaration of function 'getenv' [-Wimplicit-function-declaration]
   37 |       temp_file_path = strdup(getenv(file_path));
      |                               ^~~~~~
luachild_luajit_2_1.c:10:1: note: 'getenv' is defined in header '<stdlib.h>'; this is probably fixable by adding '#include <stdlib.h>'
    9 | #include "lauxlib.h"
  +++ |+#include <stdlib.h>
   10 |
luachild_luajit_2_1.c:37:31: error: passing argument 1 of 'strdup' makes pointer from integer without a cast [-Wint-conversion]
   37 |       temp_file_path = strdup(getenv(file_path));
      |                               ^~~~~~~~~~~~~~~~~
      |                               |
      |                               int
luachild_luajit_2_1.c:37:31: note: expected 'const char *' but argument is of type 'int'
luachild_luajit_2_1.c:39:24: warning: incompatible implicit declaration of built-in function 'strdup' [-Wbuiltin-declaration-mismatch]
   39 |       temp_file_path = strdup(file_path);
      |                        ^~~~~~

Error: Build error: Failed compiling object luachild_luajit_2_1.o

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions