[Screeninvader] Janosh on Darwin

Jay Vaughan seclorum at icloud.com
Wed Apr 1 12:07:16 CEST 2015


I’ve spent the last day or so working on getting Janosh built and running on Darwin.

The branch is available here:  https://github.com/seclorum/Janosh/tree/janosh-on-darwin

What was needed to be done:

0. The codebase had to be prepared for compilation with clang++ on Darwin - it is still built with g++ on Linux, however.  So the Makefile was updated to accommodate this requirement, also so that on OSX, the dependencies for Janosh can be administered with homebrew.  pkg-config is used to find these dependencies - probably a bit more work should be done on using pkg-config by the build system.  Probably, also, build_dependencies.sh should be replaced with platform tools for the job.

1. The method of embedding Lua byte code into the janosh binary changed - its no longer using objcopy, but rather luajit-compiled byte code is generated with the build system, and linked with the rest of the Janosh build objects.  This required a change to the way the bytecode was located and loaded by lua_script.cpp.

2. Amirs’ customization of easylogging++ was moved out of the easylogging++.h header and into the logger.cpp module - which means that we can safely upgrade easylogging in the future.  I also upgraded the existing easylogging++.h to the latest version - Janosh was previously using v9.45 (old) and so we upgraded to v9.80.  This was needed so that we could get bug fixes and upgrades from the Easylogging folks, which fixed compiling/using it with clang.

3. Minor, but util.cpp was updated with Darwin-specific options for grabbing argv[]’s.  This is not correct yet, but is a sufficient workaround to get things built - the Darwin implementation doesn’t allow the args[] to be grabbed for other pids, but since this is a debug-only feature, it shouldn’t impact anything - I made an issue to track this, and if I figure out a way to get the args-per-pid on Darwin, I’ll add to it.

4. Janosh has a dependency on lua-lanes, which was previously being built/installed manually (by Amir) on his system, due to a patch required to work around bugs on 64bit OS’s.  This bug is long fixed in the new version of lanes, so now custom/tweaked version of lua-lanes is required - its possible to just install it from the latest sources and it should now just work fine.  Probably build_dependencies.sh should be updated to include this step, so that it doesn’t get missed.

5. I added testLuaScript.lua to the project, to test the onboard Lua module loading and limited functionality - this came from Amir and per him, if it runs, then Janosh’ Lua functionality should be working.  I’ve added a dump of _G (Lua global table) to the script so that the presence of the loaded Lua bytecode can be confirmed easily enough - probably this should be expanded to be a ‘standard test’ for the onboard Lua VM at some point.

6. I’ve run all of this (in the janosh-on-darwin branch) on both Linux and Darwin systems - and it appears that the Linux version works just fine - i.e. its possible to merge this branch now and it should not impact further upstream work which depends on Janosh.  It would be good to merge this to master soon, as I perceive that more work is being done on Janosh concurrently.  I have *not* yet managed to confirm that this is working properly on Darwin at the moment, because of a crash loading the lua-lanes module - this may be a side-effect of hacking around with building the previous version of lanes, with the patch, on my system - I will do a fresh install of lua-lanes and then test Janosh again today.  But please Amir, consider merging the work so far on janosh-on-darwin so that we don’t get further out of sync with regards to changes to Janosh that you are doing further upstream to support ScreenInvader - I believe that it should now not be in a state that will impact running Janosh on Linux any more.

If you want to test Janosh on Darwin for me, it would be great.  You need to:

1. Install the dependencies with homebrew.
2. Install lua-lanes from source (no patch required, just the current version).
3. Run the build_dependencies.sh script in the Janosh repo, to set up the lua components required.
4. Build Janosh (normal way: make -j, etc.)
5. Test the produced ./janosh binary: “./janosh -d & ; ./janosh -f testLuaScript.lua” and observe output equivalent to that which occurs when you do all of the above on Linux.

If you notice anything, let me know and I’ll fix it.  I’d like to get Janosh building/functioning equivalently on Linux and Darwin as soon as possible, so I can move on to using Janosh for .. other things ..

;
--
Jay Vaughan
seclorum at icloud.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.metalab.at/pipermail/screeninvader/attachments/20150401/f22c05ab/attachment.sig>


More information about the Screeninvader mailing list