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

some sort of iOS support #6170

Closed
dobkeratops opened this issue May 2, 2013 · 28 comments
Closed

some sort of iOS support #6170

dobkeratops opened this issue May 2, 2013 · 28 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. E-hard Call for participation: Hard difficulty. Experience needed to fix: A lot. O-ios Operating system: iOS

Comments

@dobkeratops
Copy link

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.

@dobkeratops
Copy link
Author

further info on my attempt & stumbling blocks:-
This is the block of settings I tried adding to rust/mk/platform.mk, (between mac & android ..) which allowed me to ./configure with arm-apple-darwin ( I know this can be cleaned up..)

#arm-apple-darwin configuration for iOS
CFG_IOS_SDK=/Developer-3.2.6/Platforms/iPhoneOS.platform/Developer/usr
CFG_IOS_TOOLS=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin
CFG_IOS_FLAGS = -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/ -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/include/c++/4.2.1 -I/usr/include
CC_arm-apple-darwin= $(CFG_IOS_TOOLS)/arm-apple-darwin10-llvm-gcc-4.2
CXX_arm-apple-darwin= $(CFG_IOS_TOOLS)/arm-apple-darwin10-llvm-g++-4.2
CPP_arm-apple-darwin= $(CFG_IOS_TOOLS)/arm-apple-darwin10-llvm-g++-4.2
AR_arm-apple-darwin= $(CFG_IOS_TOOLS)/ar
CFG_LIB_NAME_arm-apple-darwin=lib$(1).dylib
CFG_LIB_GLOB_arm-apple-darwin=lib$(1)-*.dylib
CFG_LIB_DSYM_GLOB_arm-apple-darwin=lib$(1)-*.dylib.dSYM
CFG_GCCISH_CFLAGS_arm-apple-darwin := -Wall -Werror -g -fPIC $(CFG_IOS_FLAGS)
CFG_GCCISH_CXXFLAGS_arm-apple-darwin := -fno-rtti $(CFG_IOS_FLAGS)
CFG_GCCISH_LINK_FLAGS_arm-apple-darwin := -dynamiclib -lpthread -framework CoreServices -Wl,-no_compact_unwind 
CFG_GCCISH_DEF_FLAG_arm-apple-darwin := -Wl,-exported_symbols_list,
CFG_GCCISH_PRE_LIB_FLAGS_arm-apple-darwin :=
CFG_GCCISH_POST_LIB_FLAGS_arm-apple-darwin :=
CFG_DEF_SUFFIX_arm-apple-darwin := .darwin.def
CFG_INSTALL_NAME_arm-apple-darwin = -Wl,-install_name,@rpath/$(1)
CFG_LIBUV_LINK_FLAGS_arm-apple-darwin =
CFG_EXE_SUFFIX_arm-apple-darwin :=
CFG_WINDOWSY_arm-apple-darwin :=
CFG_UNIXY_arm-apple-darwin := 1
CFG_PATH_MUNGE_arm-apple-darwin := true
CFG_LDPATH_arm-apple-darwin :=
CFG_RUN_arm-apple-darwin=$(2)
CFG_RUN_TARG_arm-apple-darwin=$(call CFG_RUN_arm-apple-darwin,,$(2))

i'm not even sure this is right yet, but it seems to compile something when doing make VERBOSE=1
some info I used r.e. which compiler & settings to select
http://stackoverflow.com/questions/7473246/compile-an-ios-objective-c-command-line-app-through-gcc-on-mac

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
these are some of the compile errors cut/paste:-
i got it to source "crt_externs" by adding "-I/usr/include" although this seems to point to a problam that will appear elsewhere

../rust_run_program.cpp:15:25: error: crt_externs.h: No such file or directory
../rust/src/rt/rust_task.h: In function ‘size_t user_stack_size(stk_seg*)’:
../rust/src/rt/rust_task.h:552: error: ‘RED_ZONE_SIZE’ was not declared in this scope
../rust/src/rt/rust_task.h: In member function ‘void rust_task::record_stack_limit()’:
../rust/src/rt/rust_task.h:606: error: ‘RED_ZONE_SIZE’ was not declared in this scope
../gplsrc/rust/src/rt/rust_task.h: In function ‘rust_task* rust_try_get_current_task()’:

