luapower bundle

  • I did the following but still getting error. I could not find the file anywhere in the cloned directory. What am i still missing . Thanks.

    git clone luapower
    cd luapower
    ./mgit clone

    ./mgit bundle

    .mgit/ line 423: .mgit/ No such file or directory
    Unable to set platform.

  • 32
    Log in to reply

  • Hi,

    I have done that but the issue is that I need to dump my source code in the /home/albert/luapower directory. The use case that I am look for is the ability to execute the bundle compiler on an directory of my choosing. Hope this clarify my use case scenario. Thanks.

  • I can see why you might feel uneasy adding your scripts to the flaming wok. You probably cloned all the modules and now you're looking at a directory with 450 files in it and say "what a mess, I don't want to mix my app with that". You want to use it all as an upstream library that you don't want to touch. I can understand that. But you'd be going against the grain if you do that. It would be much easier to use luapower as if it's you who's written it, as if it's yours and not something external to your project that you don't want to mess with. So make it yours, i.e.:

    • only clone the modules that you actually use -- seeing only relevant files will make it more approachable.
    • fork the modules that you think you might want to hack on and clone them from your own place -- hack them, remove stuff that you don't need from them and push the changes -- the modules are yours now.
    • embrace the directory conventions, they're just common sense after all, so put your binaries in bin/platform, put Lua files in root where the luajit launcher is, etc. All the tools will know where to find your files and you'll never have to specify paths on the command line.
    • your app will be mixed with other luapower modules on disk, yes, but it will still have its own completely separate git repository with its own history etc. (none of that git subtree merge crap either). As a bonus, anyone will be able to fork/clone your app directly into their own luapower tree in case you'll ever want to open its development to other luapower users.

    I hope you'll to give it a shot, because adding command line options all the tools with all the search paths is a pain in the butt :)

  • Hi,

    Thanks for the clear explanation on your approach to luapower. FYI, I have only cloned the mgit, bundle and luapower-repos. Even that those three, I am bewildered with the sear amount of files and sub-directory.

    Again my expectation was way off from your vision of luapower. I was thinking more along the line of mgit source compiled to an executable which in turn can be used for bundling/compiling of lua code into a standalone execute.

    Anyway, I would like to express my sincere gratitude for all the work that you have done for the lua /luajit community. Thank you.

  • To make it less overwhelming you could type mgit ls-tracked to see which file was added in by which package. Or you could try cloning these again and look at how the directory evolves.

    Let's summarize: cloning multigit adds in the mgit script, fair enough, then cloning luapower-repos adds in the .mgit directory which contains the origins of all known packages so you can do mgit clone bundle instead of mgit clone It also adds some scripts that are specific to luapower because multigit itself has nothing to do with luapower, it's just a way to clone multiple git repos overlapped. Finally, bundle adds in files all over the place. That's ok, all packages do that. This is why we have the luapower conventions, to allow packages to coexist peacefully in the same directory even when it's very crowded in there. This looks messy at first (just like a Linux system) but it's much more simple and scalable than putting each module in it's own directory and is in fact easier to use. It's just, well, not very mainstream, although it's weird to say that because that's how Linux works and Linux is very mainstream :)

    The truth is that in order to make a good quality app you will have to know your full stack and be able to hack it at any level, no blackboxes. Luapower embraces that so it doesn't try to hide the guts, it just tries to organize them :)

    Anyway I hope this helps. And thanks for the kind words. They're very much appreciated.

  • Hi,

    I have compiled a project of mine and the process when without any error. But I encounter this problem with luasql.mysql . How do I include it in the executable. Thanks.

    ./mainexe: ./main.lua:13: module 'luasql.mysql' not found:
    no field package.preload['luasql.mysql']
    no file './luasql/mysql.lua'
    no file './luasql/mysql/init.lua'
    no file './clib/luasql/mysql.dll'
    no file './clib/luasql.dll'
    no symbol 'Blua_luasql_mysql'
    no symbol 'luaopen_luasql_mysql'

    ----- Compiled Command
    ./mgit bundle -m --all -a --all -M main -o mainexe -v

  • Hi Albert,

    What is the file name and path of luasql.mysql ?

  • I did a search and it appear as

    sudo find /. |grep luasql


  • Bundle doesn't know how how to find libraries outside of the luapower tree. All dependencies must be included. In your case it looks like is a Lua/C library and so you need to put it (or link it) in bin/linux64/clib/

    Btw, if that module was compiled against Lua 5.2 then it might not work with luajit (not sure)

  • Actually, bin/linux64/clib/luasql/ gosh talk about love for hierarchy :)

  • Oh and if it's for mysql, there's a libmysql binding and there's binaries for libmysql and libmariadb.

  • Yes. I was working with lua in the beginning and most people point me to luasql so there is where i build my modules.

    How about socket, mime and ltn12? do I need to move the library to the /bin/linux64/clib ?

  • There's a LP package for luasocket: mgit clone socket

  • @cosmin I traced that the the to the following /usr/lib/x86_64-linux-gnu/

    I did a ln -s /usr/lib/x86_64-linux-gnu/ in the bin/linux64/clib/ directory. Compiled again but still getting the same error. What else do I need to do? Thanks.

  • Hm, the error was from windows but now you're talking about Linux. I'm confused...

    If you run ./luajit -lluasql.mysql does it work?

  • For your information, I am running all the commands in Ubuntu 14.04 64bit machine.

    ./luajit -lluasql.mysql

    LuaJIT 2.1.0-alpha -- Copyright (C) 2005-2015 Mike Pall.
    JIT: ON SSE2 SSE3 SSE4.1 fold cse dce fwd dse narrow loop abc sink fuse

  • Ah crud. Wait. You wanna bundle a dynamic lib? :) That's not possible, you need to bundle the .a file (the static lib).

    Check ./mgit bundle --list-lua-modules and mgit bundle --list-alibs and see if you can find your lib in there. It should be in the alibs list.

  • And lemme guess, luasql doesn't come with static libs (most of them don't), so you need to compile. Probably need to make a build script too cuz most makefiles don't generate static libs.

  • Note that with bundle you can have both bundled libs and dynamic libs. So if you don't have mysql.a you can put clib/luasql/ in the directory of your exe and it should work. But it won't be a single exe deployment quite obviously :)

  • Hi,

    It seems very wired that the compiled luajit is looking for the library named mysql.dll instead of I renamed it form extension so to dll it worked. FYI, I am running this in Ubuntu Linux x64. Can you please check if it is indeed looking up the wrong extension via a via OS platform. Thanks.

    no field package.preload['luasql.mysql']
    no file './luasql/mysql.lua'
    no file './luasql/mysql/init.lua'
    no file './clib/luasql/mysql.dll'
    no file './clib/luasql.dll'
    no symbol 'Blua_luasql_mysql'
    no symbol 'luaopen_luasql_mysql'

  • Aha. That's why I was confused about windows/linux. Looks like you found a bug, it's here:

    I'l go fix it.

Log in to reply

Internal error.

Oops! Looks like something went wrong!