Im trying to link a custom built luau into my game, I built luau with this: mkdir build && cd build cmake .. make
after that I got following files:
- libLuau.VM.a
- libLuau.Compiler.a
- libLuau.CodeGen.a
- libLuau.Ast.a
- libLuau.Analysis.a
next step has been done was:
game = another game
engine_files = src/engine.c src/error/error_handler.cpp src/renderer/opengl.cpp
imgui_files = src/renderer/ui/imgui/*.cpp
luau = -Llibs/luau/ -l:libLuau.Ast.a -l:libLuau.Analysis.a -l:libisocline.a -l:libLuau.CodeGen.a -l:libLuau.Compiler.a -l:libLuau.VM.a
build:
g++ src/scripting/luau_integration.cpp $(engine_files) -std=c++17 -Wl,-rpath -Wl,'\$\$ORIGIN' glad.c -lm -lglfw3 -lGL -lwebp -lXrandr -lXinerama -lX11 -ldl -pthread -o bin/$(game) -L./ -l:imgui.so $(luau)
export LD_LIBRARY_PATH=./ && cd bin && ./confidental name removed
luau_integration.hpp:
/* You are granted license to view these files, modify them, study them they are not under cc by sa though*/
namespace Scripting{
class Lua{
public:
static void Integrate();
};
}
lua_integration.cpp
// public domain
// This loads game scripts
#include "../../libs/luau/include/Compiler.h"
#include "../../libs/luau/include/BytecodeBuilder.h"
#include "../../libs/luau/include/StringUtils.h"
#include "luau_integration.hpp"
#include "../../libs/luau/include/lua.h"
#include "../../libs/luau/include/luacode.h"
#include "../../libs/luau/include/lualib.h"
#include "../../libs/luau/include/StringUtils.h"
#include "../../libs/luau/include/BytecodeBuilder.h"
struct lua_CompileOptions options;
void Scripting::Lua::Integrate () {
size_t binarySize;
luau_compile("print(\"e\")", 11, &options, &binarySize);
}
luau files has been modified due directory difference,
Issue:
/usr/bin/ld: /tmp/cc8XT3MW.o: in function `Scripting::Lua::Integrate()':
luau_integration.cpp:(.text+0x23): undefined reference to `luau_compile(char const*, unsigned long, lua_CompileOptions*, unsigned long*)'
Linker spits out this error no matter what I have tried, I can't find anything about installation prodecure of luau but im guessing it is similar to lua considering lack of documentation in the project everything is being done by trial and error and reading obscure comments in luau's source code.
What have I done possibly wrong?
Also please note that files are in the correct location.