On 08/30/2014 09:50 AM, Steven Degutis wrote:
I can't for the life of me figure this out. Here's the module I'm trying to create a rockspec: https://github.com/mjolnir-io/mjolnir-keycodes It's a really simple module. It's just a Lua file and a C file that the Lua file requires. Nothing out of the ordinary. The only strange things this C file needs are `CFLAGS += -fobjc-arc -Wall -Wextra` and `LDFLAGS += -framework Cocoa -framework Carbon`. Ideally I'd like to use the `builtin` back-end according to the [Rockspec format](http://luarocks.org/en/Rockspec_format), but I don't think that works with this. Now, all of the above is strictly about trying to fix the current [mjolnir-keycodes-0.1-1.rockspec](https://github.com/mjolnir-io/mjolnir-keycodes/blob/master/mjolnir-keycodes-0.1-1.rockspec) file. What I have in the repo right now will *technically* build and install. But when I try `k = require 'mj.keycodes'`, it fails saying `module 'mj.keycodes.internal' not found` (which is referring to [this line](https://github.com/mjolnir-io/mjolnir-keycodes/blob/master/keycodes.lua#L17) inside `keycodes.lua`). This means it's actually loading the Lua module, but it's not registering the file correctly. Thus I'm pretty sure it's related to the `.rockspec` file not being written correctly. Technically the file is missing also: ~~~ $ ls -la /usr/local/share/lua/5.1/mj/ total 8 drwxr-xr-x 3 sdegutis admin 102B Aug 29 18:01 . drwxr-xr-x 7 sdegutis admin 238B Aug 29 18:01 .. -rw-r--r-- 1 sdegutis admin 1.2K Aug 29 18:01 keycodes.lua ~~~ But that's not the only problem. I'm also probably referencing it wrongly inside the `.rockspec` file. And on top of that, it probably contains the wrong `luaopen_*` name internally. If anyone here has experience with this, could you shed a bit of light on what I'm missing here? Thanks for your time. -Steven
what does the output of `luarocks make` command look like? luarocks should have given the commands it executed during the building process. check it first to see whether the library is properly built, and how those object files and library file are named. I don't use macos, but I suppose if the module is `mj.keycodes.internal', the library file should be named `internal.so` and should be installed onto the path `/usr/local/share/lua/5.1/mj/keycodes/internal.so', and the entry point function should be named `luaopen_mj_keycodes_internal' I checked your rockspec file, but I couldn't figure out the reason why the module was not properly installed. I can't build your module on my Linux system, but I played with some toy code [attached] with a rockspec that is almost identical to your rockspec, and it all goes well on my system: ~~~~ pzc@pzc-laptop ~/w/p/toy> uname -a Linux pzc-laptop 3.11.10-21-desktop #1 SMP PREEMPT Mon Jul 21 15:28:46 UTC 2014 (9a9565d) i686 i686 i386 GNU/Linux pzc@pzc-laptop ~/w/p/toy> luarocks make gcc -O2 -fPIC -I/usr/include -c toy-core-entrypoint.c -o toy-core-entrypoint.o gcc -shared -o toy/core.so -L/usr/lib toy-core-entrypoint.o Updating manifest for /home/pzc/.local/lib/luarocks/rocks toy 0.1-1 is now built and installed in /home/pzc/.local (license: MIT) pzc@pzc-laptop ~/w/p/toy> lua -l toy < /dev/null loading module 'toy'... loading module `toy.core'... loaded module 'toy.core' loaded module 'toy'. Lua 5.2.2 Copyright (C) 1994-2013 Lua.org, PUC-Rio ~~~~ --------------------
Attachment:
toy.tgz
Description: application/compressed-tar