Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android & iOS Support #165

Open
crudbug opened this issue Apr 8, 2016 · 7 comments
Open

Android & iOS Support #165

crudbug opened this issue Apr 8, 2016 · 7 comments

Comments

@crudbug
Copy link

crudbug commented Apr 8, 2016

Is there any plans to support these platforms. ?

@zdevito
Copy link
Collaborator

zdevito commented Apr 28, 2016

I don't have anything currently planned, but I'd be willing to help someone who wanted to attempt doing it. Currently there are some issues with a straight port of Terra/Lua because iOS disallows JIT compilation, which Terra relies on.

@ArnCarveris
Copy link

@zdevito Mostly in development environment we use desktop for iOS deployment AOT is allowed, also there need try link libs done by saveobj if it possible.

@elliottslaughter
Copy link
Member

@crudbug Are you still interested in this?

@ghost
Copy link

ghost commented Mar 22, 2019

Support for these platforms would be nice, currently I use C with LuaJIT precisely because it's more portable than Terra.

@elliottslaughter
Copy link
Member

@MoorayJenkins I'm not sure what you mean. The main limiter with respect to portability for Terra is LuaJIT itself. In most cases LLVM has much broader platform support (with a couple of notable exceptions, like passing and returning arrays on the stack). E.g. we used Terra on a PPC64le machine recently, and the main "hiccup" was that LuaJIT doesn't support the platform, so we had to use #320 with PUC Lua. But that was mainly because we were forced to run the Terra compiler on the machine itself; if we were cross-compiling (which Terra already supports) we wouldn't have needed to do even that.

I don't know about e.g. binding to the Android or iOS APIs, but as far as generating .o files to link into larger applications, it should be pretty seamless. (Presumably since you're already using C, missing the JIT capability isn't a big deal for you, and you're already doing cross-compilation if you're targeting these devices.)

@ghost
Copy link

ghost commented Mar 24, 2019

@elliottslaughter I overlooked the cross compilation capability of Terra.

Has anyone actually attempted to see how portable a simple application can be made and what hassle is involved? Since the "build" system is somewhat unique. ie: some application running on x86-64 linux cross compiled to run on windows, android and ios. What's the hassle involved?

@elliottslaughter
Copy link
Member

If you're just compiling pure functions that are going to do math or whatever, it should be sufficient to just use the target feature of terralib.saveobj to spit out a .o that you can link however you want: http://terralang.org/api.html#targets

If you want to use platform APIs, then you'll need a full cross-compiling toolchain, which Terra doesn't supply. There might be some gotchas in terms of finding header files; you can add paths with INCLUDE_PATH but I'm not sure you take paths away, so it might be a little error-prone in that if you accidentally find a system header on the host you could miscompile.

I'm not sure how well these code paths have been exercised, so you might encounter some bitrot, but in theory the basic building blocks are in place to enable this sort of use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants