Page 1 of 1

LuaJIT

Posted: 02 Mar 2016, 11:06
by Tobias
Hello everybody,

I try to use LuaJIT on Ubuntu. I changed the "useExternalLuaLibrary" in usrset to true. V-Rep console states that it is using v_repLua but it using print(jit.version) I get an error (print(_VERSION) says I am using Lua5.1). Doing the same on windows works fine.

I already tried to compile v_repLua my self. But that didn't work. Is there some place to speficy the LuaJIT library or something else that needs to be change?

Thanks again for your help,

Tobi

Re: LuaJIT

Posted: 03 Mar 2016, 11:27
by coppelia
Hi Tobi,

It seems there is a problem with the makefile. Can you try with following instead?

Code: Select all

CFLAGS =  -Wall -fPIC -static

OS = $(shell uname -s)
ifeq ($(OS), Linux)
	CFLAGS += -D__linux
	EXT = so
	CFLAGS    += -I/pathTo/LuaJIT/src
else
	CFLAGS += -D__APPLE__
	EXT = dylib
endif

LDFLAGS   += -L.
LDLIBS    += -lluajit

all: 
	@rm -f lib/*.$(EXT)
	@rm -f *.o 
	g++ $(CFLAGS) -c v_repLua.cpp -o v_repLua.o
	@mkdir -p lib
	g++ v_repLua.o -o lib/libv_repLua.$(EXT) $(LDFLAGS) $(LDLIBS) -lpthread -ldl -shared
Cheers

Re: LuaJIT

Posted: 03 Mar 2016, 13:15
by Tobias
Hi,

at first it couldn't find the luajit.so after adding the right path to ld it compiled but V-Rep still uses lua5.1 instead of luajit.

Do you have another idea?

Thanks,
Tobi

Re: LuaJIT

Posted: 04 Mar 2016, 11:45
by coppelia
Well, it seems there is a problem on linux. The library loads correctly and binds to jit, but somehow jit.version istn't defined..

not sure right now what the problem is.

Cheers

Re: LuaJIT

Posted: 04 Mar 2016, 13:19
by Tobias
For me I am not sure if it binds to jit as I can not use e.g ffi library that should be build in jit. So I think in my case V-Rep just loads the standard lua5.1 version. As exactly the same scene / script works on windows.

Cheers,
Tobi

Re: LuaJIT

Posted: 07 Mar 2016, 09:30
by coppelia
When the console says that it is using the external lua library, then it will use libv_repLua.so. The question is, whta is libv_repLua.so using. libv_repLua.so is basically a very light wrapper that will call lua functions in a regular way. But if it is linked with Lua, it will use the regular Lua interpreter. If it is linked with luaJit, then it should use the JIT interpreter. So the problem is basically only located on libv_repLua.so side.

Cheers