LuaJIT

Typically: "How do I... ", "How can I... " questions
Post Reply
Tobias
Posts: 21
Joined: 08 Jan 2016, 14:35

LuaJIT

Post by Tobias » 02 Mar 2016, 11:06

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

coppelia
Site Admin
Posts: 7324
Joined: 14 Dec 2012, 00:25

Re: LuaJIT

Post by coppelia » 03 Mar 2016, 11:27

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

Tobias
Posts: 21
Joined: 08 Jan 2016, 14:35

Re: LuaJIT

Post by Tobias » 03 Mar 2016, 13:15

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

coppelia
Site Admin
Posts: 7324
Joined: 14 Dec 2012, 00:25

Re: LuaJIT

Post by coppelia » 04 Mar 2016, 11:45

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

Tobias
Posts: 21
Joined: 08 Jan 2016, 14:35

Re: LuaJIT

Post by Tobias » 04 Mar 2016, 13:19

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

coppelia
Site Admin
Posts: 7324
Joined: 14 Dec 2012, 00:25

Re: LuaJIT

Post by coppelia » 07 Mar 2016, 09:30

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

Post Reply