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

[iOS] release build fails #8

Open
Nico04 opened this issue Sep 27, 2021 · 18 comments
Open

[iOS] release build fails #8

Nico04 opened this issue Sep 27, 2021 · 18 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@Nico04
Copy link

Nico04 commented Sep 27, 2021

I've just migrated from ssh to ssh2.
App works fine on Android (debug and release), and on iOS in debug mode, but it doens't build in release mode.

flutter build ios or flutter build ipa fails :

Xcode's output:
↳
    warning: [CP] Unable to find matching .xcframework slice in 'ios-x86_64-simulator ios-arm64 ios-x86_64-maccatalyst' for the current build architectures (arm64 armv7).
    warning: [CP] Unable to find matching .xcframework slice in 'ios-arm64 ios-x86_64-simulator ios-x86_64-maccatalyst' for the current build architectures (arm64 armv7).
    warning: [CP] Unable to find matching .xcframework slice in 'ios-x86_64-simulator ios-x86_64-maccatalyst ios-arm64' for the current build architectures (arm64 armv7).
    ld: library not found for -lcrypto
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    Command Ld failed with a nonzero exit code
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Analyzing workspace
    note: Constructing build description
    note: Build preparation complete

Encountered error while building for device.

It's the same error on my mac and on my CI/CD.

Note that flutter run --release works fine.

I'm using Flutter 2.5.1 with null-safety.

Any idea ?

@jda258
Copy link
Owner

jda258 commented Sep 27, 2021

That's odd as flutter run --release should do a build of the release version. When I've had build issues with iOS in the past, this has helped:

  1. Run flutter clean && flutter pub get in your project directory
  2. Make sure you're using the latest version of CocoaPods by running the command sudo gem install cocoapods
  3. Run pod deintegrate && rm Podfile.lock && pod install --repo-update in your project's ios directory
  4. Now try building

You may also be running into an iOS version mismatch. Make sure you've specified version 9.0 or later.

If you still have trouble, try building inside of Xcode to see if you get more information in the build output.

@jda258 jda258 added the help wanted Extra attention is needed label Sep 27, 2021
@jda258 jda258 self-assigned this Sep 27, 2021
@jda258
Copy link
Owner

jda258 commented Sep 27, 2021

You also may have run into this issue if you've updated Xcode recently: https://stackoverflow.com/questions/63607158/xcode-12-building-for-ios-simulator-but-linking-in-an-object-file-built-for-io

@Nico04
Copy link
Author

Nico04 commented Sep 28, 2021

Thank you for your quick answer.
I've tester all of the above, unfortunatly is extacly the same. Please note that I have the same error on my CI/CD which use a clean environment each time.
I've got the same error on XCode 15.5.1 when archiving also.

image

Target and minimum iOS version are set to 10.0.
If remove the plugin from my project, it compiles well.

It's the same if I compile for generic device or for my iPhone 6S.

I've tested to exclude architecures, to use "Validate Workspace" as the link your provided suggest, doesn't change the error.

Any other idea ?

@jda258
Copy link
Owner

jda258 commented Sep 30, 2021

I just published version 2.2.3, which excludes the arm64 architecture for the simulator. You may need to delete your Podfile.lock and run flutter clean before building. Hopefully this fixes your issue at the plugin level so you don't need to do overrides in your Podfile.

1 similar comment
@jda258
Copy link
Owner

jda258 commented Sep 30, 2021

I just published version 2.2.3, which excludes the arm64 architecture for the simulator. You may need to delete your Podfile.lock and run flutter clean before building. Hopefully this fixes your issue at the plugin level so you don't need to do overrides in your Podfile.

@nevishs nevishs mentioned this issue Sep 30, 2021
@jda258
Copy link
Owner

jda258 commented Oct 1, 2021

Just to let you know, I'm still working on this.

@jda258
Copy link
Owner

jda258 commented Oct 3, 2021

I've tried for hours to get this working in the example app, but no luck so far. It works in an app I'm developing, and here are the build setting differences in project.pbxproj for the Release build (working version on left side):

21d20
<                                 CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
31a31
>                                 "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "i386 arm64";
42d41
<                                 ONLY_ACTIVE_ARCH = NO;
43a43
>                                 SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
44a45
>                                 SWIFT_OPTIMIZATION_LEVEL = "-O";

I've set pretty much everything I can the same in the target and runner settings, but still no go. :(

@Nico04
Copy link
Author

Nico04 commented Oct 6, 2021

I've tested the last version 2.2.3 with Flutter 2.5.2, same issue unfortunately.
Did you find any lead ?

@Nico04
Copy link
Author

Nico04 commented Oct 29, 2021

Did you find time to search more ?

@michaelchevallier
Copy link

Hi @jda258 , I'm having the exact same problem as @Nico04.
My 2 cents:

  • Build a release version of an ios app => DOES NOT work
  • Build a debug version => Works
  • And somehow: flutter run --release WORKS on an ios device. (iphone 12 Mini ios 15.1)

I'm starting to wonder if creating a package with flutter tools from scratch and copy pasting files would solve this ?

I hope my contribution can help in a way.

@Nico04
Copy link
Author

Nico04 commented Nov 9, 2021

I've spent some few hour this morning trying to start from a fresh project and copy sources into.
But my knowledge of ios are too narrow.
Maybe we can try using this fork of the plugin, which seems more recent : https://github.com/gallinaettore/NMSSH ?

@jda258
Copy link
Owner

jda258 commented Nov 20, 2021

Thanks for your work on this @Nico04! That fork looks very promising. It hasn't been released on CocoaPods, so we'd have to include the code in our repo.

@talhaz6
Copy link

talhaz6 commented Dec 27, 2021

Any update on this issue?

@muneikh
Copy link

muneikh commented Dec 29, 2021

@Nico04 Have you been able to address the issue with the form you shared above?

@Nico04
Copy link
Author

Nico04 commented Jan 1, 2022

@Nico04 Have you been able to address the issue with the form you shared above?

I've spent few hours trying to find a fix. I found several leads, that I've shared above, but I've stopped trying.

@Nico04
Copy link
Author

Nico04 commented Feb 7, 2022

In the end I've used dartssh2 package instead, works perfectly

@talhaz6
Copy link

talhaz6 commented Feb 8, 2022

Thank you for the suggestion @Nico04

@gigalala
Copy link

gigalala commented Jul 1, 2022

I was able to solve temporarily by adding to pods GZ-NMSSH and ssh2 the following:
"Excluded Architectures"-> "Release"-> "armv7"
Honestly not sure what the side effects are, but it works well in production on different devices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants