Hi. I believe patch below should fix the build. Here is why changes are made.
First, is luaL_reg. It was a macro for compatibility with Lua 5.0. It was defined in LuaJIT 2.0 headers, but removed in LuaJIT 2.1. The solution is to use luaL_Reg (note capital R), or to define the macro again. Next is removal of "luajit-2.0" substring from the include directives. LuaJIT 2.0 puts its headers into /usr/include/luajit-2.0, but since pkg-config files mention /usr/include/luajit-2.0, it's sufficient to include lua.h without additional paths. With LuaJIT 2.1 path was changed to luajit-2.1, that broke the build. diff -ur wrk-4.0.2-before/src/script.c wrk-4.0.2/src/script.c --- wrk-4.0.2-before/src/script.c 2016-10-03 03:17:03.000000000 +0300 +++ wrk-4.0.2/src/script.c 2018-03-10 00:14:53.795446821 +0300 @@ -6,6 +6,10 @@ #include "http_parser.h" #include "zmalloc.h" +#ifndef luaL_reg +#define luaL_reg luaL_Reg +#endif + typedef struct { char *name; int type; diff -ur wrk-4.0.2-before/src/script.h wrk-4.0.2/src/script.h --- wrk-4.0.2-before/src/script.h 2016-10-03 03:17:03.000000000 +0300 +++ wrk-4.0.2/src/script.h 2018-03-10 00:14:07.745818846 +0300 @@ -2,9 +2,9 @@ #define SCRIPT_H #include <stdbool.h> -#include <luajit-2.0/lua.h> -#include <luajit-2.0/lualib.h> -#include <luajit-2.0/lauxlib.h> +#include <lua.h> +#include <lualib.h> +#include <lauxlib.h> #include <unistd.h> #include "stats.h" #include "wrk.h" diff -ur wrk-4.0.2-before/src/wrk.h wrk-4.0.2/src/wrk.h --- wrk-4.0.2-before/src/wrk.h 2016-10-03 03:17:03.000000000 +0300 +++ wrk-4.0.2/src/wrk.h 2018-03-10 00:14:23.830408060 +0300 @@ -10,7 +10,7 @@ #include <openssl/ssl.h> #include <openssl/err.h> -#include <luajit-2.0/lua.h> +#include <lua.h> #include "stats.h" #include "ae.h" --- Rinat