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

Installation instructions not working for M1 Macs #637

Closed
elsatch opened this issue Feb 26, 2022 · 2 comments
Closed

Installation instructions not working for M1 Macs #637

elsatch opened this issue Feb 26, 2022 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@elsatch
Copy link

elsatch commented Feb 26, 2022

Installation instructions not working for M1 Macs

I have been trying to follow the instructions to install this program into Mac M1, but the instructions do not work.

How to reproduce the problem

According to the instructions at instructions/Installation.md, Mac M1 users should do:

arch -x86_64 /usr/local/bin/brew install gtk+3 adwaita-icon-theme ffmpeg librsvg

Executing that command returns an error on Macbook Air M1 (running Big Sur 11.6):
arch: /usr/local/bin/brew isn't executable

I tried changing the route on the command line to the actual location of my brew local installation.

% which brew
/opt/homebrew/bin/brew

I changed the route on the command to point to the actual route of brew and got the following error:

% arch -x86_64 /opt/homebrew/bin/brew install gtk+3 adwaita-icon-theme ffmpeg librsvg
[Omitted console output]
Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)!
To rerun under ARM use:
    arch -arm64 brew install ...
To install under x86_64, install Homebrew into /usr/local.

I tried executing the command that appears on the first text area:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

==> Checking for `sudo` access (which may request your password)...
Password:
==> This script will install:
/opt/homebrew/bin/brew
/opt/homebrew/share/doc/homebrew
/opt/homebrew/share/man/man1/brew.1
/opt/homebrew/share/zsh/site-functions/_brew
/opt/homebrew/etc/bash_completion.d/brew
/opt/homebrew

Press RETURN to continue or any other key to abort:

Given that we need Intel X86-64 Homebrew at /usr/local, I just aborted the installation using the given command.

Possible fix

It seems the installation instructions should clarify that you need a running brew X86-64 on your computer before trying to build the required libraries.

To do so, you need to have Rosetta 2 installed [1]:

softwareupdate --install-rosetta
I have read and agree to the terms of the software license agreement. A list of Apple SLAs may be found here: http://www.apple.com/legal/sla/
Type A and press return to agree: A
2022-02-25 19:36:58.111 softwareupdate[4230:69101] Package Authoring Error: 071-97390: Package reference com.apple.pkg.RosettaUpdateAuto is missing installKBytes attribute
Install of Rosetta 2 finished successfully

Then you need to install Intel X86-64 brew doing:

cd ~/Downloads
mkdir homebrew
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew

After this step, you should mv the folder to /usr/local/:

sudo mv homebrew /usr/local/homebrew

Then you can execute the command arch -x86_64 /usr/local/homebrew/bin/brew install gtk+3 adwaita-icon-theme ffmpeg librsvg to get the libraries installed.

After a few minutes hours!, you can just click on the mac_czkawka_gui executable and it will fail again!

% arch -x86_64 /usr/local/homebrew/bin/brew install gtk+3 adwaita-icon-theme ffmpeg librsvg

Running `brew update --preinstall`...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
Updated 3 formulae.

Warning: gtk+3 3.24.31 is already installed and up-to-date.
To reinstall 3.24.31, run:
  brew reinstall gtk+3
Warning: adwaita-icon-theme 41.0 is already installed and up-to-date.
To reinstall 41.0, run:
  brew reinstall adwaita-icon-theme
Warning: ffmpeg 5.0 is already installed and up-to-date.
To reinstall 5.0, run:
  brew reinstall ffmpeg
Warning: librsvg 2.52.6 is already installed and up-to-date.
To reinstall 2.52.6, run:
  brew reinstall librsvg

% ./mac_czkawka_gui
dyld: Library not loaded: /usr/local/opt/glib/lib/libgobject-2.0.0.dylib
  Referenced from: /Users/cesargarciasaez/Downloads/./mac_czkawka_gui
  Reason: image not found
zsh: abort      ./mac_czkawka_gui

Libgobject not available on brew:

arch -x86_64 /usr/local/homebrew/bin/brew install libgobject                             

==> Tapping homebrew/cask
Cloning into '/usr/local/homebrew/Library/Taps/homebrew/homebrew-cask'...
remote: Enumerating objects: 624143, done.
remote: Total 624143 (delta 0), reused 0 (delta 0), pack-reused 624143
Receiving objects: 100% (624143/624143), 289.98 MiB | 12.50 MiB/s, done.
Resolving deltas: 100% (441495/441495), done.
Tapped 3962 casks (4,033 files, 310.0MB).
Warning: No available formula with the name "libgobject". Did you mean libgccjit?
==> Searching for similarly named formulae...
This similarly named formula was found:
libgccjit
To install it, run:
  brew install libgccjit
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.

