Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ Lua
➜ Best way to install Lua in Smaugfuss 1.9?
Best way to install Lua in Smaugfuss 1.9?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Lerkista
(57 posts) Bio
|
Date
| Fri 19 Sep 2014 06:01 AM (UTC) |
Message
| Hi, i've downloaded this file: http://www.gammon.com.au/files/smaug/smaug17fuss_lua_v2.tgz
It's for 1.7, so what do i need to do to make it work in 1.9??
Maybe just to copy lua_* files in src and the lua dir to my 1.9 source and try to compile it?? and after put all the call_lua calls in all other functions??
Any who already make it work in 1.9 have any experience to share??
Thankx | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Fri 19 Sep 2014 06:41 AM (UTC) |
Message
| I don't know the answer directly, but if I were attempting this I would first copy all the "new" files (eg. the .lua ones), as clearly they won't be in the Smaug distribution.
Then do a "diff" of the 1.7 version of Smaug to the one in that .tgz file. That would show you what changes I made. With luck they can be applied back into 1.9, possibly even using "patch". |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Lerkista
(57 posts) Bio
|
Date
| Reply #2 on Sun 21 Sep 2014 02:55 AM (UTC) |
Message
| I get this errors:
make -s smaug
o/lua_scripting.o: In function `optboolean':
/home/lerkista/Mud/lua-smaugfuss/src/lua_scripting.c:72: undefined reference to `lua_gettop(lua_State*)'
/home/lerkista/Mud/lua-smaugfuss/src/lua_scripting.c:76: undefined reference to `lua_type(lua_State*, int)'
/home/lerkista/Mud/lua-smaugfuss/src/lua_scripting.c:79: undefined reference to `lua_type(lua_State*, int)'
/home/lerkista/Mud/lua-smaugfuss/src/lua_scripting.c:80: undefined reference to `lua_toboolean(lua_State*, int)'
/home/lerkista/Mud/lua-smaugfuss/src/lua_scripting.c:82: undefined reference to `luaL_checkinteger(lua_State*, int)'
o/lua_scripting.o: In function `check_vnum':
/home/lerkista/Mud/lua-smaugfuss/src/lua_scripting.c:88: undefined reference to `luaL_checkinteger(lua_State*, int)'
/home/lerkista/Mud/lua-smaugfuss/src/lua_scripting.c:90: undefined reference to `luaL_error(lua_State*, char const*, ...)'
o/lua_scripting.o: In function `make_char_ud':
/home/lerkista/Mud/lua-smaugfuss/src/lua_scripting.c:99: undefined reference to `luaL_error(lua_State*, char const*, ...)'
/home/lerkista/Mud/lua-smaugfuss/src/lua_scripting.c:101: undefined reference to `lua_pushlightuserdata(lua_State*, void*)'
/home/lerkista/Mud/lua-smaugfuss/src/lua_scripting.c:102: undefined reference to `lua_getfield(lua_State*, int, char const*)'
/home/lerkista/Mud/lua-smaugfuss/src/lua_scripting.c:103: undefined reference to `lua_setmetatable(lua_State*, int)'
...
....
and the error list goes big
Any ideas to fix that?? | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Sun 21 Sep 2014 06:14 AM (UTC) |
Message
| Looks like a linking error to me, so perhaps you didn't add:
to the linker options. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Lerkista
(57 posts) Bio
|
Date
| Reply #4 on Sun 21 Sep 2014 09:25 AM (UTC) Amended on Sun 21 Sep 2014 08:32 PM (UTC) by Nick Gammon
|
Message
| I use a free shell to run the mud, and it seems they don't have lua installed, so i tried to install myself in my account, it installs fine and everything in ~/usr dir, but i can't make it work with make, so i copy the lib to the mud src and change Makefile with this:
L_FLAGS = $(PROF) $(SOLARIS_LINK) -lz $(NEED_DL) liblua.a -lm
Don't know if this is the problem
EDIT: in fact i unpack smaug1.7 with lua and it compiles fine, using liblua.a, so i copy the lua_* files to my smaug1.9 and just add lua.bits to the Makefile to test, i got this error:
lua_bits.c: In function 'int bit_tonumber(lua_State*)':
lua_bits.c:65: error: invalid conversion from 'const char*' to 'const unsigned char*'
make[1]: *** [o/lua_bits.o] Error 1
so i change this:
// get text to convert
const unsigned char * text = luaL_checkstring (L, 1);
const unsigned char * p;
to this:
// get text to convert
const char * text = luaL_checkstring (L, 1);
const char * p;
And this errors appear:
o/lua_bits.o: In function `bit_bnot':
/home/lerkista/Mud/prueba/cagua/src/lua_bits.c:47: undefined reference to `luaL_checknumber(lua_State*, int)'
/home/lerkista/Mud/prueba/cagua/src/lua_bits.c:47: undefined reference to `lua_pushnumber(lua_State*, double)'
o/lua_bits.o: In function `bit_band':
/home/lerkista/Mud/prueba/cagua/src/lua_bits.c:48: undefined reference to `lua_gettop(lua_State*)'
/home/lerkista/Mud/prueba/cagua/src/lua_bits.c:48: undefined reference to `luaL_checknumber(lua_State*, int)'
/home/lerkista/Mud/prueba/cagua/src/lua_bits.c:48: undefined reference to `luaL_checknumber(lua_State*, int)'
...
Maybe is something about the compiler?? smaug1.7 uses gcc and smaug1.9 g++ | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #5 on Sun 21 Sep 2014 09:36 PM (UTC) |
Message
| It still looks like a linking error. Can you run Lua stand-alone?
Just type "lua" at the command line.
You should see something like:
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
>
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Lerkista
(57 posts) Bio
|
Date
| Reply #6 on Sun 21 Sep 2014 10:18 PM (UTC) |
Message
| Yeah, i can, in both shells i use:
Free shell (running CentOs:
lerkista ~ $ lua
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
>
Cygwin:
Mario@Mario1 ~
$ lua
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
>
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #7 on Mon 22 Sep 2014 03:04 AM (UTC) Amended on Mon 22 Sep 2014 03:06 AM (UTC) by Nick Gammon
|
Message
| Yes you were partly right there. I could reproduce your problem. The thing is that Lua used gcc and Smaug used g++.
The only way I could make it work was to recompile Lua.
You can get Lua from:
http://www.lua.org/ftp/lua-5.1.5.tar.gz
I suggest staying away from Lua 5.2 because some of the things I used may have changed in Lua 5.2.
In the lua "src" directory (not the top-level directory) change in the Makefile:
# makefile for building Lua
# see ../INSTALL for installation instructions
# see ../Makefile and luaconf.h for further customization
# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT =======================
# Your platform. See PLATS for possible values.
PLAT= none
CC= gcc
CFLAGS= -O2 -Wall $(MYCFLAGS)
AR= ar rcu
RANLIB= ranlib
RM= rm -f
LIBS= -lm $(MYLIBS)
to:
# makefile for building Lua
# see ../INSTALL for installation instructions
# see ../Makefile and luaconf.h for further customization
# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT =======================
# Your platform. See PLATS for possible values.
PLAT= none
CC= g++
CFLAGS= -O2 -Wall $(MYCFLAGS)
AR= ar rcu
RANLIB= ranlib
RM= rm -f
LIBS= -lm $(MYLIBS)
Changed line in bold. Then do a "make clean" and a "make" (I used "make posix") followed by a "sudo make install". The "make install" needs to be done at the top-level directory, not the "src" one.
Having done that, make sure that -llua is in your L_FLAGS in the Smaug Makefile, eg.
L_FLAGS = $(PROF) $(SOLARIS_LINK) -lz $(NEED_DL) -llua
Then it should link OK.
If you can't install Lua because you don't have rights, just link in the lualib.a file as part of the link step in Smaug. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Lerkista
(57 posts) Bio
|
Date
| Reply #8 on Tue 23 Sep 2014 04:40 AM (UTC) |
Message
| Hi
I tried what you said, and works, i can't make it work with -llua, but if i copy the lib and use liblua.a it compiles fine
I need some time to see if everything works fine
Thanks | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
30,611 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top