DEV Community

Cover image for M1 and React Native (Not a headache)
Anubhav
Anubhav

Posted on

M1 and React Native (Not a headache)

For anyone who has worked on or works on React Native, there's no denying that iOS setup, development, and distribution is FAR FAR FAR more difficult than that of Android.
The situation kinda takes a turn for worse with the new CPU architecture, viz. M1 that Apple rolled out a year or two back. There's no denying that M1 is no less than a tech marvel and we don't expect anything less from Apple; but you sure wanna yell out a couple of words out loud to an architecture that just refuses to run a couple of basic commands that used to run as smooth as butter previously.

The most common issue that pops up with this new architecture is the very simple command we execute known as:
pod install

You can expect all pods to be installed without any hiccups but the pods that cause an issue in their installation are:

boost
glog

Let's tackle these issues one by one.

  • BOOST

Installing pods for boost results in an error similar to =>

Image description

In short, the error states that it could not place an authorised request to jfrog.io and is crashing with a 401 unauthorised request. The solution to this couldn't be simpler. Just execute the following command and you're golden:

cd ios && rm -rf Pods && rm -rf Podfile.lock && rm -rf build && pod deintegrate && cd ..
Enter fullscreen mode Exit fullscreen mode

Once you have done this, pod install should move past installation of boost and then hang up on glog.

PS: You might run into many solutions asking you to install the ffi gem and execute a command like
sudo arch -x86_64 gem install ffi

You may give it a whirl but it definitely fails (at least it did for us saying that the architecture specified is invalid) so there's no absolute guarantees that this would most certainly work.

  • GLOG

Pod installation for glog mostly crashes with an error that looks something like:
error: C compiler cannot create executables.

Once again, the solution is pretty simple. This time instead of one though, we wanna execute 2 commands:

sudo xcode-select --switch /Applications/Xcode.app
cd ios && pod install
Enter fullscreen mode Exit fullscreen mode

.

Here's one to hoping this article proves helpful for you :D
If you are facing any other issues or if the aforementioned solutions don't seem to pan out for you, feel free to drop the same in the comments down so we may take it forward.

Top comments (0)