Skip to content

[native_toolchain_rust] Compilation error when adding a dependency #17

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

Closed
Rahiche opened this issue Aug 5, 2024 · 3 comments · Fixed by #18
Closed

[native_toolchain_rust] Compilation error when adding a dependency #17

Rahiche opened this issue Aug 5, 2024 · 3 comments · Fixed by #18

Comments

@Rahiche
Copy link

Rahiche commented Aug 5, 2024

I'm using native_toolchain_rust to create a package, the sample example in the repo builds with no issues.

I add any dependency (for example: image = "0.25.2") and it can no longer compile, and I'm trying to find where I can get the logs to debug the issue, any advice on how should I debug this.

Xcode build done.                                           15.4s
Failed to build iOS app
Error (Xcode): Building native assets for package:flutter_package failed.

Error (Xcode): linking with `cc` failed: exit status: 1

Error (Xcode): linker command failed with exit code 1 (use -v to see invocation)
/Users/raouf/Documents/GitHub/native_toolchain_rust/example/flutter_package/example/ios/%20%20%20%20%20%20%20%20%20%20clang:0:0

Error (Xcode): could not compile `rayon-core` (build script) due to 1 previous error

Error (Xcode): could not compile `proc-macro2` (build script) due to 1 previous error

Error (Xcode): could not compile `crossbeam-utils` (build script) due to 1 previous error

Error (Xcode): could not compile `anyhow` (build script) due to 1 previous error

Error (Xcode): could not compile `paste` (build script) due to 1 previous error

Error (Xcode): could not compile `thiserror` (build script) due to 1 previous error

Could not build the application for the simulator.
Error launching application on iPhone 15 Pro.

To reproduce just update cargo.toml, flutter clean and then build again:

[package]
name = "flutter_ffi_plugin"
version = "0.1.0"
edition = "2021"

[lib]
crate-type = ["cdylib"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
image = "0.25.2"
@knopp
Copy link
Contributor

knopp commented Aug 5, 2024

Yeah, this fails when compiling the build.rs from dependency crates for host. I think it is caused by XCode putting things from /Content/Developer into PATH. I remember dealing with this in cargokit, I'll need to do same thing here.

@knopp
Copy link
Contributor

knopp commented Aug 5, 2024

Still would be nice to figure out why the relevant error is only present in verbose log at a completely different spot.

@knopp
Copy link
Contributor

knopp commented Aug 5, 2024

Should be fixed in 0.1.0-dev.5.

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

Successfully merging a pull request may close this issue.

2 participants