-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
some sort of iOS support #6170
Comments
further info on my attempt & stumbling blocks:-
i'm not even sure this is right yet, but it seems to compile something when doing make VERBOSE=1 It seems to run into not having "crt_externs.h" in the iphone includes which is something i've seen referenced - and I wonder if this points to areas of the rust runtime libraries needing functionality not provided in the iphone environment
|
on IRC, I was advised RED_ZONE_SIZE is a per-platform define needed in rt/rust_task.h
this helps it progress compiling more.. |
its trying to compile |
@dobkeratops in that file, try changing the LOAD macro to use =&r instead of =r. |
thanks; this seems to rust/rt/arch/arm/get gpr.cpp to work (removing the % register prefix aswell)
|
Next I appear to run into some assembly source that might need reworking:-
similar errors on subsequent lines:- (ccall.S)
are these assembly directives that the apple tools dont accept, I saw similar things that the apple tools didn't like from the android codegen attempt. I see arch/arm,x86_64 ... is it possible i'll need to add another implementation here specific to the iphone ABI? is it just some option for the assembler to get it to recognize those directives? EDIT: Seeme like the .align can be replaced with .align 4 .. the apple tools accept that. |
I'm told the above issues is due to Apple using "an ancient fork of the binutils assembler". |
attempting, to patch over those issues: i've commented out the unknown directives,
... apparently ldr rX,=VALUE is a pseudo instruction for generating constant-generation code, which apple dont support. messy. |
With those hacks in place, it gets as far trying to link. Linker errors:-
I suspect I have linker settings broken so its not trying to source these correctly perhaps.. its also warning me about unaligned functions , unsurprisingly |
linker invocation that does't work ...
|
I think its' compiling "libuv.a" incorrectly , it seems this is compiled from a generated makefile and I need to add a case for arm-apple-darwin there. |
nominating for maturity milestone #5: production ready. (I'm choosing a very conservative maturity target; reasonable people may argue for it to be assigned to "feature complete" instead.) |
My hacky modifications to mk/rt.mk - adding "apple-darwin" .. this is wrong i think though , it needs to test arm apple-darwin. also note the original comment, it seems the intention is to handle crossplatform here with flags instead of ifdefs.
|
team declined to accept this for a milestone |
tried various other permuations in rt.mk .. just passing the GCCISH_CFLAGS_... from platform.mk across but i only seem to break it :( |
Still relevant! |
I want to have another bash at this sometime - zero.rs might help?, but i'm just enjoying using the language for the minute and my mac is halfbroken(doesn't always power on / haven't replaced it yet.. ) |
zero.rs should definitely help with just getting it working. don't need to port the entire runtime etc. |
@dobkeratops thanks for your effort so far. My sparetime is tight. I'd be willing to donate some money though or help in any other way. |
@kud1ing have you tried putting a bounty on this issue at Bountysource?https://www.bountysource.com/issues/823097 |
I've created a Wiki page (https://github.com/mozilla/rust/wiki/Doc-building-for-ios) to track the steps. I had to adjust some steps for Xcode 5/iOS7. Others will be unnecessary since some portions of the C++ runtime are gone now. |
What are the chances that a commit would be accepted that adds only a subset of the necessary changes to make Rust cross-compile to iOS? Since we have support for Android/ARM, i don't think support for iOS/ARM is impossible, The description in https://github.com/mozilla/rust/wiki/Doc-building-for-ios#option-3-add-native-ios-support-to-rust starts to grow cumbersome. |
@kud1ing Incremental commits are not only welcome, but encouraged. If it's more approachable to break up the problem into several commits, then by all means do (so long as all tests pass each time, of course). |
This ticket can serve as the meta ticket for the remaining issues: https://github.com/mozilla/rust/issues?labels=A-iOS&milestone=13&page=1&state=open |
I'm also very interested in this. In case this helps, I've had some preliminary success compiling Rust code with The app successfully builds and runs on both the device and simulator, though some calls seem to crash on the simulator. I'll probably try to get it to work with rust-core next. |
@shilgapira: Awesome. I am happy that the route via emitting LLVM bitcode somewhat works. |
Likely fixed by #14715 |
This has been implemented. |
I've had some hacky,primitive attempts to get rust onto iOS, not really getting very far;
I would just like to call rust entry points from an objective-C main application , as is possible for a cross-platform C++ opengl|ES project - I dont intend to build complete iOS executables in Rust, or interact with the iOS objC SDK itself.
it might not even need the entire rust runtime to be useful - it would interface with custom crossplatform C wrappers for mobile apps (something like an iOS port of glfw), in particular wrapping touch input and acess to file bundles.
[Attempt1]:- Originally I had hoped I could generate C source via LLVM-IR, but it turns out that has bitrotted and no longer works;
[Attempt2]:- got ARM assembly source (rustc --emit-llvm -S --target=arm-linux-androideabi..) using the existing android support but this uses a different ABI (eabi versus apples' modified AAPCS). There seemed to be directives that i'm told relate to stacl unwinding for exceptions.
http://developer.apple.com/library/ios/#documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARMv6FunctionCallingConventions.html
[Attempt3]:- I was advised I needed to modify mk/platform.mk to add an "arm-apple-darwin" target triple - made a little progress at least getting it to call apple tools but ran into difficulties.. with this I would still intend to generate assembly source for inclusion in an apple xcode-project as with [attempt2]
I'm posting info on my attempts, any comments/information/assistance welcome.
I'm not an exert in apple frameworks/toolchain, but I've done a crossplatform C++ sourcebase across win/android/iOS/linux as described above.
The text was updated successfully, but these errors were encountered: