fterm
fterm copied to clipboard
flutter run -d macos 可以运行,但是 flutter build macos 失败
flutter run -d macos 可以运行
lake@LakedeMacBook-Pro fterm % flutter run -d macos
Launching lib/main.dart on macOS in debug mode...
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00006000-000805921EC3401E }
{ platform:macOS, arch:x86_64, id:00006000-000805921EC3401E }
ld: warning: dylib (/Users/lake/Projects/fterm/build/macos/Build/Products/Debug/rust_ffi.dylib) was built for newer macOS version (13.1) than being linked (11.0)
Building macOS application...
flutter: launch arguments==>[]
flutter: db path=>>/Users/lake/Library/Application Support/com.fterm/app_database.db
flutter: [{cipher_version: 4.5.4 community}]
flutter: InitDataTask
flutter: _AppBlocObserver: HomeTabEvent.add(tab: Instance of 'TerminalTab')
flutter: WindowsTask
flutter: InitAppWidgetTask
flutter: _AppBlocObserver: SshConfigEvent.load()
Syncing files to device macOS... 187ms
Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).
A Dart VM Service on macOS is available at: http://127.0.0.1:52752/tB7mto6DFmI=/
The Flutter DevTools debugger and profiler on macOS is available at: http://127.0.0.1:9100?uri=http://127.0.0.1:52752/tB7mto6DFmI=/
flutter: current locale: null
flutter: LocalConnector==>null
flutter: LauncherScriptTask
flutter: update link /Users/lake/Projects/fterm/build/macos/Build/Products/Debug/fterm.app/Contents/Frameworks/App.framework/Versions/Current/Resources/flutter_assets/assets/scripts/macos/fterm ==> /Users/lake/.nvm/versions/node/v16.0.0/bin/fterm success
flutter: current locale: null
Lost connection to device.
flutter build macos 失败
lake@LakedeMacBook-Pro fterm % flutter build macos
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00006000-000805921EC3401E }
{ platform:macOS, arch:x86_64, id:00006000-000805921EC3401E }
+ cargo build --manifest-path=/Users/lake/Projects/fterm/rust_ffi/Cargo.toml --features= --lib --release --target=x86_64-apple-darwin
Compiling cfg-if v1.0.0
Compiling core-foundation-sys v0.8.4
Compiling pin-project-lite v0.2.9
Compiling bytes v1.4.0
Compiling libc v0.2.146
Compiling futures-core v0.3.28
Compiling once_cell v1.18.0
Compiling itoa v1.0.6
error[E0463]: can't find crate for `core`
|
= help: consider downloading the target with `rustup target add x86_64-apple-darwin`
error[E0463]: can't find crate for `compiler_builtins`
error[E0463]: can't find crate for `alloc`
--> /Users/lake/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bytes-1.4.0/src/lib.rs:79:1
|
79 | extern crate alloc;
| ^^^^^^^^^^^^^^^^^^^ can't find crate
...... 中间报了非常多的错误 。。。。
error[E0425]: cannot find function, tuple struct or tuple variant `Ok` in this scope
--> /Users/lake/.cargo/registry/src/index.crates.io-6f17d22bba15001f/once_cell-1.18.0/src/race.rs:405:13
|
405 | Ok(unsafe { &*ptr })
| ^^ not found in this scope
Some errors have detailed explanations: E0405, E0408, E0412, E0425, E0432, E0463, E0531.
error: could not compile `once_cell` (lib) due to 241 previous errors
** BUILD FAILED **
Building macOS application...
Build process failed
flutter 信息
lake@LakedeMacBook-Pro fterm % flutter doctor -v
[✓] Flutter (Channel stable, 3.10.5, on macOS 13.3 22E252 darwin-arm64, locale en-CN)
• Flutter version 3.10.5 on channel stable at /Users/lake/SDK/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 796c8ef792 (3 weeks ago), 2023-06-13 15:51:02 -0700
• Engine revision 45f6e00911
• Dart version 3.0.5
• DevTools version 2.23.1
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
• Android SDK at /Users/lake/Library/Android/sdk
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14C18
• CocoaPods version 1.12.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.3)
• Android Studio at /Users/lake/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9123335/Android
Studio.app/Contents
• 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
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[✓] VS Code (version 1.79.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.68.0
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 13.3 22E252 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 114.0.5735.198
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 1 category.
机器是 Macbook M1
我模糊的记得好像曾经自己也遇到过这个问题,但是我忘了怎么解决了,似乎是rust版本问题。看看的你现在电脑上的rust版本呢。
看看的rust和我一样不,不一定的花把多余的删除了,版本不同的升级到至少和我一样的版本
执行
rustup show
Default host: aarch64-apple-darwin
rustup home: /Users/develop/.rustup
installed targets for active toolchain
--------------------------------------
aarch64-apple-darwin
aarch64-apple-ios
x86_64-apple-darwin
x86_64-apple-ios
active toolchain
----------------
stable-aarch64-apple-darwin (default)
rustc 1.70.0 (90c541806 2023-05-31)
出现了新的问题
Launching lib/main.dart on macOS in debug mode...
Running pod install...
Building macOS application...
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00006000-000805921EC3401E }
{ platform:macOS, arch:x86_64, id:00006000-000805921EC3401E }
/Users/lake/Projects/fterm/macos/Runner.xcodeproj: error: No profiles for 'com.github.springeye.fterm' were found: Xcode couldn't find any Mac App Development provisioning profiles matching 'com.github.springeye.fterm'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'Runner' from project 'Runner')
/Users/lake/Projects/fterm/macos/Pods/Pods.xcodeproj: warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.11, but the range of supported deployment target versions is 10.13 to 13.1.99. (in target 'FMDB' from project 'Pods')
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Flutter Assemble' from project 'Runner')
** BUILD FAILED **
Exception: Build process failed
之前没接触过 mac 的开发,感觉应该是某个地方没配对,但是搜了好久没解决。
出现了新的问题
Launching lib/main.dart on macOS in debug mode... Running pod install... Building macOS application... --- xcodebuild: WARNING: Using the first of multiple matching destinations: { platform:macOS, arch:arm64, id:00006000-000805921EC3401E } { platform:macOS, arch:x86_64, id:00006000-000805921EC3401E } /Users/lake/Projects/fterm/macos/Runner.xcodeproj: error: No profiles for 'com.github.springeye.fterm' were found: Xcode couldn't find any Mac App Development provisioning profiles matching 'com.github.springeye.fterm'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'Runner' from project 'Runner') /Users/lake/Projects/fterm/macos/Pods/Pods.xcodeproj: warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.11, but the range of supported deployment target versions is 10.13 to 13.1.99. (in target 'FMDB' from project 'Pods') warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Flutter Assemble' from project 'Runner') ** BUILD FAILED ** Exception: Build process failed
之前没接触过 mac 的开发,感觉应该是某个地方没配对,但是搜了好久没解决。
这个问题解决了 https://stackoverflow.com/questions/42616654/how-to-select-development-team-for-ios-app-created-in-flutter
目前情况是这样的
lake@LakedeMacBook-Pro ~ % rustup show
Default host: aarch64-apple-darwin
rustup home: /Users/lake/.rustup
installed targets for active toolchain
--------------------------------------
aarch64-apple-darwin
x86_64-apple-darwin
active toolchain
----------------
stable-aarch64-apple-darwin (default)
rustc 1.70.0 (90c541806 2023-05-31)
编译
lake@LakedeMacBook-Pro fterm % flutter build macos
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00006000-000805921EC3401E }
{ platform:macOS, arch:x86_64, id:00006000-000805921EC3401E }
+ cargo build --manifest-path=/Users/lake/Projects/fterm/rust_ffi/Cargo.toml --features= --lib --release --target=x86_64-apple-darwin
Compiling cfg-if v1.0.0
Compiling core-foundation-sys v0.8.4
Compiling pin-project-lite v0.2.9
Compiling bytes v1.4.0
Compiling libc v0.2.146
Compiling futures-core v0.3.28
Compiling once_cell v1.18.0
Compiling itoa v1.0.6
error[E0463]: can't find crate for `core`
|
= help: consider downloading the target with `rustup target add x86_64-apple-darwin`
error[E0463]: can't find crate for `compiler_builtins`
......
error[E0425]: cannot find function, tuple struct or tuple variant `Ok` in this scope
--> /Users/lake/.cargo/registry/src/index.crates.io-6f17d22bba15001f/once_cell-1.18.0/src/race.rs:405:13
|
405 | Ok(unsafe { &*ptr })
| ^^ not found in this scope
Some errors have detailed explanations: E0405, E0408, E0412, E0425, E0432, E0463, E0531.
error: could not compile `once_cell` (lib) due to 241 previous errors
/Users/lake/Projects/fterm/macos/Pods/Pods.xcodeproj: warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.11, but the range of supported deployment target versions is 10.13 to 13.1.99. (in target 'FMDB' from project 'Pods')
** BUILD FAILED **
Building macOS application...
Build process failed
看看的rust和我一样不,不一定的花把多余的删除了,版本不同的升级到至少和我一样的版本
执行
rustup show
Default host: aarch64-apple-darwin rustup home: /Users/develop/.rustup installed targets for active toolchain -------------------------------------- aarch64-apple-darwin aarch64-apple-ios x86_64-apple-darwin x86_64-apple-ios active toolchain ---------------- stable-aarch64-apple-darwin (default) rustc 1.70.0 (90c541806 2023-05-31)
能debug运行的话是不是说明编译环境没问题
能debug运行的话是不是说明编译环境没问题
首先我不太确定我记忆中的内容是否是对的,我记得当时我google上搜索出来最后处理到问题,原因是因为release模式的时候rust和debug一些什么是不同的,我好像是执行个rust的相关的各种更新(确保更新成功了)再把多余的东西都清除掉就好了
在 arm 架构的机器编译,为什么它的参数是 --target=x86_64-apple-darwin
,请问这个需要再某个文件中进行更改吗
具体的我不没研究过,用的是这个cargo-xcodebuild这个项目。你可以参考一下。不过我觉得可能是因为flutter默认编译出来的是通用二进制,但是rust不能编译像mac下的通用的动态链接库(混合了x86和arm64架构,),所以他只能单独编译x86和arm64,然后用lipo把他们合并到了
好的感谢