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

added installation troubleshooting info for macOS users #1924

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

ecopsychologer
Copy link

@ecopsychologer ecopsychologer commented Sep 17, 2023

Description

I added two notes, one about using a VPN to run 'sudo dkp-pacman -Sy' because their servers wouldn't let me connect otherwise. The second was information on running terminal using rosetta, because my make failed unless I opened terminal in rosetta.

Discord contact info

ecopsychologer#5583

I included details of what I needed to do to get this to compile on macOS
@GriffinRichards
Copy link
Member

GriffinRichards commented Sep 19, 2023

Using Rosetta is required for Apple Silicon Macs. The pokefirered INSTALL.md already mentions this, just copy the comment (and subsequent commands) from there instead.

@ecopsychologer
Copy link
Author

Thanks for the tip, I added all the instructions mentioning the m1 chips to this install.md

@grunt-lucas
Copy link
Contributor

That's odd. I am on an M1 mac, and I am not using a special Rosetta terminal profile. Nor do I have an amd64 Homebrew or libpng. I am using the regular arm64 homebrew installed in /opt, and my libpng is an arm64 dylib. Obviously my devkitARM binaries run through rosetta, but that happens in the background automatically. I don't M1 mac users need a special homebrew install in /usr/lib.

@ecopsychologer
Copy link
Author

ecopsychologer commented Sep 21, 2023

Yeah tbh I only added that because I was asked to copy it from the pokefirered, I installed homebrew a while back and just brew install things.

I kind of figured that by including it, people could try the other one if what they did didn't work, but I can remove it or change the comments for the homebrew thing to try the top first and use the second if that fails.

@GriffinRichards
Copy link
Member

That's odd

You'd have to ask the M1 users who added it. I don't have access to one, so I can't verify any of this. I'm going off of what other users have told me. Feel free to update pokefirered if you disagree with its instructions, they should be the same across repos regardless.

@grunt-lucas
Copy link
Contributor

Ah I see. It's no big deal. I just always get curious around things related to Rosetta and installation processes. Because oftentimes I am bewildered about why something worked for me and not someone else, or vice-versa.

@ecopsychologer
Copy link
Author

Is there anything then I should change to get this added? I think having the extra documentation will help users setting this up

@ecopsychologer
Copy link
Author

Maybe make them both a 'try this then that' situation?

@GriffinRichards
Copy link
Member

If someone else with an M1 can verify this I don't have a problem with it. I don't have access to one myself.

@grunt-lucas
Copy link
Contributor

I think the advice is just outdated. I've built pokeemerald on multiple M1 macs by installing the regular Apple Silicon Homebrew, and brew installing the Apple Silicon libpng. The devkitpro toolchain is still amd64, so that will run under Rosetta automatically. But I am pretty sure libpng is only needed to build the tools, and those are going to be built by your Apple Silicon C/C++ compiler (clang by default on MacOS).

Comment on lines +273 to +285
<details>
<summary><i><strong>Note for Apple Silicon (M1) Mac users...</strong></i></summary>

> Currently, Homebrew and libng must be installed via Rosetta on Apple Silicon Macs. Before continuing, create a [Terminal shell profile with Rosetta](https://www.astroworldcreations.com/blog/apple-silicon-and-legacy-command-line-software). Be sure to run the commands corresponding to Apple Silicon (M1).
</details>

1. Open the Terminal.
2. If Homebrew is not installed, then install [Homebrew](https://brew.sh/) by following the instructions on the website.
3. Run the following command to install libpng.

```bash
brew install libpng
brew install libpng # Intel Macs
/usr/local/bin/brew install libpng # Apple Silicon (M1) Macs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imo these changes are not necessary

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still can't speak to M1, but now on an M3 I can add that in addition to brew install libpng I needed to install pkg-config with brew install pkg-config in order for libpng to be found.

Comment on lines -302 to +319
echo "export DEVKITPRO=$DEVKITPRO" >> ~/.bashrc
echo "export DEVKITPRO=$DEVKITPRO" >> ~/.bashrc # Intel Macs
echo "export DEVKITPRO=$DEVKITPRO" >> ~/.zshrc # Apple Silicon (M1) Macs
export DEVKITARM=$DEVKITPRO/devkitARM
echo "export DEVKITARM=$DEVKITARM" >> ~/.bashrc
echo "export DEVKITARM=$DEVKITARM" >> ~/.bashrc # Intel Macs
echo "export DEVKITARM=$DEVKITARM" >> ~/.zshrc # Apple Silicon (M1) Macs

echo "if [ -f ~/.bashrc ]; then . ~/.bashrc; fi" >> ~/.bash_profile
echo "if [ -f ~/.bashrc ]; then . ~/.bashrc; fi" >> ~/.bash_profile # Intel Macs
echo "if [ -f ~/.zshrc ]; then . ~/.zshrc; fi" >> ~/.zprofile # Apple Silicon (M1) Macs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But these changes are good and helpful, since M1 macs are going to be using zsh by default now

@samirg1
Copy link

samirg1 commented Oct 14, 2023

Hi there, I'm on an M1 and recently came across the issues mentioned with libpng, came across this and both of these changes helped me fix the issue. Thank you!

@jarechiga11
Copy link

jarechiga11 commented Dec 4, 2023

Ah I see. It's no big deal. I just always get curious around things related to Rosetta and installation processes. Because oftentimes I am bewildered about why something worked for me and not someone else, or vice-versa.

I think the advice is just outdated. I've built pokeemerald on multiple M1 macs by installing the regular Apple Silicon Homebrew, and brew installing the Apple Silicon libpng. The devkitpro toolchain is still amd64, so that will run under Rosetta automatically. But I am pretty sure libpng is only needed to build the tools, and those are going to be built by your Apple Silicon C/C++ compiler (clang by default on MacOS).

Hey, I'm the original contributor from pokefirered that added the notes about rosetta being required for Apple Silicon Macs (M1 at the time). From my personal experience, it was required for installing libpng so the make command would work.

When I tried installing libpng through the typical brew command, it would appear to install fine but then the make command would always fail with this error

ld: warning: ignoring file '/usr/local/homebrew/Cellar/libpng/1.6.37/lib/libpng16.16.dylib': found architecture 'x86_64', required architecture 'arm64'
...
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I tried reinstalling libpng and even brew a few times but always got that error. It wasn't until I tried using the rosetta terminal for installing libpng that running the make command would result in a successful build.

I guess it doesnt seem to affect every Apple Silicon user... So maybe there's a more appropriate fix, as I actually consider rosetta to still be a workaround too. The main issue seems to really be the location reference of the library not reading the apple silicon libpng (/opt/homebrew/...) so I had to resort to installing libpng for the other location it was looking for.

@grunt-lucas
Copy link
Contributor

This would be a great deep dive for someone to figure out. The fact that you have your Homebrew cellar at /usr/local is very odd. That was the old Intel Mac location. Although, there could be some nuances here I am missing, as I am not a Mac/Homebrew expert. And clearly, other people have encountered the same issues you did. 🤷‍♂️

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

Successfully merging this pull request may close these issues.

5 participants