fzyzcjy / flutter_rust_bridge

Flutter/Dart <-> Rust binding generator, feature-rich, but seamless and simple.
https://fzyzcjy.github.io/flutter_rust_bridge/
MIT License
4.27k stars 300 forks source link

[Bug] Build Failed (fatal error: lipo: can't open input file: (No such file or directory) #1438

Closed yuhaya closed 10 months ago

yuhaya commented 11 months ago

Describe the bug

According to the https://cjycode.com/flutter_rust_bridge/integrate/ios.html tutorial, after all steps are completed, execute flutter build macos and an error will be reported. It seems that native.dylib cannot be generated.

  • tr '\n' '\0'
  • xargs -0 lipo -create -output /Users/rustyu/Documents/whatscrm_desktop_lite/build/macos/Build/Products/Release/native.dylib fatal error: lipo: can't open input file: (No such file or directory

Codegen logs with RUST_LOG=debug environment variable

RUST_LOG=debug flutter build macos

--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00008103-001C181E26DA001E }
{ platform:macOS, arch:x86_64, id:00008103-001C181E26DA001E }
+ export PATH=/Users/rustyu/.cargo/bin:/Applications/Xcode.app/Contents/Developer/Library/Xcode/Plug-ins/XCBSpecifications.ideplugin/Contents/Resources:/Applications/Xcode.app/Contents/Developer/Library/Xcode/Plug-ins/XCBSpecifications.ideplugin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/appleinternal/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/libexec:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/appleinternal/bin:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/local/bin:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/local/bin:/Users/rustyu/.local/bin:/opt/homebrew/opt/openssl@3/bin:/Users/rustyu/Documents/flutter/3.10.5/bin/:/opt/homebrew/opt/openjdk@11/bin:/opt/homebrew/opt/make/libexec/gnubin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/rustyu/opt/anaconda3/condabin:/Users/rustyu/.cargo/bin:/Users/rustyu/Documents/flutter/3.10.5/bin:/Users/rustyu/Library/Python/3.9/bin:/Users/rustyu/Library/Android/sdk/platform-tools:/Users/rustyu/Library/Android/sdk/tools:/Users/rustyu/.pub-cache/bin:/usr/local/bin:/opt/homebrew/bin
+ PATH=/Users/rustyu/.cargo/bin:/Applications/Xcode.app/Contents/Developer/Library/Xcode/Plug-ins/XCBSpecifications.ideplugin/Contents/Resources:/Applications/Xcode.app/Contents/Developer/Library/Xcode/Plug-ins/XCBSpecifications.ideplugin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/appleinternal/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/libexec:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/appleinternal/bin:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/local/bin:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/local/bin:/Users/rustyu/.local/bin:/opt/homebrew/opt/openssl@3/bin:/Users/rustyu/Documents/flutter/3.10.5/bin/:/opt/homebrew/opt/openjdk@11/bin:/opt/homebrew/opt/make/libexec/gnubin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/rustyu/opt/anaconda3/condabin:/Users/rustyu/.cargo/bin:/Users/rustyu/Documents/flutter/3.10.5/bin:/Users/rustyu/Library/Python/3.9/bin:/Users/rustyu/Library/Android/sdk/platform-tools:/Users/rustyu/Library/Android/sdk/tools:/Users/rustyu/.pub-cache/bin:/usr/local/bin:/opt/homebrew/bin
+ export CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER=/usr/bin/ld
+ CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER=/usr/bin/ld
+ export CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER=/usr/bin/ld
+ CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER=/usr/bin/ld
+ case "$PLATFORM_NAME" in
+ CARGO_XCODE_TARGET_OS=darwin
+ '[' NO = YES ']'
+ CARGO_XCODE_TARGET_TRIPLES=
+ CARGO_XCODE_TARGET_FLAGS=
+ LIPO_ARGS=
+ for arch in '$ARCHS'
+ [[ arm64 == \a\r\m\6\4 ]]
+ arch=aarch64
+ [[ aarch64 == \i\3\8\6 ]]
+ triple=aarch64-apple-darwin
+ CARGO_XCODE_TARGET_TRIPLES=' aarch64-apple-darwin'
+ CARGO_XCODE_TARGET_FLAGS=' --target=aarch64-apple-darwin'
+ LIPO_ARGS='/Users/rustyu/Documents/whatscrm_desktop_lite/build/macos/Build/Intermediates.noindex/native.build/cargo_target/aarch64-apple-darwin/release/libnative.dylib
'
+ for arch in '$ARCHS'
+ [[ x86_64 == \a\r\m\6\4 ]]
+ [[ x86_64 == \i\3\8\6 ]]
+ triple=x86_64-apple-darwin
+ CARGO_XCODE_TARGET_TRIPLES=' aarch64-apple-darwin x86_64-apple-darwin'
+ CARGO_XCODE_TARGET_FLAGS=' --target=aarch64-apple-darwin --target=x86_64-apple-darwin'
+ LIPO_ARGS='/Users/rustyu/Documents/whatscrm_desktop_lite/build/macos/Build/Intermediates.noindex/native.build/cargo_target/aarch64-apple-darwin/release/libnative.dylib
/Users/rustyu/Documents/whatscrm_desktop_lite/build/macos/Build/Intermediates.noindex/native.build/cargo_target/x86_64-apple-darwin/release/libnative.dylib
'
+ command -v rustup
+ for triple in '$CARGO_XCODE_TARGET_TRIPLES'
+ rustup target list --installed
+ grep -Eq '^aarch64-apple-darwin$'
+ for triple in '$CARGO_XCODE_TARGET_TRIPLES'
+ rustup target list --installed
+ grep -Eq '^x86_64-apple-darwin$'
+ '[' release = release ']'
+ OTHER_INPUT_FILE_FLAGS='--lib --release'
+ '[' build = clean ']'
+ cargo build --verbose --manifest-path=/Users/rustyu/Documents/whatscrm_desktop_lite/native/Cargo.toml --features= --target=aarch64-apple-darwin --target=x86_64-apple-darwin --lib --release
       Fresh unicode-ident v1.0.12
       Fresh autocfg v1.1.0
       Fresh cfg-if v1.0.0
       Fresh proc-macro2 v1.0.70
       Fresh pin-project-lite v0.2.13
       Fresh quote v1.0.33
       Fresh syn v2.0.41
       Fresh futures-io v0.3.29
       Fresh tokio-macros v2.2.0
       Fresh tracing-attributes v0.1.27
       Fresh thiserror-impl v1.0.51
       Fresh futures-macro v0.3.29
       Fresh futures-core v0.3.29
       Fresh serde_derive v1.0.193
       Fresh syn v1.0.109
       Fresh smallvec v1.11.2
       Fresh signal-hook-registry v1.4.1
       Fresh slab v0.4.9
       Fresh scopeguard v1.2.0
       Fresh parking_lot_core v0.9.9
       Fresh lock_api v0.4.11
       Fresh num_cpus v1.16.0
       Fresh bytes v1.5.0
       Fresh parking_lot v0.12.1
       Fresh heck v0.4.1
       Fresh mio v0.8.10
       Fresh socket2 v0.5.5
       Fresh once_cell v1.19.0
       Fresh tokio v1.35.0
       Fresh errno v0.3.8
       Fresh async-trait v0.1.74
       Fresh tracing-core v0.1.32
       Fresh fastrand v2.0.1
       Fresh libc v0.2.151
       Fresh futures-sink v0.3.29
       Fresh tracing v0.1.40
       Fresh cc v1.0.83
       Fresh pin-utils v0.1.0
       Fresh tinyvec_macros v0.1.1
       Fresh tinyvec v1.6.0
       Fresh crossbeam-utils v0.8.17
       Fresh futures-channel v0.3.29
       Fresh futures-task v0.3.29
       Fresh bitflags v2.4.1
       Fresh core-foundation-sys v0.8.6
       Fresh parking v2.2.0
       Fresh futures-util v0.3.29
       Fresh rustix v0.38.28
       Fresh unicode-normalization v0.1.22
       Fresh concurrent-queue v2.4.0
       Fresh value-bag v1.4.2
       Fresh ident_case v1.0.1
       Fresh unicode-bidi v0.3.14
       Fresh log v0.4.20
       Fresh bitflags v1.3.2
       Fresh percent-encoding v2.3.1
       Fresh form_urlencoded v1.2.1
       Fresh itoa v1.0.10
       Fresh lazy_static v1.4.0
       Fresh num-integer v0.1.45
       Fresh event-listener v4.0.0
       Fresh idna v0.5.0
       Fresh num-bigint v0.4.4
       Fresh event-listener-strategy v0.4.0
       Fresh url v2.5.0
       Fresh enum-ordinalize v3.1.15
       Fresh core-foundation v0.9.4
       Fresh getrandom v0.2.11
       Fresh strsim v0.9.3
       Fresh memchr v2.6.4
       Fresh educe v0.4.23
       Fresh async-lock v3.2.0
       Fresh rand_core v0.6.4
       Fresh darling_core v0.10.2
       Fresh futures-lite v2.1.0
       Fresh security-framework-sys v2.9.1
       Fresh enum-as-inner v0.4.0
       Fresh socket2 v0.4.10
       Fresh ipnet v2.9.0
       Fresh ppv-lite86 v0.2.17
       Fresh fnv v1.0.7
       Fresh rand_chacha v0.3.1
       Fresh darling_macro v0.10.2
       Fresh security-framework v2.9.2
       Fresh tempfile v3.8.1
       Fresh equivalent v1.0.1
       Fresh hashbrown v0.14.3
       Fresh ryu v1.0.16
       Fresh native-tls v0.2.11
       Fresh indexmap v2.1.0
       Fresh serde v1.0.193
       Fresh rand v0.8.5
       Fresh darling v0.10.2
       Fresh http v0.2.11
       Fresh polling v3.3.1
       Fresh enum-as-inner v0.6.0
       Fresh pin-project-internal v1.1.3
       Fresh data-encoding v2.5.0
       Fresh strsim v0.10.0
       Fresh event-listener v2.5.3
       Fresh thiserror v1.0.51
       Fresh darling_core v0.20.3
       Fresh io-lifetimes v1.0.11
       Fresh anyhow v1.0.75
       Fresh async-io v2.2.2
       Fresh derive_builder_core v0.9.0
       Fresh rustversion v1.0.14
       Fresh tokio-util v0.7.10
       Fresh aho-corasick v1.1.2
       Fresh waker-fn v1.1.1
       Fresh match_cfg v0.1.0
       Fresh linked-hash-map v0.5.6
       Fresh fastrand v1.9.0
       Fresh either v1.9.0
       Fresh atomic-waker v1.1.2
       Fresh build-target v0.4.0
       Fresh try-lock v0.2.5
       Fresh async-task v4.6.0
       Fresh regex-syntax v0.8.2
       Fresh want v0.3.1
       Fresh lru-cache v0.1.2
       Fresh futures-lite v1.13.0
       Fresh hostname v0.3.1
       Fresh regex-automata v0.4.3
       Fresh piper v0.2.1
       Fresh h2 v0.3.22
       Fresh rustix v0.37.27
       Fresh httparse v1.8.0
       Fresh polling v2.8.0
       Fresh serde_json v1.0.108
       Fresh validators-derive v0.24.5
       Fresh strum_macros v0.24.3
       Fresh derive_builder v0.9.0
       Fresh darling_macro v0.20.3
       Fresh async-lock v2.8.0
       Fresh http-body v0.4.6
       Fresh async-channel v2.1.1
       Fresh matches v0.1.10
       Fresh tower-service v0.3.2
       Fresh httpdate v1.0.3
       Fresh async-io v1.13.0
       Fresh idna v0.2.3
       Fresh hyper v0.14.27
       Fresh system-configuration-sys v0.5.0
       Fresh darling v0.20.3
       Fresh blocking v1.5.1
       Fresh regex v1.10.2
       Fresh async-executor v1.8.0
       Fresh async-signal v0.2.5
       Fresh tokio-native-tls v0.3.1
       Fresh idna v0.4.0
       Fresh event-listener v3.1.0
       Fresh tokio-stream v0.1.14
       Fresh gimli v0.28.1
       Fresh minimal-lexical v0.2.1
       Fresh quick-error v1.2.3
       Fresh adler v1.0.2
       Fresh miniz_oxide v0.7.1
       Fresh resolv-conf v0.7.0
       Fresh nom v7.1.3
       Fresh addr2line v0.21.0
       Fresh async-process v1.8.1
       Fresh hyper-tls v0.5.0
       Fresh num-traits v0.2.17
       Fresh serde_with_macros v3.4.0
       Fresh async-global-executor v2.4.1
       Fresh system-configuration v0.5.1
       Fresh trust-dns-proto v0.21.2
       Fresh tokio-socks v0.5.1
       Fresh async-channel v1.9.0
       Fresh serde_urlencoded v0.7.1
       Fresh kv-log-macro v1.0.7
       Fresh futures-executor v0.3.29
       Fresh iana-time-zone v0.1.58
       Fresh nibble_vec v0.1.0
       Fresh object v0.32.1
       Fresh async-recursion v1.0.5
       Fresh encoding_rs v0.8.33
       Fresh mime v0.3.17
       Fresh ascii_utils v0.9.3
       Fresh sha1_smol v1.0.0
       Fresh rustc-demangle v0.1.23
       Fresh base64 v0.21.5
       Fresh flutter_rust_bridge_macros v1.82.5
       Fresh endian-type v0.1.2
       Fresh sha1 v0.6.1
       Fresh reqwest v0.11.22
       Fresh radix_trie v0.2.1
       Fresh fast_chemail v0.9.6
       Fresh backtrace v0.3.69
       Fresh chrono v0.4.31
       Fresh async-std v1.12.0
       Fresh futures v0.3.29
       Fresh trust-dns-resolver v0.21.2
       Fresh fast-socks5 v0.8.2
       Fresh trust-dns-proto v0.23.2
       Fresh pin-project v1.1.3
       Fresh async-native-tls v0.4.0
       Fresh validators-options v0.24.4
       Fresh oncemutex v0.1.1
       Fresh atomic v0.5.3
       Fresh regex-syntax v0.6.29
       Fresh bufstream v0.1.4
       Fresh base64 v0.13.1
       Fresh allo-isolate v0.1.20
       Fresh regex-cache v0.2.1
       Fresh async-smtp v0.6.0
       Fresh validators v0.24.4
       Fresh dart-sys v4.0.2
       Fresh async-std-resolver v0.21.2
       Fresh trust-dns-client v0.23.2
       Fresh pwned v0.5.0
       Fresh mailchecker v5.0.9
       Fresh fast-socks5 v0.9.2
       Fresh strum v0.24.1
       Fresh itertools v0.11.0
       Fresh bincode v1.3.3
       Fresh threadpool v1.8.1
       Fresh serde_repr v0.1.17
       Fresh quick-xml v0.28.2
       Fresh bytemuck v1.14.0
       Fresh levenshtein v1.0.5
       Fresh md5 v0.7.0
       Fresh unsafe-libyaml v0.2.10
       Fresh flutter_rust_bridge v1.82.5
       Fresh serde_yaml v0.9.27
       Fresh check-if-email-exists v0.9.1
       Fresh phonenumber v0.3.3+8.13.9
       Fresh whois-rust v1.5.2
       Fresh serde_with v3.4.0
       Fresh port_check v0.1.5
       Fresh port-killer v0.1.0
       Fresh native v0.1.0 (/Users/rustyu/Documents/whatscrm_desktop_lite/native)
    Finished release [optimized] target(s) in 0.57s
+ tr '\n' '\0'
+ xargs -0 lipo -create -output /Users/rustyu/Documents/whatscrm_desktop_lite/build/macos/Build/Products/Release/native.dylib
fatal error: lipo: can't open input file:  (No such file or directory)
Command RuleScriptExecution failed with a nonzero exit code
warning: Multiple SDKs define the setting 'SDK_DIR_macosx'; either the target is using multiple SDKs which shouldn't be used together, or some of these SDKs need their 'CanonicalName' key updated to avoid this collision: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk, /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk (in target 'native-cdylib' from project 'native')
warning: Multiple SDKs define the setting 'SDK_DIR_macosx14_0'; either the target is using multiple SDKs which shouldn't be used together, or some of these SDKs need their 'CanonicalName' key updated to avoid this collision: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk, /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk (in target 'native-cdylib' from project 'native')
** BUILD FAILED **

To Reproduce

Create a new Macos-enabled Flutter project Follow the steps https://cjycode.com/flutter_rust_bridge/integrate/ios.html to complete the setup Execute flutter build macos

Expected behavior

No response

Generated binding code

No response

OS

Macos 14.2

Version of flutter_rust_bridge_codegen

1.82.5

Flutter info

[✓] Flutter (Channel stable, 3.16.4, on macOS 14.2 23C64 darwin-arm64, locale zh-Hans-NO)
    • Flutter version 3.16.4 on channel stable at /Users/rustyu/Documents/flutter/3.10.5
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2e9cb0aa71 (5 天前), 2023-12-11 14:35:13 -0700
    • Engine revision 54a7145303
    • Dart version 3.2.3
    • DevTools version 2.28.4

[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A240d
    • CocoaPods version 1.12.1

[✓] IntelliJ IDEA Community Edition (version 2023.2.1)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.85.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.78.0

[✓] Connected device (2 available)
    • XRust (mobile)  • 00008101-000A39993A10001E • ios          • iOS 17.0.3 21A360
    • macOS (desktop) • macos                     • darwin-arm64 • macOS 14.2 23C64 darwin-arm64

[✓] Network resources
    • All expected network resources are available.

Version of clang++

Apple clang version 15.0.0 (clang-1500.0.40.1)

Version of ffigen

9.0.1

Additional context

No response

welcome[bot] commented 11 months ago

Hi! Thanks for opening your first issue here! :smile:

fzyzcjy commented 11 months ago

Firstly, this seems like a cargo lipo issue?

Secondly, I am planning to release v2.0 in (hopefully!) a week, and in v2, creating a project is much easier. So if you are not in a hurry, I personally suggest wait for v2 :)

yuhaya commented 11 months ago

Firstly, this seems like a cargo lipo issue?

Secondly, I am planning to release v2.0 in (hopefully!) a week, and in v2, creating a project is much easier. So if you are not in a hurry, I personally suggest wait for v2 :)

👍,Looking forward to the new version

fzyzcjy commented 10 months ago

v2 has released and you can try the quickstart tutorial https://cjycode.com/flutter_rust_bridge/quickstart. I will close this but feel free to reopen!

github-actions[bot] commented 10 months ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue.