Apple M1 + React Native was not exactly what we thought but that is not an issue

Goxo Tech
4 min readJun 4, 2021

--

Apple M1

The very first thing I thought when I read about the M1 was that a new architecture would be a nightmare: software incompatibilities, new bugs, weird issues…

But then, sometime later, I read the official announcement on release and it was really interesting: it was designed to be able to emulate Intel code to run “old” apps. It is even able to run iOS apps as if they were normal apps! And the best thing? Without any significant performance impact!

Also, when I was checking performance reviews, lots of apps like Final Cut were able to run smoothly, even better than really expensive Mac computers from the previous generation.

But what about mobile development? Was everything all right?

Pod Install failing on Apple M1

I do a lot of things on Goxo but one of the things I am doing currently is to code our React Native apps (we have a lot, one per restaurant we have plus one to manage the orders from the restaurants!).

And then… the issues started.

The very first thing was the issues installing Pods (necessary to run React Native apps).

To solve it, I had to run the following commands in the terminal:

# We had to install ffi using Rosetta
sudo arch -x86_64 gem install ffi
# After than we have always to run this command to install pods
arch -x86_64 npx pod-install

Build fails due to libcrypto.a for architecture arm64

The very next thing I did was trying to compile the app and I got this error:

in /Users/*******/Goxo/ios/Pods/OpenSSL-Universal/ios/lib/libcrypto.a(cryptlib.o), building for iOS Simulator, but linking in object file built for iOS, file ‘/Users/*******/Goxo/ios/Pods/OpenSSL-Universal/ios/lib/libcrypto.a’ for architecture arm64

This error is due to the Apple M1 not being to compile the app to run with that architecture, so to solve it, we have to change to these settings the project:

But… after I did those changes, I still got some building issues. That is because you have to change these settings also in the Pods projects.

You could change those settings there just like you just did in the main project but every time you reinstall the pods (remember, always use the command arch -x86_64 npx pod-install ), you will lose those changes.

So, what can we do?

Well, luckily we can code some logic in the file called Podfile. I will paste here our podfile and inside each part of the code, I will explain what we are doing:

Is this the end?

So after that huge Podfile, we thought everything was solved but, oh boy, it wasn’t.

This time we got this issue:

fatal error: module map file '/Users/*******/Library/Developer/Xcode/DerivedData/************-dxbjvfyrfkxwvjgzqzjtfeycwzhk/Build/Products/Debug-iphonesimulator/YogaKit/YogaKit.modulemap' not found

This time after lots of hours researching all over the Internet, we found a short comment in a forum suggesting to do the following:

Open Xcode through Rosetta - Right click on Xcode in applications folder -> Get Info -> set Open with Rosetta to true

And we had to try, we were already getting crazy (and thinking about turning on our old Intel Mac computers). But luckily, this time we pressed the Play button and… it worked!!!

Are we now at the end ?!

Image from https://unsplash.com/photos/EA7uXUeAmjU?utm_source=unsplash&utm_medium=referral&utm_content=creditShareLink

Yes! I know, we had a lot of issues, Apple M1 changed lots of things and broke several of them. But it doesn’t mean this new technology is bad, the performance we are getting using these computers is amazing (and way better than in our previous computers). It is just there are fewer posts on the Internet explaining how to solve the issues.

That is the reason why I decided to write this short post. I have spent hours (even days) working on solving each of these issues so I think the best I can do is to share with you this and help you to don’t waste your time.

I hope it works for you! Happy compilations!

— This article was written by Alberto Del Águila, Full Stack Developer on Goxo

--

--

Goxo Tech
Goxo Tech

Written by Goxo Tech

We are a Spanish startup building the next generation of the direct channel for restaurant businesses. We write about tech and product. https://goxoapp.com

Responses (2)