Recent

Author Topic: Compiling an application using Lua  (Read 23508 times)

cybermonkey342

  • New Member
  • *
  • Posts: 42
    • Home of EGSL interpreter
Compiling an application using Lua
« on: August 01, 2010, 10:07:27 pm »
Hello,

I am stuck now. I can compile my program on Windows and Linux but not on MacOS X. It uses the units lua,lualib and lauxlib. I installed Lua from the source and it seems to work (at last the interactive mode works).
This is what I retrieve:
Code: [Select]
Undefined symbols:
  "_lua_isstring", referenced from: _LUA_LUA_ISSTRING$POINTER$LONGINT$$LONGBOOL in lua.o
  "_luaL_loadstring", referenced from: _LAUXLIB_LUAL_LOADSTRING$POINTER$PCHAR$$LONGINT in lauxlib.o
  "_lua_createtable", referenced from: _LUA_LUA_CREATETABLE$POINTER$LONGINT$LONGINT in lua.o
  "_luaL_checktype", referenced from: _LAUXLIB_LUAL_CHECKTYPE$POINTER$LONGINT$LONGINT in lauxlib.o
  "_lua_pushvalue", referenced from: _LUA_LUA_PUSHVALUE$POINTER$LONGINT in lua.o
  "_lua_tothread", referenced from: _LUA_LUA_TOTHREAD$POINTER$LONGINT$$POINTER in lua.o
  "_lua_setupvalue", referenced from: _LUA_LUA_SETUPVALUE$POINTER$LONGINT$LONGINT$$PCHAR in lua.o
  "_luaopen_table", referenced from: _LUALIB_LUAOPEN_TABLE$POINTER$$LONGBOOL in lualib.o
  "_lua_getmetatable", referenced from: _LUA_LUA_GETMETATABLE$POINTER$LONGINT$$LONGINT in lua.o
  "_lua_rawget", referenced from: _LUA_LUA_RAWGET$POINTER$LONGINT in lua.o
  "_lua_rawset", referenced from: _LUA_LUA_RAWSET$POINTER$LONGINT in lua.o
  "_lua_remove", referenced from: _LUA_LUA_REMOVE$POINTER$LONGINT in lua.o
  "_lua_resume", referenced from: _LUA_LUA_RESUME$POINTER$LONGINT$$LONGINT in lua.o
  "_lua_pushnumber", referenced from: _LUA_LUA_PUSHNUMBER$POINTER$DOUBLE in lua.o
  "_lua_getfield", referenced from: _LUA_LUA_GETFIELD$POINTER$LONGINT$PCHAR in lua.o
  "_luaL_buffinit", referenced from: _LAUXLIB_LUAL_BUFFINIT$POINTER$PLUAL_BUFFER in lauxlib.o
  "_lua_isuserdata", referenced from: _LUA_LUA_ISUSERDATA$POINTER$LONGINT$$LONGBOOL in lua.o
  "_lua_setallocf", referenced from: _LUA_LUA_SETALLOCF$POINTER$LUA_ALLOC$POINTER in lua.o
  "_luaL_pushresult", referenced from: _LAUXLIB_LUAL_PUSHRESULT$PLUAL_BUFFER in lauxlib.o
  "_lua_settop", referenced from: _LUA_LUA_SETTOP$POINTER$LONGINT in lua.o
  "_lua_lessthan", referenced from: _LUA_LUA_LESSTHAN$POINTER$LONGINT$LONGINT$$LONGBOOL in lua.o
  "_lua_getlocal", referenced from: _LUA_LUA_GETLOCAL$POINTER$PLUA_DEBUG$LONGINT$$PCHAR in lua.o
  "_luaL_checkudata", referenced from: _LAUXLIB_LUAL_CHECKUDATA$POINTER$LONGINT$PCHAR$$POINTER in lauxlib.o
  "_luaL_checkstack", referenced from: _LAUXLIB_LUAL_CHECKSTACK$POINTER$LONGINT$PCHAR in lauxlib.o
  "_lua_checkstack", referenced from: _LUA_LUA_CHECKSTACK$POINTER$LONGINT$$LONGBOOL in lua.o
  "_lua_gettable", referenced from: _LUA_LUA_GETTABLE$POINTER$LONGINT in lua.o
  "_lua_getstack", referenced from: _LUA_LUA_GETSTACK$POINTER$LONGINT$PLUA_DEBUG$$LONGINT in lua.o
  "_lua_status", referenced from: _LUA_LUA_STATUS$POINTER$$LONGINT in lua.o
  "_lua_pushthread", referenced from: _LUA_LUA_PUSHTHREAD$POINTER in lua.o
  "_luaL_findtable", referenced from: _LAUXLIB_LUAL_FINDTABLE$POINTER$LONGINT$PCHAR$LONGINT$$PCHAR in lauxlib.o
  "_lua_pushvfstring", referenced from: _LUA_LUA_PUSHVFSTRING$POINTER$PCHAR$POINTER$$PCHAR in lua.o
  "_lua_iscfunction", referenced from: _LUA_LUA_ISCFUNCTION$POINTER$LONGINT$$LONGBOOL in lua.o
  "_lua_pushlstring", referenced from: _LUA_LUA_PUSHLSTRING$POINTER$PCHAR$LONGWORD in lua.o
  "_lua_pushstring", referenced from: _LUA_LUA_PUSHSTRING$POINTER$PCHAR in lua.o
  "_luaL_optinteger", referenced from: _LAUXLIB_LUAL_OPTINTEGER$POINTER$LONGINT$LONGINT$$LONGINT in lauxlib.o
  "_luaL_addstring", referenced from: _LAUXLIB_LUAL_ADDSTRING$PLUAL_BUFFER$PCHAR in lauxlib.o
  "_lua_atpanic", referenced from: _LUA_LUA_ATPANIC$POINTER$LUA_CFUNCTION$$LUA_CFUNCTION in lua.o
  "_lua_pushfstring", referenced from: _LUA_LUA_PUSHFSTRING$POINTER$PCHAR$$PCHAR in lua.o
  "_lua_rawequal", referenced from: _LUA_LUA_RAWEQUAL$POINTER$LONGINT$LONGINT$$LONGBOOL in lua.o
  "_lua_newthread", referenced from: _LUA_LUA_NEWTHREAD$POINTER$$POINTER in lua.o
  "_luaL_register", referenced from: _LAUXLIB_LUAL_REGISTER$POINTER$PCHAR$PLUAL_REG in lauxlib.o
  "_luaL_typerror", referenced from: _LAUXLIB_LUAL_TYPERROR$POINTER$LONGINT$PCHAR$$LONGINT in lauxlib.o
  "_lua_tocfunction", referenced from: _LUA_LUA_TOCFUNCTION$POINTER$LONGINT$$LUA_CFUNCTION in lua.o
  "_lua_pushcclosure", referenced from: _LUA_LUA_PUSHCCLOSURE$POINTER$LUA_CFUNCTION$LONGINT in lua.o
  "_lua_tolstring", referenced from: _LUA_LUA_TOLSTRING$POINTER$LONGINT$PSIZE_T$$PCHAR in lua.o
  "_lua_gc", referenced from: _LUA_LUA_GC$POINTER$LONGINT$LONGINT$$LONGINT in lua.o
  "_lua_pushlightuserdata", referenced from: _LUA_LUA_PUSHLIGHTUSERDATA$POINTER$POINTER in lua.o
  "_luaL_addlstring", referenced from: _LAUXLIB_LUAL_ADDLSTRING$PLUAL_BUFFER$PCHAR$LONGWORD in lauxlib.o
  "_lua_getallocf", referenced from: _LUA_LUA_GETALLOCF$POINTER$PPOINTER$$LUA_ALLOC in lua.o
  "_lua_rawgeti", referenced from: _LUA_LUA_RAWGETI$POINTER$LONGINT$LONGINT in lua.o
  "_luaL_loadbuffer", referenced from: _LAUXLIB_LUAL_LOADBUFFER$POINTER$PCHAR$LONGWORD$PCHAR$$LONGINT in lauxlib.o
  "_lua_rawseti", referenced from: _LUA_LUA_RAWSETI$POINTER$LONGINT$LONGINT in lua.o
  "_luaL_error", referenced from: _LAUXLIB_LUAL_ERROR$POINTER$PCHAR$array_of_const$$LONGINT in lauxlib.o
  "_lua_typename", referenced from: _LUA_LUA_TYPENAME$POINTER$LONGINT$$PCHAR in lua.o
  "_lua_pushboolean", referenced from: _LUA_LUA_PUSHBOOLEAN$POINTER$LONGBOOL in lua.o
  "_lua_close", referenced from: _LUA_LUA_CLOSE$POINTER in lua.o
  "_lua_replace", referenced from: _LUA_LUA_REPLACE$POINTER$LONGINT in lua.o
  "_luaopen_string", referenced from: _LUALIB_LUAOPEN_STRING$POINTER$$LONGBOOL in lualib.o
  "_lua_equal", referenced from: _LUA_LUA_EQUAL$POINTER$LONGINT$LONGINT$$LONGBOOL in lua.o
  "_lua_error", referenced from: _LUA_LUA_ERROR$POINTER$$LONGINT in lua.o
  "_luaL_ref", referenced from: _LAUXLIB_LUAL_REF$POINTER$LONGINT$$LONGINT in lauxlib.o
  "_luaopen_io", referenced from: _LUALIB_LUAOPEN_IO$POINTER$$LONGBOOL in lualib.o
  "_luaopen_package", referenced from: _LUALIB_LUAOPEN_PACKAGE$POINTER$$LONGBOOL in lualib.o
  "_luaL_unref", referenced from: _LAUXLIB_LUAL_UNREF$POINTER$LONGINT$LONGINT in lauxlib.o
  "_luaL_where", referenced from: _LAUXLIB_LUAL_WHERE$POINTER$LONGINT in lauxlib.o
  "_luaopen_base", referenced from: _LUALIB_LUAOPEN_BASE$POINTER$$LONGBOOL in lualib.o
  "_lua_pcall", referenced from: _LUA_LUA_PCALL$POINTER$LONGINT$LONGINT$LONGINT$$LONGINT in lua.o
  "_luaopen_math", referenced from: _LUALIB_LUAOPEN_MATH$POINTER$$LONGBOOL in lualib.o
  "_lua_gethookcount", referenced from: _LUA_LUA_GETHOOKCOUNT$POINTER$$LONGINT in lua.o
  "_lua_pushinteger", referenced from: _LUA_LUA_PUSHINTEGER$POINTER$LONGINT in lua.o
  "_lua_newuserdata", referenced from: _LUA_LUA_NEWUSERDATA$POINTER$LONGWORD$$POINTER in lua.o
  "_luaL_checklstring", referenced from: _LAUXLIB_LUAL_CHECKLSTRING$POINTER$LONGINT$PSIZE_T$$PCHAR in lauxlib.o
  "_lua_setfield", referenced from: _LUA_LUA_SETFIELD$POINTER$LONGINT$PCHAR in lua.o
  "_luaL_addvalue", referenced from: _LAUXLIB_LUAL_ADDVALUE$PLUAL_BUFFER in lauxlib.o
  "_lua_toboolean", referenced from: _LUA_LUA_TOBOOLEAN$POINTER$LONGINT$$LONGBOOL in lua.o
  "_lua_yield", referenced from: _LUA_LUA_YIELD$POINTER$LONGINT$$LONGINT in lua.o
  "_lua_xmove", referenced from: _LUA_LUA_XMOVE$POINTER$POINTER$LONGINT in lua.o
  "_lua_getupvalue", referenced from: _LUA_LUA_GETUPVALUE$POINTER$LONGINT$LONGINT$$PCHAR in lua.o
  "_luaL_openlibs", referenced from: _LUALIB_LUAL_OPENLIBS$POINTER in lualib.o
  "_lua_cpcall", referenced from: _LUA_LUA_CPCALL$POINTER$LUA_CFUNCTION$POINTER$$LONGINT in lua.o
  "_lua_concat", referenced from: _LUA_LUA_CONCAT$POINTER$LONGINT in lua.o
  "_lua_setlocal", referenced from: _LUA_LUA_SETLOCAL$POINTER$PLUA_DEBUG$LONGINT$$PCHAR in lua.o
  "_lua_call", referenced from: _LUA_LUA_CALL$POINTER$LONGINT$LONGINT in lua.o
  "_lua_dump", referenced from: _LUA_LUA_DUMP$POINTER$LUA_WRITER$POINTER$$LONGINT in lua.o
  "_lua_load", referenced from: _LUA_LUA_LOAD$POINTER$LUA_READER$POINTER$PCHAR$$LONGINT in lua.o
  "_lua_next", referenced from: _LUA_LUA_NEXT$POINTER$LONGINT$$LONGINT in lua.o
  "_lua_setfenv", referenced from: _LUA_LUA_SETFENV$POINTER$LONGINT$$LONGINT in lua.o
  "_lua_gethookmask", referenced from: _LUA_LUA_GETHOOKMASK$POINTER$$LONGINT in lua.o
  "_lua_type", referenced from: _LUA_LUA_TYPE$POINTER$LONGINT$$LONGINT in lua.o
  "_lua_settable", referenced from: _LUA_LUA_SETTABLE$POINTER$LONGINT in lua.o
  "_lua_sethook", referenced from: _LUA_LUA_SETHOOK$POINTER$LUA_HOOK$LONGINT$LONGINT$$LONGINT in lua.o
  "_luaL_openlib", referenced from: _LAUXLIB_LUAL_OPENLIB$POINTER$PCHAR$PLUAL_REG$LONGINT in lauxlib.o
  "_luaL_newstate", referenced from: _LAUXLIB_LUAL_NEWSTATE$$POINTER in lauxlib.o
  "_luaL_getmetafield", referenced from: _LAUXLIB_LUAL_GETMETAFIELD$POINTER$LONGINT$PCHAR$$LONGINT in lauxlib.o
  "_lua_pushnil", referenced from: _LUA_LUA_PUSHNIL$POINTER in lua.o
  "_lua_touserdata", referenced from: _LUA_LUA_TOUSERDATA$POINTER$LONGINT$$POINTER in lua.o
  "_lua_tointeger", referenced from: _LUA_LUA_TOINTEGER$POINTER$LONGINT$$LONGINT in lua.o
  "_lua_setmetatable", referenced from: _LUA_LUA_SETMETATABLE$POINTER$LONGINT$$LONGINT in lua.o
  "_lua_gettop", referenced from: _LUA_LUA_GETTOP$POINTER$$LONGINT in lua.o
  "_luaL_checknumber", referenced from: _LAUXLIB_LUAL_CHECKNUMBER$POINTER$LONGINT$$DOUBLE in lauxlib.o
  "_luaL_checkoption", referenced from: _LAUXLIB_LUAL_CHECKOPTION$POINTER$LONGINT$PCHAR$PPCHAR$$LONGINT in lauxlib.o
  "_luaL_checkany", referenced from: _LAUXLIB_LUAL_CHECKANY$POINTER$LONGINT in lauxlib.o
  "_lua_getfenv", referenced from: _LUA_LUA_GETFENV$POINTER$LONGINT in lua.o
  "_lua_getinfo", referenced from: _LUA_LUA_GETINFO$POINTER$PCHAR$PLUA_DEBUG$$LONGINT in lua.o
  "_lua_isnumber", referenced from: _LUA_LUA_ISNUMBER$POINTER$LONGINT$$LONGBOOL in lua.o
  "_lua_topointer", referenced from: _LUA_LUA_TOPOINTER$POINTER$LONGINT$$POINTER in lua.o
  "_luaL_optnumber", referenced from: _LAUXLIB_LUAL_OPTNUMBER$POINTER$LONGINT$DOUBLE$$DOUBLE in lauxlib.o
  "_lua_newstate", referenced from: _LUA_LUA_NEWSTATE$LUA_ALLOC$POINTER$$POINTER in lua.o
  "_lua_insert", referenced from: _LUA_LUA_INSERT$POINTER$LONGINT in lua.o
  "_luaL_argerror", referenced from: _LAUXLIB_LUAL_ARGERROR$POINTER$LONGINT$PCHAR$$LONGINT in lauxlib.o
  "_luaL_gsub", referenced from: _LAUXLIB_LUAL_GSUB$POINTER$PCHAR$PCHAR$PCHAR$$PCHAR in lauxlib.o
  "_luaL_newmetatable", referenced from: _LAUXLIB_LUAL_NEWMETATABLE$POINTER$PCHAR$$LONGINT in lauxlib.o
  "_luaL_loadfile", referenced from: _LAUXLIB_LUAL_LOADFILE$POINTER$PCHAR$$LONGINT in lauxlib.o
  "_luaL_prepbuffer", referenced from: _LAUXLIB_LUAL_PREPBUFFER$PLUAL_BUFFER$$PCHAR in lauxlib.o
  "_lua_tonumber", referenced from: _LUA_LUA_TONUMBER$POINTER$LONGINT$$DOUBLE in lua.o
  "_luaL_optlstring", referenced from: _LAUXLIB_LUAL_OPTLSTRING$POINTER$LONGINT$PCHAR$PSIZE_T$$PCHAR in lauxlib.o
  "_luaL_callmeta", referenced from: _LAUXLIB_LUAL_CALLMETA$POINTER$LONGINT$PCHAR$$LONGINT in lauxlib.o
  "_luaL_checkinteger", referenced from: _LAUXLIB_LUAL_CHECKINTEGER$POINTER$LONGINT$$LONGINT in lauxlib.o
  "_lua_objlen", referenced from: _LUA_LUA_OBJLEN$POINTER$LONGINT$$LONGWORD in lua.o
  "_luaopen_debug", referenced from: _LUALIB_LUAOPEN_DEBUG$POINTER$$LONGBOOL in lualib.o
