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

macOS M1 building for iOS Simulator, but linking in object file built for iOS, for architecture arm64 #58

Open
jkelleyrtp opened this issue Dec 26, 2021 · 3 comments

Comments

@jkelleyrtp
Copy link

jkelleyrtp commented Dec 26, 2021

I can't seem to build for the simulator using the template generated for macOS m1.

I tried to change the x86_64 target to aarch64 but then ran into:

building for iOS Simulator, but linking in object file built for iOS, for architecture arm64

I haven't quite figured out the right way of getting things to build, but at the very least, the template is busted for m1.

As an aside: thank you for doing all this work. It's pretty amazing. Happy holidays!

@woelper
Copy link

woelper commented Jan 7, 2022

I noticed a similar error on Intel Mac too, XCode 13.2.1:

  = note: ld: building for iOS Simulator, but linking in .tbd built for macOS/Mac Catalyst, file '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libresolv.tbd' for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
          

error: could not compile `myapp` due to previous error
[2022-01-07T13:22:59Z INFO  cargo_mobile::util::cli] exiting with CompileLibFailed(
        CargoBuildFailed(
            Error {
                command: "cargo build --package myapp --manifest-path /Users/johann/repos/myapp/Cargo.toml --target x86_64-apple-ios --color auto",
                cause: CommandFailed(
                    ExitStatus(
                        unix_wait_status(
                            25856,
                        ),
                    ),
                ),
            },
        ),
    )
error: Failed to run `cargo build`

I've tried excluding arm64 on this machine, but with no result. It did work before XCode decided to upgrade to 13.2.1.

This is only on Simulator builds, a normal attached device works fine.

@lucasfernog
Copy link

I'm facing an issue that I think might be related.

ld: warning: directory not found for option '-L/Users/project-name/target/x86_64-apple-ios/debug'
ld: library not found for -lproject_name
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I think it should be building arm instead of x86_64, idk what's going on.

@jkelleyrtp
Copy link
Author

For anyone following this - I've figured out how to get cargo-mobile working on M1 macs.

#81

I'd be happy to get some help on getting both x86 and aarch64 working in the same fork of cargo-moble.

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

3 participants