I tried to locate my library using find / -name "libgobject*" and discovered it was located under /usr/local/homebrew/lib/. So I created the folder that appeared in the error and then created a symlink from the /usr/local/homebrew/lib/libgobject-2.0.0.dylib to `/usr/local/opt/glib/lib/libgobject-2.0.0.dylib. I had to repeat this process around 15 times until I got all dependencies matched.

Here is the code used to create the folders:

sudo mkdir -p /usr/local/opt/glib/lib/
sudo mkdir -p /usr/local/opt/gtk+3/lib/
sudo mkdir -p /usr/local/opt/pango/lib/
sudo mkdir -p /usr/local/opt/harfbuzz/lib/
sudo mkdir -p /usr/local/opt/atk/lib/
sudo mkdir -p /usr/local/opt/cairo/lib/
sudo mkdir -p /usr/local/opt/gdk-pixbuf/lib/
sudo mkdir -p /usr/local/opt/gettext/lib/

And this is the code to create the symbolic links:

sudo ln -s /usr/local/homebrew/lib/libgobject-2.0.0.dylib /usr/local/opt/glib/lib/libgobject-2.0.0.dylib
sudo ln -s /usr/local/homebrew/lib/libgtk-3.0.dylib /usr/local/opt/gtk+3/lib/libgtk-3.0.dylib
sudo ln -s /usr/local/homebrew/lib/libgdk-3.0.dylib /usr/local/opt/gtk+3/lib/libgdk-3.0.dylib
sudo ln -s /usr/local/homebrew/lib/libpangocairo-1.0.0.dylib /usr/local/opt/pango/lib/libpangocairo-1.0.0.dylib
sudo ln -s /usr/local/homebrew/lib/libpango-1.0.0.dylib /usr/local/opt/pango/lib/libpango-1.0.0.dylib
sudo ln -s /usr/local/homebrew/lib/libharfbuzz.0.dylib /usr/local/opt/harfbuzz/lib/libharfbuzz.0.dylib
sudo ln -s /usr/local/homebrew/lib/libatk-1.0.0.dylib /usr/local/opt/atk/lib/libatk-1.0.0.dylib
sudo ln -s /usr/local/homebrew/lib/libcairo-gobject.2.dylib /usr/local/opt/cairo/lib/libcairo-gobject.2.dylib
sudo ln -s /usr/local/homebrew/lib/libcairo.2.dylib /usr/local/opt/cairo/lib/libcairo.2.dylib
sudo ln -s /usr/local/homebrew/lib/libgdk_pixbuf-2.0.0.dylib /usr/local/opt/gdk-pixbuf/lib/libgdk_pixbuf-2.0.0.dylib\n
sudo ln -s /usr/local/homebrew/lib/libgio-2.0.0.dylib /usr/local/opt/glib/lib/libgio-2.0.0.dylib
sudo ln -s /usr/local/homebrew/lib/libglib-2.0.0.dylib /usr/local/opt/glib/lib/libglib-2.0.0.dylib
sudo ln -s /usr/local/homebrew/lib/libintl.8.dylib /usr/local/opt/gettext/lib/libintl.8.dylib

Once I created all these links and accepted the security warnings from the MacOS, I was able to run the mac_czkawka_gui app without issues on Mac M1.

P.S The brew for X86-64 seems to be a bit broken!

Command-line

It works without doing all previous steps. I just cleaned my drive using the CLI during the time brew was installing all X86-64 packages :)

How to update installation instructions

I can format these instructions and send them as a PR to the installation.md file, however I think it will bloat too much the page for non Mac M1 users. What do you think about reorganizing the MacOS part, clearly defining the steps for the Intel and Mac M1 laptops (basic instructions for M1 like you need X86-64 brew, then libraries and test if it works). Additional instructions could be linked in a new specific article with all details for M1 users.

What do you think about it?

[1] Install instructions for brew X86-64 taken from: https://medium.com/mkdir-awesome/how-to-install-x86-64-homebrew-packages-on-apple-m1-macbook-54ba295230f

@qarmin qarmin added the documentation Improvements or additions to documentation label May 29, 2022
@teenjuna
Copy link

teenjuna commented Jun 6, 2023

+1

@qarmin
Copy link
Owner

qarmin commented Jun 6, 2023

New instruction was added in #945

@qarmin qarmin closed this as completed Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants