Skip to content

Adding other (Lua-only) libraries? #30

@lazerwalker

Description

@lazerwalker

Hi!

I'm trying to add some third-party libraries that have no C code or cmake compilation step, only Lua code (in my case: nngraph, optim, and their subdependencies, so I can sample a pre-trained char-rnn dataset).

Given that they don't have C code and thus don't generate static libraries, the only thing I've figured out to do with them is dump them in my /framework/lua folder, and load them as appropriate in Torch.m, as well as evaluate their init.lua files at runtime (see this gist, modified from this example repo).

A minor problem with this is that it requires I manually go into each init.lua file (and a few others) and manually wrap require calls in if foo == nil checks (as recommended in this blog post associated with the example repo above). Not a deal-breaker, but still feels like a code smell I'm taking the wrong approach.

More crucially, one library that requires xlua can't find it, despite the already-included image library being able to reference it just fine. Going down the rabbithole of manually including and initializing xlua at runtime (same deal, adding it to /framework/lua within the iOS project, and loading it within Torch.m and my TorchInterface.m), and then doing that recursively for each of its dependencies, eventually leads me to needing to include the paths library, which gives me compilation errors when I try to include it as part of the generate_ios_framework script.

Not being familiar with CMake or anything surrounding Lua (its require/package system, embedding it within iOS, etc), I'm very clearly in over my head. My instinct is that trying to get paths to build is too far deep in the yak shave, and there's an overall cleaner approach I should be taking, but darned if I know what it is.

It seems like this repo is relatively dormant, but figured I'd put a call out in case any of the maintainers or anyone else stumbling onto this has any thoughts or ideas.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions