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
➜ liblua.a linking problem
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Rash
United Kingdom (56 posts) Bio
|
Date
| Thu 21 Jan 2010 02:17 AM (UTC) Amended on Thu 21 Jan 2010 02:18 AM (UTC) by Rash
|
Message
| I have lua installed on a modifed 1.4a base on my local Cygwin running machine and it works brilliantly. I'm now moving it over to my hosting provider and they have installed Lua for me to use. (Lua command outputs: Lua 5.1.3 Copyright (C) 1994-2008 Lua.org, PUC-Rio)
I have all the needed .h files (lua.h, luaconf.h, lualib.h and lauxlib.h) and liblua.a installed locally within the src folder.
All the defines for the files within the lua*.c files are set as
My makefile has this
L_FLAGS = $(OPT_FLAG) $(PROF) $(SOLARIS_LINK) $(NEED_CRYPT) liblua.a -lm
Here's the paths for the files (Remember, I have copies of these in the src also).
lauxlib.h, lua.h, luaconf.h, lualib.h are all located in /usr/local/include/
liblua.a is located in /usr/local/lib/
Now the problem is this. Upon compiling it goes all the way through to this stage and then dumps a lot of errors. Now as I recall this is a linking error and I can't for the life of me figure out what the problem is.
gcc liblua.a -lm -o dwc act_comm.o act_info.o
act_move.o act_obj.o act_wiz.o ban.o boards.o build.o
clans.o color.o comm.o comments.o const.o db.o deity.o
dwc.o editor.o fight.o grub.o handler.o hashstr.o house.o
ibuild.o ident.o imm_host.o interp.o lua_bits.o
lua_scripting.o lua_tables.o magic.o makeobjs.o mapout.o
misc.o mpxset.o mud_comm.o mud_prog.o mt19937ar.o
new_auth.o overland.o planes.o player.o polymorph.o
requests.o reset.o save.o services.o sha256.o shops.o
skills.o smithing.o special.o stat_obj.o tables.o track.o
update.o
lua_scripting.o: In function `L_find_room':
/home/talairina/src/lua_scripting.c:137: undefined reference to `lua_isnumber'
/home/talairina/src/lua_scripting.c:139: undefined reference to `luaL_checknumber'
/home/talairina/src/lua_scripting.c:141: undefined reference to `luaL_error'
lua_scripting.o: In function `L_find_character':
/home/talairina/src/lua_scripting.c:180: undefined reference to `lua_type'
/home/talairina/src/lua_scripting.c:181: undefined reference to `lua_type'
/home/talairina/src/lua_scripting.c:186: undefined reference to `luaL_checkudata'
/home/talairina/src/lua_scripting.c:204: undefined reference to `luaL_error'
/home/talairina/src/lua_scripting.c:212: undefined reference to `lua_toboolean'
/home/talairina/src/lua_scripting.c:225: undefined reference to `luaL_checknumber'
/home/talairina/src/lua_scripting.c:238: undefined reference to `luaL_error'
/home/talairina/src/lua_scripting.c:251: undefined reference to `lua_toboolean'
/home/talairina/src/lua_scripting.c:268: undefined reference to `luaL_optlstring'
It does go on and on. I've tried various way's to link the files but I can't seem to wrap my head around it. Any ideas? | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Thu 21 Jan 2010 02:42 AM (UTC) |
Message
| Is the MUD C or C++? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Rash
United Kingdom (56 posts) Bio
|
Date
| Reply #2 on Thu 21 Jan 2010 03:12 AM (UTC) |
Message
| |
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Thu 21 Jan 2010 03:37 AM (UTC) |
Message
| I think you need lua.a as well as liblua.a.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Rash
United Kingdom (56 posts) Bio
|
Date
| Reply #4 on Thu 21 Jan 2010 03:54 AM (UTC) |
Message
| Where would I get that from Nick? I've checked my Lua folders for it and couldn't see it (It's not mentioned in the Lua makefile either). Also why would I require that? Am I missing something important? | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #5 on Thu 21 Jan 2010 05:25 AM (UTC) |
Message
| Did you download and compile Lua from scratch?
The symbols you are missing seem to be in liblua.a:
$ nm liblua.a
...
000014d0 T lua_gettable
000001c0 T lua_gettop
00000750 T lua_getupvalue
00000060 R lua_ident
00000280 T lua_insert
00000360 T lua_iscfunction
00001750 T lua_isnumber
00000390 T lua_isstring
000003c0 T lua_isuserdata
00001790 T lua_lessthan
00000d10 T lua_load
00001a10 T lua_newthread
...
I found liblua.a in the src directory after doing a "make" from the Lua source.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Rash
United Kingdom (56 posts) Bio
|
Date
| Reply #6 on Thu 21 Jan 2010 02:04 PM (UTC) |
Message
| I've tried 'make linux' and 'make local' then linking to the liblua.a file like so ~lua1/lib/liblua.a
I then copied the .h files in to the smaug/src folder and linked to then with #define "lua.h"
Yet I still get the same errors. I'm using this Lua package:
http://www.lua.org/ftp/lua-5.1.3.tar.gz
Encase it helps here is what uname -a throws up.
Linux vermaxhosting.com 2.6.24-25-generic #1 SMP Tue Oct 20 07:31:10 UTC 2009 i686 GNU/Linux
Typing 'lua' gives me;
Lua 5.1.3 Copyright (C) 1994-2008 Lua.org, PUC-Rio
I can't seem to figure this out. Nick if possiable if I allow you access to the Shell would you be able to see where Im going wrong? | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #7 on Thu 21 Jan 2010 08:06 PM (UTC) Amended on Fri 22 Jan 2010 12:17 AM (UTC) by Nick Gammon
|
Message
| OK I'll take a quick look. Send your details to me - mentioning where to look for compiling/linking the MUD. You can set up a temporary username/password for a day or so. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Rash
United Kingdom (56 posts) Bio
|
Date
| Reply #8 on Thu 21 Jan 2010 11:28 PM (UTC) |
Message
| You should have them now. Thanks Nick for all your help. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #9 on Fri 22 Jan 2010 12:19 AM (UTC) Amended on Fri 22 Jan 2010 12:20 AM (UTC) by Nick Gammon
|
Message
| Ah, this old trick again. :)
The problem is the link order, this has come up a few times before. It seems to work differently in Cygwin to normal Unix.
In the Makefile I changed:
dwc: $(O_FILES)
rm -f dwc
$(CC) $(L_FLAGS) -o dwc $(O_FILES)
chmod g+w dwc.exe
chmod a+x dwc.exe
chmod g+w $(O_FILES)
to:
dwc: $(O_FILES)
rm -f dwc
$(CC) -o dwc $(O_FILES) $(L_FLAGS)
chmod g+w dwc
chmod a+x dwc
chmod g+w $(O_FILES)
The problem is, with the $(L_FLAGS) at the start of the line, it sees -llua but thinks "oh I don't need Lua here, nothing uses it".
However with the $(L_FLAGS) at the end, it then sees all the references to Lua (in the o. files) and knows to resolve them.
Also got rid of the .exe on the executable name.
It linked OK for me. I tried to connect without success, but I'll let you sort that out. :-) |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Rash
United Kingdom (56 posts) Bio
|
Date
| Reply #10 on Fri 22 Jan 2010 12:49 AM (UTC) |
Message
| Ahh excellent. Yet again stumped by something so simple. I had read just before there actually that could be the cause of it. Typical. Thank you anyway Nick, as always your a great help!
Rash | Top |
|
Posted by
| Aiseant
(33 posts) Bio
|
Date
| Reply #11 on Mon 21 Feb 2011 10:14 PM (UTC) Amended on Mon 21 Feb 2011 10:19 PM (UTC) by Aiseant
|
Message
| Well, I'll require a little more help, since I have the same kind of troubles and your answers didn't do any good in my case.
I'm also trying to put Lua in a C based mud, and got a bunch of things like :
"In file included from lua.h:17,
from lauxlib.c:23:
lauxlib.h:37: error: expected specifier-qualifier-list before
or kinda
warning: implicit declaration of function luaL_optlstring
To me, it sounds like a problem with the link with liblua.a, but i'm not sure.
I included lua.h (5.1.4), currently including luaconf.h lauxlib.h and lualib.h, a makefile with L_FLAGS = $(PROF) liblua.a -lm and $(CC) $(L_FLAGS) -o ../../blabla/bin/swr $(O_FILES) $(L_FLAGS) -lm -lcrypt
and ... I'm lost, hehe :)
Thanks for your time.
Regards
Aiseant
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #12 on Tue 22 Feb 2011 12:32 AM (UTC) |
Message
| This is a compile error, not a link error. Can you start a new thread please?
Did you initially get an error about a missing include file? If so, I would start with that one. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | 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.
45,338 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top