Thread: Lua missing definitions (compiled from source)

  1. #1
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    277

    Lua missing definitions (compiled from source)

    I get as far as here without issue:
    Code:
    "O:\CWorkspace\lake\build.bat" (in directory: O:\CWorkspace\lake)
    ...
    Compiling Lake Objects
    ...
    O:\CWorkspace\lake>gcc -Wall -Werror -m64 -mconsole -mwindows -mwin32 -o ".\obj64\lake.c.o" -c ".\lake.c"
    ...
    Compiling Lua Objects
    ... Directory checks, for (*.c) loop on lua source directory and filter of lua.c/luac.c since they define main()
    O:\CWorkspace\lake>gcc -Wall -Werror -m64 -mconsole -mwindows -mwin32 -o ".\obj64\lua\lbitlib.c.o" -c "O:\Common\lua-5.3.5\src\lbitlib.c"
    ...
    Compiling Lake Executable
    O:\CWorkspace\lake>call :chk_dir "O:\Common\lake\lake64"
    O:\CWorkspace\lake>if exist "O:\Common\lake\lake64" goto :eof
    O:\CWorkspace\lake>gcc -Wall -Werror -m64 -mconsole -mwindows -mwin32 -o "O:\Common\lake\lake64\lake64.exe"  ".\obj64\Lakefile.c.o" ".\obj64\LAKEDIR.C.o" ".\obj64\lake.c.o" ".\obj64\luat.c.o" ".\obj64\LakeScript.c.o" ".\obj64\lua\lbitlib.c.o" ".\obj64\lua\lauxlib.c.o" ".\obj64\lua\lcode.c.o" ".\obj64\lua\lapi.c.o" ".\obj64\lua\ldblib.c.o" ".\obj64\lua\liolib.c.o" ".\obj64\lua\llex.c.o" ".\obj64\lua\lparser.c.o" ".\obj64\lua\lobject.c.o" ".\obj64\lua\ldebug.c.o" ".\obj64\lua\ldo.c.o" ".\obj64\lua\lcorolib.c.o" ".\obj64\lua\lgc.c.o" ".\obj64\lua\lstate.c.o" ".\obj64\lua\lundump.c.o" ".\obj64\lua\lmathlib.c.o" ".\obj64\lua\ltablib.c.o" ".\obj64\lua\ltm.c.o" ".\obj64\lua\lfunc.c.o" ".\obj64\lua\lstrlib.c.o" ".\obj64\lua\lopcodes.c.o" ".\obj64\lua\lutf8lib.c.o" ".\obj64\lua\loslib.c.o" ".\obj64\lua\lvm.c.o" ".\obj64\lua\loadlib.c.o" ".\obj64\lua\lmem.c.o" ".\obj64\lua\ltable.c.o" ".\obj64\lua\ldump.c.o" ".\obj64\lua\lzio.c.o" ".\obj64\lua\lctype.c.o" ".\obj64\lua\lstring.c.o" ".\obj64\lua\linit.c.o" ".\obj64\lua\lbaselib.c.o"
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x20): undefined reference to `lua_createtable(lua_State*, int, int)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x3f): undefined reference to `luat_setintegerfield(lua_State*, char const*, long long)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x5e): undefined reference to `luat_setstringfield(lua_State*, char const*, char const*)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x8a): undefined reference to `luaL_checkudata(lua_State*, int, char const*)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0xaa): undefined reference to `lua_pushnil(lua_State*)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x104): undefined reference to `lua_pushnil(lua_State*)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x130): undefined reference to `luaL_checkudata(lua_State*, int, char const*)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x1f6): undefined reference to `luaL_checkudata(lua_State*, int, char const*)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x211): undefined reference to `lua_pushstring(lua_State*, char const*)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x260): undefined reference to `lua_pushfstring(lua_State*, char const*, ...)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x279): undefined reference to `lua_pushfstring(lua_State*, char const*, ...)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x2a5): undefined reference to `luaL_checkudata(lua_State*, int, char const*)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x2b7): undefined reference to `lua_type(lua_State*, int)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x2e5): undefined reference to `lua_pushnil(lua_State*)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x30d): undefined reference to `lua_tolstring(lua_State*, int, unsigned long long*)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x37d): undefined reference to `lua_pushcclosure(lua_State*, int (*)(lua_State*), int)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x3cd): undefined reference to `lua_pushstring(lua_State*, char const*)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x3eb): undefined reference to `lua_pushnil(lua_State*)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x407): undefined reference to `lua_tonumberx(lua_State*, int, int*)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x43a): undefined reference to `lua_pushnil(lua_State*)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x443): undefined reference to `lua_error(lua_State*)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x477): undefined reference to `luaL_checklstring(lua_State*, int, unsigned long long*)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x489): undefined reference to `lua_settop(lua_State*, int)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x497): undefined reference to `lua_newuserdata(lua_State*, unsigned long long)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x4ab): undefined reference to `lua_pushnil(lua_State*)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x4e1): undefined reference to `lua_getfield(lua_State*, int, char const*)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x4ef): undefined reference to `lua_setmetatable(lua_State*, int)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x526): undefined reference to `lua_settop(lua_State*, int)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x52f): undefined reference to `lua_pushnil(lua_State*)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x571): undefined reference to `lua_pushnil(lua_State*)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x5a6): undefined reference to `LakeRegisterClass(lua_State*, char const*, luaL_Reg const*)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x5ca): undefined reference to `lua_pushcclosure(lua_State*, int (*)(lua_State*), int)'
    o:/common/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .\obj64\LAKEDIR.C.o:LAKEDIR.C:(.text+0x5da): undefined reference to `lua_setglobal(lua_State*, char const*)'
    ...
    PATH=O:\Common\MinGW\bin;C:\WINDOWS\SysWOW64
    CPATH=O:\Common\MinGW\include;O:\Common\MinGW\include\freetype;O:\Common\lua-5.3.5\src
    LIBRARY_PATH=O:\Common\MinGW\lib;C:\WINDOWS\SysWOW64
    Compilation failed.
    As you can see a weird set of errors appeared and I can't find any relevant information, google just keeps bringing up declaration issues (people confusing the term definition for declaration)

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    3,506
    Are you building lua or using lua?

    If you are not build the lua libraries; then, you need to link to the lua libraries!

    You might wish to tell us what "lake" is!

    Tim S.
    Last edited by stahta01; 1 Week Ago at 04:17 PM.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  3. #3
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    277
    lake is the program I'm compiling (currently using batch but will switch to lua when I confirm it's parsing options properly and passing the shell output to stdout), and yes I'm building lua, after all what good is a make replacement if it requires a library along side it.
    Edit: Btw how did you not get lake was the program I'm compiling despite there being
    Compiling Lake Executable
    in the log?
    Last edited by awsdert; 1 Week Ago at 04:25 PM. Reason: curiosity

  4. #4
    Registered User
    Join Date
    May 2009
    Posts
    3,506
    Then you need to link to the lua library possibly liblua.a or liblua.dll.a

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  5. #5
    Registered User
    Join Date
    May 2009
    Posts
    3,506
    Quote Originally Posted by awsdert View Post
    lake is the program I'm compiling (currently using batch but will switch to lua when I confirm it's parsing options properly and passing the shell output to stdout), and yes I'm building lua, after all what good is a make replacement if it requires a library along side it.
    Edit: Btw how did you not get lake was the program I'm compiling despite there being in the log?
    I thought maybe lake was a name for a component of lua.

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  6. #6
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    277
    There is no liblua.a, I downloaded purely the source because I wanted to reduce the chances of someone else experiencing the problems I'm currently facing if they decide to compile lake some time after I upload it, the intent is that it remains small enough to be a replacement for make but is more flexible than batch or the linux etc shells

    Edit: Going to sleep, I'll check back tomorrow... eventually... I think... depends if I'm in the mood to program, been in a programming frenzy lately so probably
    Last edited by awsdert; 1 Week Ago at 05:31 PM. Reason: notification

  7. #7
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    277
    Yo, shame no one had/suggested any ideas while I was asleep, I'll continue looking after reading a chapter of the Bible

  8. #8
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    26,234
    Doesn't this lake program have some kind of community (forum, mailing list, etc) where you can ask about this? Those are the people who are far more likely to have experienced whatever you're going through and hence could give you specific and accurate help. Over here, unless we're willing to dig in deep into what you are doing, all we can advise is that either you somehow left out the source files containing the definitions of these functions during compilation or linking, or these were defined in a library file that you failed to link (as stahta01 has already suggested). Since you say there are no library files to link with, it implies the former, which means either some kind of oversight on your part, or possibly a problem with versions.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  9. #9
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    277
    lake has no community (yet) because it is a program made from scratch by me, lua headers are fine since I have multiple files including the same header (lake.h) which includes the lua headers in it (along with other standard libraries) and yet individual object files are not being compiled properly, my most recent attempt showed an error like this:
    Code:
    o:\common\mingw\x86_64-w64-mingw32\include\stdio.h:345:5: internal compiler error: Segmentation fault
    while compiling the lake files but never anywhere specific in the file, no pragma's are used (in lake at least), I've even tried deleting the object files and still no fix

  10. #10
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    26,234
    Ah, I see. When did you start observing this problem? That is, you have an earlier version of your lake program that you did manage to compile and link successfully, right? Perhaps you can do a diff to see what changes might have caused the problem.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  11. #11
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    277
    hahaa...I only kept one copy of the source, the current copy, no diff possible

  12. #12
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    277
    I've also tried throwing in the -ansi switch and deleting the object files compiled before

  13. #13
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    277
    Currently downloading GitPortable to upload my source with, will be uploaded here:
    GitHub - awsdert/lake

  14. #14
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    277
    that didn't work out, attempting with GitHub Desktop now

  15. #15
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    277
    Okay I've uploaded it, added a readme too and set the license to MIT

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. New to C need help with definitions
    By Embed in forum C Programming
    Replies: 7
    Last Post: 01-01-2015, 09:00 PM
  2. Replies: 9
    Last Post: 05-09-2013, 09:37 PM
  3. Replies: 23
    Last Post: 03-07-2011, 05:28 PM
  4. #include causes missing symbol definitions
    By mjl3434 in forum C Programming
    Replies: 4
    Last Post: 02-17-2011, 01:43 PM
  5. Replies: 1
    Last Post: 03-12-2008, 12:10 AM

Tags for this Thread