How can I avoid this ruby illegal instruction error when updating a cocoapod? - ruby

tldr: Ruby is reporting an illegal instruction when I try to update my pod, maybe because I’m using two different versions of it.
I am not sure what my problem is, and I’ll happily add more information should it be helpful.
I got a new M1 Pro Mac and have been trying to get an XCode project (an iOS app) to work on it. It happily builds for my phone but fails to build for simulators. Based on this answer, I tried to update cocoapods and then the pods I’m using for my project (some of the Google Firebase pods). When I run pod update, I get the following result:
Update all pods
Updating local specs repositories
/Library/Ruby/Gems/2.6.0/gems/ethon-0.15.0/lib/ethon/curls/classes.rb:36: [BUG] Illegal instruction at 0x0000000100224000
ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]
This is then followed by several hundred lines of reporting (saved here). It also saves a diagnostic report (here). I believe that both of these are red herrings, but I wanted to include them just in case.
My guess for what’s going wrong is that the library is 2.6.0, while ruby itself is version 2.6.8. Both of these are old, and they’re also different versions. I tried to update ruby, gem, and reinstalled cocoapods, but none of these changed these version numbers. Any help getting these versions updated would be appreciated.
My apologies for such an indirect question; if I were more sure what the problem was, I probably would have solved it.

If you are on an M1 chip, uninstall the cocoapods package through gem (sudo gem uninstall cocoapods) and reinstalling it with homebrew (brew install cocoapods), this fixed my problem.

I believe the issue was that my newly updated ruby versions weren’t being copied to my homebrew path. This command (from this answer) ended up solving it!
PATH=/usr/local/opt/ruby/bin:$PATH
GEMSDIR=$(gem environment gemdir)/bin
PATH=$GEMSDIR:$PATH
export PATH

Related

Xcode and flutter compiler error: reading from wrong directory

I am getting this error and my app will not compile. The problem is that I had to upgrade macos to be able to compile apps on newer iOS versions, and in doing so I copied my project over from my mojave machine to my catalina one. The directory users/mojave no longer exists, and it needs to be replaced with users/catalina
I have searched the app for any reference of mojave anywhere, and replaced it all with catalina. I have rebooted macos, and it still fails, looking for this old directory.
How do I find and change these references? I am not able to find anything online, possibly because I don't really know how to phrase this question.
So this is another one of those occasions where the error doesn't really indicate what is wrong here.
The problem was that "pods setup" had not been run, so it had not initialised.
The reason for this is that when I ran "pod setup" it does literally nothing.
Researching this issue online, it seems an issue since cocoapods 1.8.0, and the dev team said that they had hotfixed this issue and it would be available from version 1.8.1
Well, this was version 1.8.4 and it is still broken with exactly the same issue.
The fix was to uninstall it completely:
sudo gem uninstall cocoapods
And then install version 1.7.5:
sudo gemo install cocoapods --version 1.7.5
From here, with the older version installed that actually works, "pod setup" runs fine, pods is initialised and the app no longer looks in the incorrect folders.
Hope this helps someone.

Google Cloud SDK v274.0.0 update asking for Python 2.7 interpreter on a machine that has only ever had Python 3+ (Windows)

This is really strange - I've found no help in the documentation, nor can we replicate the error on a machine of a similar build. The gcloud CLI has worked without any error on my Python 3 machine for months.
After today's update, any gcloud command is met with the below error message, looking for a Python 2.7 interpreter. I'm at a loss as to how to proceed - even when attempting to uninstall with the gcloud command the same error is thrown.
This is a known issue that is being tracked here
Version 2.74 installation is broken on Windows. You will need to install an older version. This can be fixed by hand-editing gcloud.cmd but I do not recommend this.
Use the following link to download a previous version after uninstalling the current version.
Installing from versioned archives
[UPDATE 12/30/2019]
Google has released a minor revision update that appears to fix this problem. The revised update is version 2.74.0.1.

Installing Bakefile in Mac osx 10.11

I have been trying to install bakefile(v0.2.9) in mac osx 10.11. Whenever I try to install bakefile using the dmg file I get The installation failed.The installer could not install the software because there was no software found to install error.
I even tried building it from the source code(v1.2.5.1 from github). I built it using the sudo make command.However sudo make install command throws No rule to make target install.
Is there any other way to install bakefile in macosx 10.11?
Edit :
Finally I managed to install the bakefile 0.2.9 in osx 10.11. I can't use the latest version as it does not supports the bakefile we have been using in our projects.
Though the installation is successful,I get the segmentation fault 11 when I try to build the bakefiles(.bkl). Some of the forums suggested that the problem could be associated with python 2.7. I followed all the steps needed to resolve the issue. But none of them helped.
I have been using python 2.7.11. How can I avoid this segmentation fault?
I advice against using the legacy 0.2.9 version.
I even tried building it from the source code(v1.2.5.1 from github).
You didn’t, that’s the problem — you tried to build a very different version, 0.2.9 != 1.2.5.1. The relation between these two branches is explained at http://bakefile.org — they are incompatible and different.
If you want to build 0.2.9 from sources, you need to download and build 0.2.9.
If you want to use the 1.x version, you can download packaged “binary” version, as explained at https://github.com/vslavik/bakefile
P.S. You don’t need to, and shouldn’t, use sudo when installing somewhere you typically have access to, such as /usr/local on OS X.

Trying to Run middleman on mac

Answering my own question for anyone else having this issue. (using the search terms i thought of because they didn't bring up the answers for me).
Trying to install and run middleman following the getting started guide on their website with Mac OS X 10.9.2. When trying to run bundle install getting errors about openSSL and event machine.
Gist of Errors.
Refrence to an answer that someone on IRC helped me find.
Aparently this is caused by a mismatch in expected versions with something called Clang which is part of the Xcode tools for mac. The update to Xcode tools causes this to fail. Using the command:
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future bundle install
seems to work to resolve this issue.

libpng not linked on Mac OSX 10.9.2

I installed matrix2png on my Mac and had used it without problem before last week when I installed another image manipulating tool "circos". Circos requires me to install a different version of libpng, and I did. After that, I am no longer able to run matrix2png, which gives me the following error. I think the old ligpnb is not linked any more. Does anyone know how to fix this error? - appreciate your help.
dyld: Library not loaded: /usr/local/lib/libpng15.15.dylib
Referenced from: /usr/local/bin/matrix2png
Reason: image not found
Those step solve my problem:
brew versions libpng
You will see some versions of libpng, but unfortunately not 1.5.15, so next you should install 1.5.18.
git checkout 7bec702 Library/Formula/libpng.rb
brew install libpng
You'll will find version 1.5.18 and some another versions.
ln -s /usr/local/Cellar/libpng/1.5.18/lib/libpng15.15.dylib /usr/local/lib/libpng15.15.dylib`
See https://github.com/Homebrew/homebrew-php/issues/1055
Some more info on installing certain versions of brew formulas can be found at https://coderwall.com/p/lqphzg.
Your new version of libpng has probably changed the name of its dyld files. This often happens with upgrades (especially following a major release). To verify this, open up the terminal and type:
ls /usr/local/lib/libpng*
What do you see?
From your error message we know that matrix2png is looking for libpng15 but if you've upgraded when instaling circos then you may now have libpng16 on your system. Consequently matrix2png won't be able to find the files that it's looking for and will be unhappy.
Fixing it this time:
Try re-installing matrix2png and see whether it notices the dependency issues and fixes it for you. You don't really want to downgrade libpng nor do you want to have two versions of it on your system, so having an up-to-date version of matrix2png would be good.
It looks like matrix2png comes from C source code, so you'll want to rebuild it. Download the source code or and then open a terminal. Navigate to the folder with the source code and run configure and then make. Configure will generate a Makefile for your system, and then make will use that file to generate a new binary. I've tested this on my Mac (with libpng16), and found that matrix2png built without any errors.
Suggested future approach:
To prevent future linking problems, you may want to use a package manager like homebrew or macports. In case you're using (or want to use) homebrew, it has circos and lib2png (but not matrix2png, sorry!). Once brew is installed, type the following into the terminal:
brew install libpng
And it should detect linking issues / version conflicts and guide you through fixing them. Brew places all of it's files in a 'cellar' location in /usr/local/Cellar and then symbolically links them into your system.
In case you're already using brew, try brew doctor and follow the instructions to resolve problems.
My experience (I've been dealing with a lot of version conflicts in the past few weeks) is that package managers make life much easier. Occasionally I've had to remove and reinstall packages to fix version issues, but in general brew keeps things neat and working.

Resources