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

cargo-mobile installation fails on newly released Apple Mac m1 #7

Open
nikhil-advait opened this issue Dec 15, 2020 · 6 comments
Open
Labels
host: macOS status: upstream It's not our fault for once type: bug Dang, that shouldn't have happened

Comments

@nikhil-advait
Copy link

Hello Francesca, Team,
Really appreciate your work. cargo-mobile is really good!

I tried to run cargo mobile on my apple MacBook Air m1 that has arm chip. I have rust 1.49 beta installed (which is natively supported for m1 via rustup, I haven't tested 1.49 beta intel version through rosetta though).

cargo install --git https://github.com/BrainiumLLC/cargo-mobile

Below is the error log -

   Compiling structopt v0.3.21
   Compiling toml v0.5.7
   Compiling path_abs v0.5.0
   Compiling handlebars v3.5.1
   Compiling bicycle v0.1.0 (https://github.com/BrainiumLLC/bicycle?rev=28080e0c6fa4067d9dd1b0f2b7322b6b32178e1f#28080e0c)
   Compiling cargo-mobile v0.1.0 (/Users/nikhil/.cargo/git/checkouts/cargo-mobile-b8b95f6242c7b8a6/d5a6ede)
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-arch" "arm64" "-L" "/Users/nikhil/.rustup/toolchains/beta-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-install38xKVF/release/deps/cargo_apple.cargo_apple.2mp5i5cw-cgu.0.rcgu.o" "/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-install38xKVF/release/deps/cargo_apple.cargo_apple.2mp5i5cw-cgu.1.rcgu.o" "/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-install38xKVF/release/deps/cargo_apple.cargo_apple.2mp5i5cw-cgu.10.rcgu.o" "/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-install38xKVF/release/deps/cargo_apple.cargo_apple.2mp5i5cw-cgu.11.rcgu.o" "/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-install38xKVF/release/deps/cargo_apple.cargo_apple.2mp5i5cw-cgu.12.rcgu.o" "/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-install38xKVF/release/deps/cargo_apple.cargo_apple.2mp5i5cw-cgu.13.rcgu.o" "/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-install38xKVF/release/deps/cargo_apple.cargo_apple.2mp5i5cw-cgu.14.rcgu.o" "/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-install38xKVF/release/deps/cargo_apple.cargo_apple.2mp5i5cw-cgu.15.rcgu.o" "/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-install38xKVF/release/deps/cargo_apple.cargo_apple.2mp5i5cw-cgu.2.rcgu.o" "/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-install38xKVF/release/deps/cargo_apple.cargo_apple.2mp5i5cw-cgu.3.rcgu.o" "/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-install38xKVF/release/deps/cargo_apple.cargo_apple.2mp5i5cw-cgu.4.rcgu.o" "/var/folders/b_/p49y76gj0fqcg9

Thanks,
Nikhil

@francesca64 francesca64 added host: macOS status: needs investigation Issue must be confirmed and researched type: bug Dang, that shouldn't have happened labels Dec 15, 2020
@francesca64
Copy link
Contributor

Thanks for reporting this!

Could you try cargo install -vv --git https://github.com/BrainiumLLC/cargo-mobile so we can get more info?

@nikhil-advait
Copy link
Author

nikhil-advait commented Dec 16, 2020

Seems like -vv flag does point to problem.
Please find below logs obtained after giving -vv flag:

[cargo-mobile 0.1.0] cargo:rerun-if-changed=/Users/nikhil/.cargo/git/checkouts/cargo-mobile-b8b95f6242c7b8a6/64d68a9/templates/apps/bevy-demo/.gitignore.hbs
[cargo-mobile 0.1.0] cargo:rerun-if-changed=/Users/nikhil/.cargo/git/checkouts/cargo-mobile-b8b95f6242c7b8a6/64d68a9/templates/apps/bevy-demo/src/lib.rs.hbs
[cargo-mobile 0.1.0] cargo:rerun-if-changed=/Users/nikhil/.cargo/git/checkouts/cargo-mobile-b8b95f6242c7b8a6/64d68a9/templates/apps/bevy.toml
     Running `CARGO=/Users/nikhil/.rustup/toolchains/beta-aarch64-apple-darwin/bin/cargo CARGO_CRATE_NAME=cargo_mobile CARGO_MANIFEST_DIR=/Users/nikhil/.cargo/git/checkouts/cargo-mobile-b8b95f6242c7b8a6/64d68a9 CARGO_PKG_AUTHORS='Brainium Studios LLC:Francesca Lovebloom <[email protected]>' CARGO_PKG_DESCRIPTION='Rust on mobile made easy'\!'' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE=Apache-2.0/MIT CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=cargo-mobile CARGO_PKG_REPOSITORY='https://github.com/BrainiumLLC/cargo-mobile' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' CARGO_PRIMARY_PACKAGE=1 DYLD_FALLBACK_LIBRARY_PATH='/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps:/Users/nikhil/.rustup/toolchains/beta-aarch64-apple-darwin/lib:/Users/nikhil/.rustup/toolchains/beta-aarch64-apple-darwin/lib:/Users/nikhil/lib:/usr/local/lib:/usr/lib' OUT_DIR=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/build/cargo-mobile-b9d377f423f0b8be/out rustc --crate-name cargo_mobile --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="default"' -C metadata=5c60297625325658 -C extra-filename=-5c60297625325658 --out-dir /var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps -L dependency=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps --extern bicycle=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libbicycle-501ec4aff0451ca4.rmeta --extern bossy=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libbossy-c0c947f8d4ccacee.rmeta --extern cocoa=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libcocoa-9f2fa012c102fdb3.rmeta --extern colored=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libcolored-4e35ee9c37a30fc3.rmeta --extern core_foundation=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libcore_foundation-d0506f383406caef.rmeta --extern deunicode=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libdeunicode-03147bd6e397a686.rmeta --extern english_numbers=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libenglish_numbers-c659f064626f835b.rmeta --extern env_logger=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libenv_logger-caf0ebef84452066.rmeta --extern heck=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libheck-88b67f7bb8883566.rmeta --extern home=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libhome-e93e586616c73b2d.rmeta --extern ignore=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libignore-ca9689071b392dbf.rmeta --extern indexmap=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libindexmap-749d133e26f6bd62.rmeta --extern java_properties=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libjava_properties-4c0cd86c5983bea1.rmeta --extern log=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/liblog-16302f5ae92f6ee0.rmeta --extern objc=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libobjc-e5d69c2c5a8bed6e.rmeta --extern objc_id=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libobjc_id-7291f3197726fa90.rmeta --extern once_cell_regex=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libonce_cell_regex-19828580c88fb53b.rmeta --extern openssl=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libopenssl-e4cb617ad5e6f633.rmeta --extern path_abs=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libpath_abs-9a6bdd4dfc9781ba.rmeta --extern publicsuffix=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libpublicsuffix-9676e37b4094c1a8.rmeta --extern reserved_names=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libreserved_names-df8f876821ae56af.rmeta --extern serde=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libserde-3ee5fbb43b065b6d.rmeta --extern serde_json=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libserde_json-66bcfceb1ed1f0a5.rmeta --extern structopt=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libstructopt-e1303f2c7163bc75.rmeta --extern textwrap=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libtextwrap-9309173f45d6be88.rmeta --extern thiserror=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libthiserror-b42525098e85cb2e.rmeta --extern toml=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libtoml-87d7b460d1ad4b81.rmeta --extern yes_or_no=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libyes_or_no-1da0d74946941c20.dylib -L 'native=/usr/local/opt/[email protected]/lib'`
error: expected `,`, or `}`, found keyword `pub`
   --> src/util/mod.rs:138:49
    |
138 |     pub flavor: Option<(String, Option<String>)>
    |                                                 ^ help: try adding a comma: `,`

error: aborting due to previous error

error: could not compile `cargo-mobile`

Caused by:
  process didn't exit successfully: `CARGO=/Users/nikhil/.rustup/toolchains/beta-aarch64-apple-darwin/bin/cargo CARGO_CRATE_NAME=cargo_mobile CARGO_MANIFEST_DIR=/Users/nikhil/.cargo/git/checkouts/cargo-mobile-b8b95f6242c7b8a6/64d68a9 CARGO_PKG_AUTHORS='Brainium Studios LLC:Francesca Lovebloom <[email protected]>' CARGO_PKG_DESCRIPTION='Rust on mobile made easy'\!'' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE=Apache-2.0/MIT CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=cargo-mobile CARGO_PKG_REPOSITORY='https://github.com/BrainiumLLC/cargo-mobile' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' CARGO_PRIMARY_PACKAGE=1 DYLD_FALLBACK_LIBRARY_PATH='/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps:/Users/nikhil/.rustup/toolchains/beta-aarch64-apple-darwin/lib:/Users/nikhil/.rustup/toolchains/beta-aarch64-apple-darwin/lib:/Users/nikhil/lib:/usr/local/lib:/usr/lib' OUT_DIR=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/build/cargo-mobile-b9d377f423f0b8be/out rustc --crate-name cargo_mobile --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="default"' -C metadata=5c60297625325658 -C extra-filename=-5c60297625325658 --out-dir /var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps -L dependency=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps --extern bicycle=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libbicycle-501ec4aff0451ca4.rmeta --extern bossy=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libbossy-c0c947f8d4ccacee.rmeta --extern cocoa=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libcocoa-9f2fa012c102fdb3.rmeta --extern colored=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libcolored-4e35ee9c37a30fc3.rmeta --extern core_foundation=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libcore_foundation-d0506f383406caef.rmeta --extern deunicode=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libdeunicode-03147bd6e397a686.rmeta --extern english_numbers=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libenglish_numbers-c659f064626f835b.rmeta --extern env_logger=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libenv_logger-caf0ebef84452066.rmeta --extern heck=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libheck-88b67f7bb8883566.rmeta --extern home=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libhome-e93e586616c73b2d.rmeta --extern ignore=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libignore-ca9689071b392dbf.rmeta --extern indexmap=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libindexmap-749d133e26f6bd62.rmeta --extern java_properties=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libjava_properties-4c0cd86c5983bea1.rmeta --extern log=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/liblog-16302f5ae92f6ee0.rmeta --extern objc=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libobjc-e5d69c2c5a8bed6e.rmeta --extern objc_id=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libobjc_id-7291f3197726fa90.rmeta --extern once_cell_regex=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libonce_cell_regex-19828580c88fb53b.rmeta --extern openssl=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libopenssl-e4cb617ad5e6f633.rmeta --extern path_abs=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libpath_abs-9a6bdd4dfc9781ba.rmeta --extern publicsuffix=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libpublicsuffix-9676e37b4094c1a8.rmeta --extern reserved_names=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libreserved_names-df8f876821ae56af.rmeta --extern serde=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libserde-3ee5fbb43b065b6d.rmeta --extern serde_json=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libserde_json-66bcfceb1ed1f0a5.rmeta --extern structopt=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libstructopt-e1303f2c7163bc75.rmeta --extern textwrap=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libtextwrap-9309173f45d6be88.rmeta --extern thiserror=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libthiserror-b42525098e85cb2e.rmeta --extern toml=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libtoml-87d7b460d1ad4b81.rmeta --extern yes_or_no=/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM/release/deps/libyes_or_no-1da0d74946941c20.dylib -L 'native=/usr/local/opt/[email protected]/lib'` (exit code: 1)
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-mobile v0.1.0 (https://github.com/BrainiumLLC/cargo-mobile#64d68a93)`, intermediate artifacts can be found at `/var/folders/b_/p49y76gj0fqcg9gsgtywgk6m0000gn/T/cargo-installkmPmEM`

Caused by:
  build failed
nikhil@Nikhils-MacBook-Air ~ % 

Below is rustc version:

nikhil@Nikhils-MacBook-Air ~ % rustc -V
rustc 1.49.0-beta.4 (877c7cbe1 2020-12-10)
nikhil@Nikhils-MacBook-Air ~ % 

@nikhil-advait
Copy link
Author

nikhil-advait commented Dec 16, 2020

I fixed the compilation error locally for the mod.rs and tried to build carog-mobile locally. Later I debugged more and realised that this is dependencies issue.
Basically rustc is arch64 and to compile cargo-mobile we need openssl too which on my machine is intel x64 and hence it fails.
I think I should try with intel rust and see.

@francesca64 Please feel free to close the issue if you deem so. If I get any more info I will try to add in comment.
But I guess sooner or later somebody with Mac m1 may come here.

Thanks!

@francesca64
Copy link
Contributor

francesca64 commented Dec 16, 2020

Thanks for the details, and sorry about the compilation error! I pushed up a fix for that, along with CI to catch things like that.

As for openssl, there's fortunately already an upstream PR for this: sfackler/rust-openssl#1388

We're ordering an M1 Mac mini, so we'll be able to ensure M1 support soon.

@francesca64 francesca64 added status: upstream It's not our fault for once and removed status: needs investigation Issue must be confirmed and researched labels Dec 16, 2020
@triscuitcircuit
Copy link

I am currently experiencing an issue building on a M1 mac as well, but my error seems to be related to shaderc-sys v0.6.3, according to xcode. It says I dont have cmake installed even though I do, so it might just be caused from my setup.


warning: System installed library not found.  Falling back to build from source

error: failed to run custom build command for `shaderc-sys v0.6.3`

Caused by:
  process didn't exit successfully: `/Volumes/MacStorage/github/bevy-ios/target/debug/build/shaderc-sys-04f40a1eae86f043/build-script-build` (exit code: 101)
  --- stdout
  cargo:warning=System installed library not found.  Falling back to build from source

  --- stderr
  thread 'main' panicked at '

  couldn't find required command: "cmake"

@francesca64
Copy link
Contributor

@triscuitcircuit does anything discussed here help? bevyengine/bevy#928 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
host: macOS status: upstream It's not our fault for once type: bug Dang, that shouldn't have happened
Projects
None yet
Development

No branches or pull requests

3 participants