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

issues when using on M1 laptop #14

Open
rolandoam opened this issue Apr 12, 2021 · 4 comments
Open

issues when using on M1 laptop #14

rolandoam opened this issue Apr 12, 2021 · 4 comments

Comments

@rolandoam
Copy link

I'm trying to test my app in the simulator, but I'm using a newer M1 laptop (arm64). Because Sim build is only executed if the arch is i386 or x86_64 when trying to link my app (sim) it complains about missing architecture of all the libraries.

The problem is that the platformName function in iSSH-commons is assuming iPhoneSimulator for non-arm archs. This was true before Apple introduced the M1 platform.

@Jan-E
Copy link
Contributor

Jan-E commented Apr 13, 2021

What is the exact error message you get when trying to run your app in the simulator?

Wild guess: maybe you should try to build the (fat) libraries with the x86_64 version for macOSX, not the one for iPhoneSimulator. I am doing something like that in my fork of this repo for building Mac Catalyst libraries:
Jan-E@f9f6d1f#commitcomment-49456294

In a Mac Catalyst app (on an Intel Mac) it is a similar case. The app does not run in the simulator, but runs OK on 'My Mac'. Error message:

in /Users/tfr/Documents/myAPP/Pods/NMSSH/NMSSH-iOS/Libraries/lib/libcrypto.a(aes_cbc.o), building for iOS Simulator, but linking in object file built for Mac Catalyst, file '/Users/tfr/Documents/myAPP/Pods/NMSSH/NMSSH-iOS/Libraries/lib/libcrypto.a' for architecture x86_64

@Jan-E
Copy link
Contributor

Jan-E commented Apr 13, 2021

Even wilder guess: try linking with the libraries for macOSX.

@Jan-E
Copy link
Contributor

Jan-E commented Apr 13, 2021

Or test you app as a Mac Catalyst app on 'My Mac'. That is what I am doing with my own iPad apps that have 3 use cases:

  1. iPhone
  2. iPad (9.3.6 - 14.4.1)
  3. Mac Catalyst

I am testing the app on 'My Mac'. There also is a build target Any Mac (Apple Silicon, Intel), which suggests that the Catalyst version should also run on an Apple M1.

For the catalyst apps I am using the libs from my fork of this repo:

% git clone -b catalyst https://github.com/Jan-E/iSSH2 iSSH2-catalyst
% cd iSSH2-catalyst
% ./catalyst.sh

And grab a coffee or two.

@Jan-E
Copy link
Contributor

Jan-E commented Apr 28, 2021

Here is a quite elaborate description of the problem you are running into:
https://apontious.com/2020/08/23/arm-wrestling-your-ios-simulator-builds/
Near the end of the article there is this description of a solution:

Instead, don’t build for ARM at all.

Go to your Target build settings, go to Architectures, and then go to the new setting Excluded Architectures (EXCLUDED_ARCHES), which Apple recommends you use instead of the older setting Valid Architectures (VALID_ARCHS).

There, hover over it with your mouse and click the + button that appears, and it will give you the option of adding a subheading called “Any iOS Simulator SDK”. Do that, and add an arm64 entry to the build setting’s list of values.

If this is not feasible for some reason my recommendation would be to add a Mac (Catalyst) build option to your app and test the app on your Mac as Catalyst app.

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

2 participants