I did the following but still getting error. I could not find the file platform.sh anywhere in the cloned directory. What am i still missing . Thanks.
.mgit/bundle.sh: line 423: .mgit/platform.sh: No such file or directory
Unable to set platform.
As an example, I install the mgit, bundle and luapower-repos in /home/albert/luapower. Now my custom lua scripts is in /usr/local/programs. I would like to be able to issue the "mgit bundle -m --all -M main -o main.exe" from the /usr/local/programs directory. In essence, I want to keep my custom scripts directory separate from the luapower directory. Thanks.
(cd /home/albert/luapower; mgit bundle -m --all -M main -o main.exe)?
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 :)
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-trackedto 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
mgitscript, fair enough, then cloning luapower-repos adds in the
.mgitdirectory which contains the origins of all known packages so you can do
mgit clone bundleinstead of
mgit clone https://github.com/luapower/bundle. 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.
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
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 mysql.so is a Lua/C library and so you need to put it (or link it) in
Btw, if that module was compiled against Lua 5.2 then it might not work with luajit (not sure)
bin/linux64/clib/luasql/mysql.sogosh 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
I did a ln -s /usr/lib/x86_64-linux-gnu/liblua5.1-sql-mysql.so.2.0.0 mysql.so 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.mysqldoes it work?
For your information, I am running all the commands in Ubuntu 14.04 64bit machine.
LuaJIT 2.1.0-alpha -- Copyright (C) 2005-2015 Mike Pall. http://luajit.org/
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).
./mgit bundle --list-lua-modulesand
mgit bundle --list-alibsand 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/mysql.soin the directory of your exe and it should work. But it won't be a single exe deployment quite obviously :)