ld: symbol(s) not found
Error: Error while linking
Any help is appreciated ...
--
Best regards

cybermonkey342

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Compiling an application using Lua
« Reply #1 on: August 04, 2010, 09:16:41 pm »
I am stuck now. I can compile my program on Windows and Linux but not on MacOS X. It uses the units lua,lualib and lauxlib. I installed Lua from the source and it seems to work (at last the interactive mode works).
where to find lua* files?

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Compiling an application using Lua
« Reply #2 on: August 04, 2010, 09:25:16 pm »
Which bindings to lua do you use?

cybermonkey342

  • New Member
  • *
  • Posts: 42
    • Home of EGSL interpreter
Re: Compiling an application using Lua
« Reply #3 on: August 06, 2010, 07:27:15 pm »
I am stuck now. I can compile my program on Windows and Linux but not on MacOS X. It uses the units lua,lualib and lauxlib. I installed Lua from the source and it seems to work (at last the interactive mode works).
where to find lua* files?
If you mean the libs, they are located in "usr/local/lib"
--
Best regards

cybermonkey342

cybermonkey342

  • New Member
  • *
  • Posts: 42
    • Home of EGSL interpreter
Re: Compiling an application using Lua
« Reply #4 on: August 06, 2010, 07:27:54 pm »
Which bindings to lua do you use?
The units shipped with Freepascal.
--
Best regards

cybermonkey342

Laksen

  • Hero Member
  • *****
  • Posts: 740
    • J-Software
Re: Compiling an application using Lua
« Reply #5 on: August 06, 2010, 10:03:08 pm »
Try to look at the SDL units. For Darwin they have to use a linklib directive, it could be that you have the same problem?

cybermonkey342

  • New Member
  • *
  • Posts: 42
    • Home of EGSL interpreter
Re: Compiling an application using Lua
« Reply #6 on: August 07, 2010, 10:49:34 am »
Yeah, that's my other problem: I can't compile SDL applications, yet ...  I tried different things but nothing was successful.
--
Best regards

cybermonkey342

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Compiling an application using Lua
« Reply #7 on: August 08, 2010, 12:22:54 am »
what FPC version are you using?
what's the error with SDL?

cybermonkey342

  • New Member
  • *
  • Posts: 42
    • Home of EGSL interpreter
Re: Compiling an application using Lua
« Reply #8 on: August 09, 2010, 07:44:19 pm »
FPC 2.4.0
I installed now SDL from source - at last Mac OS finds SDL now (which wasn't true with the framework), but:
Quote
Linking sdltest
ld: library not found for -lX11
An error occurred while linking
Error: Error while linking
Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/local/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)
Why in good heavens does SDL need X11 on a Mac??

To be frankly I want to compile my EGSL interpreter which can be found on: http://egsl.wikidot.com (which needs SDL AND Lua)
--
Best regards

cybermonkey342

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Compiling an application using Lua
« Reply #9 on: August 10, 2010, 07:11:00 am »
Quote
Why in good heavens does SDL need X11 on a Mac??
Ask SDL developers :D
Perhaps because SDL was written before Carbon and Cocoa appear (CMIIW), and the developers thought that X11 will stay as Mac's windowing system.

cybermonkey342

  • New Member
  • *
  • Posts: 42
    • Home of EGSL interpreter
Re: Compiling an application using Lua
« Reply #10 on: August 10, 2010, 12:03:39 pm »
Quote
Why in good heavens does SDL need X11 on a Mac??
Ask SDL developers :D
Perhaps because SDL was written before Carbon and Cocoa appear (CMIIW), and the developers thought that X11 will stay as Mac's windowing system.
Erm, the question was asked in a wrong way.
Why does SDL together with FPC need X11?
I can compile SDL applications with GCC without any problems and without the need of X11 libraries. I think that is an issue with FPC. On Haiku-OS it's just the same: compiling SDL applications with GCC is no problem, with FPC: X11 libs needed ...
--
Best regards

cybermonkey342

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1059
Re: Compiling an application using Lua
« Reply #11 on: August 10, 2010, 12:55:17 pm »
Why does SDL together with FPC need X11?

Because the "x" and "xlib" units are in the uses clause of the sdl unit for all unix platforms, even though this is indeed not necessary.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Compiling an application using Lua
« Reply #12 on: August 10, 2010, 01:42:50 pm »
Because the "x" and "xlib" units are in the uses clause of the sdl unit for all unix platforms, even though this is indeed not necessary.
wasn't it fixed in trunk?

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1059
Re: Compiling an application using Lua
« Reply #13 on: August 10, 2010, 01:47:56 pm »
Because the "x" and "xlib" units are in the uses clause of the sdl unit for all unix platforms, even though this is indeed not necessary.
wasn't it fixed in trunk?
Not as far as I can see.

cybermonkey342

  • New Member
  • *
  • Posts: 42
    • Home of EGSL interpreter
Re: Compiling an application using Lua
« Reply #14 on: August 10, 2010, 02:09:31 pm »
So it is enough to remove "x" and "xlib" from sdl.pas? And have other units to be added?
--
Best regards

cybermonkey342

 

TinyPortal © 2005-2018