GithubHelp home page GithubHelp logo

Comments (14)

ivnsch avatar ivnsch commented on May 24, 2024

Thanks for reporting! It seems that I forgot the step with installing the toolchain compatible with Xcode. Can you try it out, following the steps here: https://github.com/getditto/rust-bitcode

Pay attention to the name of the installed toolchain. Currently you'd have to use +ios-arm64-1.46.0

If it works I'll update the readme.

from rust_android_ios.

AxelNilsson avatar AxelNilsson commented on May 24, 2024

Hey!

Sorry for not getting back to you sooner but the issue I got seems like it should be something I could fix but I haven't solved it yet.

This is my output (All I have done is installed rust-bitcode and changed

-RUSTFLAGS="-Z embed-bitcode" cargo +ios-arm64 build --target aarch64-apple-ios --release --lib
+RUSTFLAGS="-Z embed-bitcode" cargo +ios-arm64-1.46.0 build --target aarch64-apple-ios --release --lib

Output

+ RUSTFLAGS='-Z embed-bitcode'
+ cargo +ios-arm64-1.46.0 build --target aarch64-apple-ios --release --lib
error: no such subcommand: `+ios-arm64-1.46.0`
+ cargo build --target=x86_64-apple-ios --release
   Compiling libc v0.2.60
   Compiling log v0.4.8
   Compiling core-foundation-sys v0.6.2
   Compiling cfg-if v0.1.9
error[E0463]: can't find crate for `core`
  |
  = note: the `x86_64-apple-ios` target may not be installed

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: could not compile `cfg-if`

If I only run cargo build --target=x86_64-apple-ios --release in the ios_app-folder it compiles fine.

Any suggestions?

from rust_android_ios.

ivnsch avatar ivnsch commented on May 24, 2024

Does cargo +ios-arm64-1.46.0 build --target aarch64-apple-ios --release --lib work in the terminal?

Did you confirm that it is installed? ls ~/.rustup/toolchains

from rust_android_ios.

AxelNilsson avatar AxelNilsson commented on May 24, 2024

Yes it works and there is a ios-arm64-1.46.0 folder in ~/.rustup/toolchains.

from rust_android_ios.

ivnsch avatar ivnsch commented on May 24, 2024

I see now that the installation instructions of rust-bitcode were updated. The ones I followed for this project were these: https://github.com/getditto/rust-bitcode/tree/22d33bf50ca79390a34112f5f9ccd93ac46e2171

Don't have time right now to debug it. LMK if you figure it out, otherwise I look into it in the next couple of days.

from rust_android_ios.

ivnsch avatar ivnsch commented on May 24, 2024

To test on the simulator you can comment the ios-arm64 line btw.

from rust_android_ios.

AxelNilsson avatar AxelNilsson commented on May 24, 2024

Using the latest instructions both cargo +ios-arm64-1.46.0 build --target aarch64-apple-ios --release --lib and cargo build --target=x86_64-apple-ios --release works in the terminal.

Maybe I'm doing something wrong earlier. I'll describe my exact flow.

$ git clone https://github.com/i-schuetz/rust_android_ios.git
$ cd rust_android_ios/ios_app
$ open ios_app.xcodeproj

Press Build and Run (a k a play)-button in XCode.

This is the output from XCode:

+ cd /Users/axel/rust_android_ios/ios_app/../
+ cargo build --target=x86_64-apple-ios --release
   Compiling core-foundation-sys v0.6.2
   Compiling libc v0.2.60
   Compiling log v0.4.8
   Compiling cfg-if v0.1.9
error[E0463]: can't find crate for `core`
  |
  = note: the `x86_64-apple-ios` target may not be installed

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: could not compile `cfg-if`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: linking with `cc` failed: exit code: 1

from rust_android_ios.

AxelNilsson avatar AxelNilsson commented on May 24, 2024

Could it be related to rust-bitcode now only running on stable?

Bitcode improvements have been incorporated upstream and an unstable -Z flag is no longer required when building a library with this toolchain. (In fact -Z must not be used.)

https://github.com/getditto/rust-bitcode/releases

from rust_android_ios.

AxelNilsson avatar AxelNilsson commented on May 24, 2024

It has to be a permissions or PATH-error.
I have tried manually linking in the script, didn't work. I have manually set the permissions to 755 for the ios-arm64-1.46.0-toolchain folder. As you can see rustup toolchain list shows us the toolchain...

I added some things to the script but it didn't help.

+ cd /Users/axel/rust_android_ios/ios_app/../
+ rustup override set stable
info: using existing install for 'stable-x86_64-apple-darwin'
info: override toolchain for '/Users/axel/rust_android_ios' set to 'stable-x86_64-apple-darwin'

  stable-x86_64-apple-darwin unchanged - rustc 1.49.0 (e1884a8e3 2020-12-29)

+ rustup toolchain list
stable-x86_64-apple-darwin (default) (override)
nightly-x86_64-apple-darwin
ios-arm64-1.46.0
1.48.0-x86_64-apple-darwin
+ cargo +ios-arm64-1.46.0 build --target aarch64-apple-ios --release --lib
error: no such subcommand: `+ios-arm64-1.46.0`
+ cargo build --target=x86_64-apple-ios --release
   Compiling libc v0.2.60
   Compiling log v0.4.8
   Compiling core-foundation-sys v0.6.2
   Compiling cfg-if v0.1.9
error[E0463]: can't find crate for `core`
  |
  = note: the `x86_64-apple-ios` target may not be installed

from rust_android_ios.

AxelNilsson avatar AxelNilsson commented on May 24, 2024

So I have confirmed that it's a PATH-issue. I manually ran all of the exports that XCode does and then I couldn't run the application in my terminal either.

from rust_android_ios.

AxelNilsson avatar AxelNilsson commented on May 24, 2024
  • Manually running the cargo steps
  • Commenting them out from the script
  • Updating the bridging header
  • Pressing play
    Works! 😄 The app is running now.

from rust_android_ios.

ivnsch avatar ivnsch commented on May 24, 2024

Great! PR?

from rust_android_ios.

AxelNilsson avatar AxelNilsson commented on May 24, 2024

Well I haven't solved the PATH-issue, I have only localized the problem to being that. Will try to solve it this weekend and submit a PR.

from rust_android_ios.

ineiti avatar ineiti commented on May 24, 2024

Thanks for the thread - I managed to get it up and running on my machine. The PR #5 should allow to have it run on other machines, too.

If you have time to verify it works, it might be a good addition to your wonderful project!

from rust_android_ios.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.