@dobkeratops
Copy link
Author

on IRC, I was advised RED_ZONE_SIZE is a per-platform define needed in rt/rust_task.h

#ifdef __APPLE__
..
#ifdef __arm__
#define RED_ZONE_SIZE RZ_MAC_32
#endif

this helps it progress compiling more..

@dobkeratops
Copy link
Author

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-g++-4.2  -DRUST_NDEBUG -fno-omit-frame-pointer -O2  -Wall -Werror -g -fPIC -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/ -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/include/c++/4.2.1 -I/usr/include -fno-rtti -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/ -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/include/c++/4.2.1 -I/usr/include -MMD -MP -MT  rt/arm-apple-darwin/arch/arm/gpr.o -MF rt/arm-apple-darwin/arch/arm/gpr.d -c -o  rt/arm-apple-darwin/arch/arm/gpr.o  -I ~/rust/src/rt -I ~/rust/src/rt/isaac -I ~/rust/src/rt/uthash -I .../rust/src/rt/arch/arm -I ~/rust/src/rt/linenoise -I ~/rust/src/libuv/include  ~/rust/src/rt/arch/arm/gpr.cpp
/var/folders/l_/9rdx5d4566g29s90r8zbyb7h0000gn/T//ccDLG6jU.s:38:ARM register expected -- `mov %r0,r1'
/var/folders/l_/9rdx5d4566g29s90r8zbyb7h0000gn/T//ccDLG6jU.s:42:ARM register expected -- `mov %r9,r2'
/var/folders/l_/9rdx5d4566g29s90r8zbyb7h0000gn/T//ccDLG6jU.s:46:ARM register expected -- `mov %r10,r3'
/var/folders/l_/9rdx5d4566g29s90r8zbyb7h0000gn/T//ccDLG6jU.s:50:ARM register expected -- `mov %r11,r12'
/var/folders/l_/9rdx5d4566g29s90r8zbyb7h0000gn/T//ccDLG6jU.s:54:ARM register expected -- `mov %r12,lr'
/var/folders/l_/9rdx5d4566g29s90r8zbyb7h0000gn/T//ccDLG6jU.s:58:ARM register expected -- `mov %r13,r4'
/var/folders/l_/9rdx5d4566g29s90r8zbyb7h0000gn/T//ccDLG6jU.s:62:ARM register expected -- `mov %r14,r5'
/var/folders/l_/9rdx5d4566g29s90r8zbyb7h0000gn/T//ccDLG6jU.s:66:ARM register expected -- `mov %r15,r6'

its trying to compile
~/rust/src/rt/arch/arm/gpr.cpp ? with some inline asm there perhaps ?
i heard there was some asm source in the rust runtime, but quite what this is i'm not sure, and its possibly looking for an alternate ASM syntax

@Aatch
Copy link
Contributor

Aatch commented May 2, 2013

@dobkeratops in that file, try changing the LOAD macro to use =&r instead of =r.

Source: http://stackoverflow.com/questions/11696232/gcc-error-message-for-arm-inline-assembly-arm-register-expected

@dobkeratops
Copy link
Author

thanks; this seems to rust/rt/arch/arm/get gpr.cpp to work (removing the % register prefix aswell)

#include "gpr.h"

#if defined(__APPLE__) && defined(__arm__)
#define LOAD(rn) do { \
    uintptr_t tmp; \
    asm("mov " #rn ",%0" : "=&r" (tmp) :); \
    this->rn = tmp; \
} while (0)
#else
...// as before..
#endif

@dobkeratops
Copy link
Author

Next I appear to run into some assembly source that might need reworking:-
_context.S

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-g++-4.2 -E -MMD -MP -MT rt/arm-apple-darwin/arch/arm/_context.o -MF rt/arm-apple-darwin/arch/arm/_context.d ~/rust/src/rt/arch/arm/_context.S | ~/rust/llvm/x86_64-apple-darwin/Release+Asserts/bin/llvm-mc -assemble -filetype=obj -triple=arm-apple-darwin -o=rt/arm-apple-darwin/arch/arm/_context.o
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-g++-4.2 -E -MMD -MP -MT rt/arm-apple-darwin/arch/arm/ccall.o -MF rt/arm-apple-darwin/arch/arm/ccall.d ~/rust/src/rt/arch/arm/ccall.S | /Users/walterlynsdale/gplsrc/rust/llvm/x86_64-apple-darwin/Release+Asserts/bin/llvm-mc -assemble -filetype=obj -triple=arm-apple-darwin -o=rt/arm-apple-darwin/arch/arm/ccall.o
~/rust/src/rt/arch/arm/_context.S:4:7: error: unknown token in expression
.align
      ^
make: *** [rt/arm-apple-darwin/arch/arm/_context.o] Error 1

similar errors on subsequent lines:- (ccall.S)

.hidden __morestack
.type __morestack, %function
.save {r4,fp,lr}
.movesp r4
.fnend

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.

@dobkeratops
Copy link
Author

I'm told the above issues is due to Apple using "an ancient fork of the binutils assembler".

@dobkeratops
Copy link
Author

attempting, to patch over those issues: i've commented out the unknown directives,
there are some constant-generation instructions record_sp.S

//ldr r7=345 // replace with..  
mov r7,345&0xff   
 orr r7,345&0xff00      
//ldr r1,=my_array //replace with..
 mov r1,my_array

... apparently ldr rX,=VALUE is a pseudo instruction for generating constant-generation code, which apple dont support. messy.
this at least lets it assemble all the sources, but i'd worry they've been damaged .. assembler is not exactly robust in the face of randomly commenting things out...

@dobkeratops
Copy link
Author

With those hacks in place, it gets as far trying to link. Linker errors:-

    (maybe you meant: _rust_uv_strerror)
  "_strlen", referenced from:
      tm_to_rust_tm(tm*, rust_tm*, int, char const*, int)in rust_builtin.o
      _rust_localtime in rust_builtin.o
      load_env(int, char**)in rust_env.o
      update_entry(mod_entry const*, void*)in rust_log.o
      update_log_settings(void*, char*)in rust_log.o
      append_string(char*, char const*, ...)in rust_log.o
      _remove_char in linenoise.o
      ...
  "_strncmp", referenced from:
      update_entry(mod_entry const*, void*)in rust_log.o
  "_strncpy", referenced from:
      load_env(int, char**)in rust_env.o
      copy_string(char*, char const*, unsigned long)in rust_log.o
      update_log_settings(void*, char*)in rust_log.o
      _linenoise in linenoise.o
  "_strstr", referenced from:
      _linenoise in linenoise.o


  "_uv_write", referenced from:
      _rust_uv_write in rust_uv.o
     (maybe you meant: _rust_uv_helper_uv_write_t_size, _rust_uv_write )
  "_vsnprintf", referenced from:
      append_string(char*, char const*, ...)in rust_log.o
      rust_log::log(rust_task*, unsigned int, char const*, ...)in rust_log.o
      rust_kernel::fatal(char const*, ...)in rust_kernel.o
      rust_kernel::log(unsigned int, char const*, ...)in rust_kernel.o
      _fd_printf in linenoise.o
  "_write", referenced from:
      _fd_printf in linenoise.o
      _insert_char in linenoise.o
      _refreshLine in linenoise.o
     (maybe you meant: _rust_uv_helper_uv_write_t_size, _rust_uv_write , _rust_uv_get_stream_handle_from_write_req )
ld: symbol(s) not found for architecture armv7
collect2: ld returned 1 exit status
make: *** [rt/arm-apple-darwin/librustrt.dylib] Error 1

I suspect I have linker settings broken so its not trying to source these correctly perhaps.. its also warning me about unaligned functions , unsurprisingly

@dobkeratops
Copy link
Author

linker invocation that does't work ...

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-g++-4.2  -o rt/arm-apple-darwin/librustrt.dylib -dynamiclib -lpthread -framework CoreServices -Wl,-no_compact_unwind
  -Wl,-exported_symbols_list,rt/rustrt.darwin.def  rt/arm-apple-darwin/sync/timer.o rt/arm-apple-darwin/sync/lock_and_signal.o rt/arm-apple-darwin/sync/rust_thread.o rt/arm-apple-darwin/rust.o
 rt/arm-apple-darwin/rust_builtin.o rt/arm-apple-darwin/rust_run_program.o rt/arm-apple-darwin/rust_env.o
 rt/arm-apple-darwin/rust_rng.o rt/arm-apple-darwin/rust_sched_loop.o rt/arm-apple-darwin/rust_sched_launcher.o
 rt/arm-apple-darwin/rust_sched_driver.o rt/arm-apple-darwin/rust_scheduler.o rt/arm-apple-darwin/rust_sched_reaper.o
 rt/arm-apple-darwin/rust_task.o rt/arm-apple-darwin/rust_stack.o rt/arm-apple-darwin/rust_upcall.o
 rt/arm-apple-darwin/rust_uv.o rt/arm-apple-darwin/rust_crate_map.o rt/arm-apple-darwin/rust_log.o
 rt/arm-apple-darwin/rust_gc_metadata.o rt/arm-apple-darwin/rust_util.o rt/arm-apple-darwin/rust_exchange_alloc.o
 rt/arm-apple-darwin/isaac/randport.o rt/arm-apple-darwin/miniz.o rt/arm-apple-darwin/rust_kernel.o
 rt/arm-apple-darwin/rust_abi.o rt/arm-apple-darwin/rust_debug.o rt/arm-apple-darwin/memory_region.o
 rt/arm-apple-darwin/boxed_region.o rt/arm-apple-darwin/arch/arm/context.o rt/arm-apple-darwin/arch/arm/gpr.o
 rt/arm-apple-darwin/rust_android_dummy.o rt/arm-apple-darwin/linenoise/linenoise.o rt/arm-apple-darwin/linenoise/utf8.o
 rt/arm-apple-darwin/arch/arm/_context.o rt/arm-apple-darwin/arch/arm/ccall.o rt/arm-apple-darwin/arch/arm/record_sp.o
  rt/arm-apple-darwin/libuv/libuv.a
  -Wl,-install_name,@rpath/librustrt.dylib
ld: warning: ld: warning: ignoring file /usr/lib/dylib1.o,
 missing required architecture armv7 in file /usr/lib/dylib1.o
 (2 slices)ignoring file /usr/lib/libpthread.dylib, 
missing required architecture armv7 in file /usr/lib/libpthread.dylib (2 slices)

@dobkeratops
Copy link
Author

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.
I've tried fumbling around a bit more with that but have been running into more missing directories, CFRunLoop related ...

@pnkfelix
Copy link
Member

pnkfelix commented May 2, 2013

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.)

@dobkeratops
Copy link
Author

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.

# XXX: Shouldn't need platform-specific conditions here
ifdef CFG_WINDOWSY_$(1)
$$(LIBUV_LIB_$(1)): $$(LIBUV_DEPS)
    $$(Q)$$(MAKE) -C $$(S)src/libuv/ \
        builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/libuv" \
        OS=mingw \
        V=$$(VERBOSE)
else ifeq ($(OSTYPE_$(1)), linux-androideabi)
$$(LIBUV_LIB_$(1)): $$(LIBUV_DEPS)
    $$(Q)$$(MAKE) -C $$(S)src/libuv/ \
        CFLAGS="$$(LIBUV_FLAGS_$$(HOST_$(1))) $$(SNAP_DEFINES)" \
        LDFLAGS="$$(LIBUV_FLAGS_$$(HOST_$(1)))" \
        CC="$$(CC_$(1))" \
        CXX="$$(CXX_$(1))" \
        AR="$$(AR_$(1))" \
        BUILDTYPE=Release \
        builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/libuv" \
        host=android OS=linux \
        V=$$(VERBOSE)
## MY HACKS START HERE >>>>>>>>>
else ifeq ($(OSTYPE_$(1)), apple-darwin)
$$(LIBUV_LIB_$(1)): $$(LIBUV_DEPS)
    echo @COMPILING LIBUV FOR ARM-APPLE-DARWIN NOT INTENDED FOR MAC , JUST IOS
    echo $$(CC_$(1))  $$(CXX_$(1)) $$(AR_$(1))
    CFG_IOS_CF=$$(CFG_IOS_DEV)/SDKs/iPhone6.1sdk/System/Library/Frameworks/CoreFoundation.framework
    #exit(1)
    $$(Q)$$(MAKE) -C $$(S)src/libuv/ \
        CFLAGS="$$(CFG_IOS_FLAGS) $$(CFG_IOS_CF)  $$(LIBUV_FLAGS_$$(HOST_$(1))) $$(SNAP_DEFINES)" \
        LDFLAGS="$$(CFG_GCCISH_LINK_FLAGS_arm-apple-darwin) $$(LIBUV_FLAGS_$$(HOST_$(1)))" \
        CC="$$(CC_$(1))" \
        CXX="$$(CXX_$(1))" \
        AR="$$(AR_$(1))" \
        BUILDTYPE=Release \
        builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/libuv" \
        host=darwin OS=darwin \
        V=$$(VERBOSE)
## <<<<<<< MY HACKS END HERE
else
$$(LIBUV_LIB_$(1)): $$(LIBUV_DEPS)
      ####>>>>>> I dont think this was getting the cross-compile tools passed before..
    $$(Q)$$(MAKE) -C $$(S)src/libuv/ \
        CFLAGS="$$(LIBUV_FLAGS_$$(HOST_$(1))) $$(SNAP_DEFINES)" \
        builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/libuv" \
        V=$$(VERBOSE)
endif

@graydon
Copy link
Contributor

graydon commented May 2, 2013

team declined to accept this for a milestone

@dobkeratops
Copy link
Author

tried various other permuations in rt.mk .. just passing the GCCISH_CFLAGS_... from platform.mk across but i only seem to break it :(

@emberian
Copy link
Member

Still relevant!

@dobkeratops
Copy link
Author

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.. )

@emberian
Copy link
Member

zero.rs should definitely help with just getting it working. don't need to port the entire runtime etc.

@kud1ing
Copy link

kud1ing commented Aug 9, 2013

@dobkeratops thanks for your effort so far.
The perspective of writing the core logic of iOS/Android apps in portable Rust would be amazing.

My sparetime is tight. I'd be willing to donate some money though or help in any other way.

@vivorisataamore
Copy link

@kud1ing have you tried putting a bounty on this issue at Bountysource?https://www.bountysource.com/issues/823097

@kud1ing
Copy link

kud1ing commented Oct 29, 2013

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.

@kud1ing
Copy link

kud1ing commented Oct 31, 2013

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,
I am not done yet, but i am confident that there is no way around the changes in mk/platform.mk and src/rt/rust_builtin.cpp.
So i'd like to lock in this additions.

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.

@catamorphism
Copy link
Contributor

@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).

@kud1ing
Copy link

kud1ing commented Jan 5, 2014

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

@shilgapira
Copy link

I'm also very interested in this.

In case this helps, I've had some preliminary success compiling Rust code with #[no_std] into a universal iOS static library (armv7, armv7s, i386) and integrating it into an iOS app. I've opened a repo with the Rust code and an iOS Xcode project here: https://github.com/shilgapira/ObjCrust

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.

@kud1ing
Copy link

kud1ing commented Jan 14, 2014

@shilgapira: Awesome. I am happy that the route via emitting LLVM bitcode somewhat works.
I've tried to make Rust cross-compile to iOS/ARM. Some low-level issues are to be solved, as documented on the Wiki page and in the issues.

@kud1ing
Copy link

kud1ing commented Jun 17, 2014

Likely fixed by #14715

@thestinger
Copy link
Contributor

This has been implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. E-hard Call for participation: Hard difficulty. Experience needed to fix: A lot. O-ios Operating system: iOS
Projects
None yet
Development

No branches or pull requests

10 participants