medusa-project / book-tracker

Medusa Book Tracker
0 stars 0 forks source link

Updates x86_64 native gems to be compatible under arm64 #28

Closed gaurijo closed 11 months ago

gaurijo commented 11 months ago
python3 -m venv awscli-env  

source awscli-env/bin/activate  

pip install awscli

Then any time I need to log into aws, I run the $ source awscli-env/bin/activate.

I verify it works by running:

(awscli-env) gauri@LIBLAPSYS09 book-tracker % aws --version

$ aws-cli/1.29.62 Python/3.11.6 Darwin/22.1.0 botocore/1.31.62

Then I'm able to login normally to aws with aws login

To get out of the virtual environment I run deactivate

(The awscli-bundle directory ended up getting committed to this PR (sorry!))

I haven't tried to deploy to demo because I didn't want to merge the changes from this branch to demo until I got some eyes on these changes. I'm hoping if this can be successfully merged into develop/demoI'll finally be able to deploy (with the correct gems/architecture updates in place now)

adolski commented 11 months ago

I'm pretty sure the source of your gem problem is your x86 Homebrew installation. In particular there are several libraries installed via Homebrew which cause compilation problems for gems requiring native extensions. Why it eventually works, I don't know, but I also have an ARM Mac and, with ARM Homebrew packages, I can install all of the Book Tracker's gems without any problem.

gaurijo commented 11 months ago

This PR was worked on in a different MAC environment (on a separate computer), where Homebrew was installed for ARM:

When I run % file $(which psql) on this machine it shows:

/opt/homebrew/opt/postgresql@16/bin/psql: Mach-O 64-bit executable arm64

But I was still getting gem-related errors when trying to install ruby 3.2.2 and again when trying to run bundle and I'm not sure why 😕 Updating the gems this way was the only way I was able to get past the errors. (I also have rbenv installed as my ruby version package manager if that's useful to know)

Is there any specific documentation you followed for your Homebrew installation on your ARM machine? I was using these resources, which felt pretty straight forward, but something must've been messed up along the way.

Official homebrew installation guide How to install homebrew on m1

adolski commented 11 months ago

Okay. It looks like Gemfile.lock is the only file that changed, so why don't you remove the awscli-bundle stuff from this PR and then I'll merge it.

Correct me if I'm wrong, but one of your Macs has x86 Homebrew installed, and the other has ARM Homebrew, but they're both ARM Macs? For the first one, I don't know what the remedy is, but I assume it would involve something like uninstalling the x86 Homebrew and then installing the ARM one.

For me, I didn't do anything special, and I didn't even read the docs, I just ran the "Install Homebrew" command that's printed on the Homebrew main page.

gaurijo commented 11 months ago

I've just removed all the awscli-bundle stuff so this should be ready to merge now (all checks pass).

And that's correct - my personal mac is a M1 (ARM) machine but somehow had x86_64 Homebrew installed on it. My Library IT mac (the one I used for this PR) is a M2 machine and has ARM Homebrew installed on it.

adolski commented 11 months ago

Could you remove awscli-bundle.zip too?

gaurijo commented 11 months ago

Good catch. Done