Maartz

Maartz

Excal issue on M1 macOS

Hi folks,

I got a Mac Mini on an M1 chip for work.
Because of an issue with :excal library, we decided to use Docker for the dev env.
Docker is good and it just works.

But Apple promises that with Rosetta 2, everything will run smoothly as previously.

After many manipulations like these:

echo 'alias rosetta="arch -x86_64 zsh"' >> ~/.zshrc

cd /usr/local
sudo mkdir homebrew
sudo chgrp admin homebrew
sudo chmod g+rwx homebrew
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew

# in zshrc
if [ "$(sysctl -n sysctl.proc_translated)" = "1" ]; then
    local brew_path="/usr/local/homebrew/bin"
else
    local brew_path="/opt/homebrew/bin"
fi
export PATH="${brew_path}:${PATH}"

# to be sure my shell is under rosetta or not
echo 'alias is_rosetta="echo $(sysctl -n sysctl.proc_translated)"' >> ~/.zshrc

# install some tools
brew install gcc make libical

Everything is installed, I mix deps.get and then run iex -S mix

I got this:

==> excal
mkdir -p priv/recurrence
cc -O3 -Wall -I/Users/nitram/.asdf/installs/erlang/23.3.4.4/erts-11.2.2.3/include -fPIC -shared -o priv/recurrence/iterator.so src/recurrence/iterator.c -lical -dynamiclib -undefined dynamic_lookup
src/recurrence/iterator.c:2:10: fatal error: 'libical/ical.h' file not found
#include "libical/ical.h"
         ^~~~~~~~~~~~~~~~
1 error generated.
make: *** [priv/recurrence/iterator.so] Error 1
could not compile dependency :excal, "mix compile" failed. You can recompile this dependency with "mix deps.compile excal", update it with "mix deps.update excal" or clean it with "mix deps.clean excal"
==> tuv2_back
** (Mix) Could not compile with "make" (exit status: 2).
You need to have gcc and make installed. Try running the
commands "gcc --version" and / or "make --version". If these programs
are not installed, you will be prompted to install them.

I can’t find anything related to this issue, any hints ?

Thanks!

Most Liked

joaoevangelista

joaoevangelista

I don’t know much about macOS but here are some things you might want to check, apologies if you already did.

The problem is that make can’t find the header files for libical.

Seems that with this Rosetta compat mode you launch a shell inside your current shell. Did you install the dependencies while on this Rosetta compat shell? So you need to use homebrew with rosetta, that will change the brew_path to /opt/homebrew/bin. I’ve found this blog and looking at your code wouldn’t the brew_path be switched ? Wouldn’t be like

if [ "$(sysctl -n sysctl.proc_translated)" = "1" ]; then
   # with rosetta
    local brew_path="/opt/homebrew/bin"
else
  # not with rosetta
   local brew_path="/usr/local/homebrew/bin"
fi
export PATH="${brew_path}:${PATH}"

The other point is that I would check if the mix deps.get and iex -S mix are running under rosetta too, so they pickup the correct PATH

joaoevangelista

joaoevangelista

Here are other problems/solutions while running Erlang on M1

Jason_P

Jason_P

Try adding these to your profile:

export LDFLAGS="-L/opt/homebrew/include"
export C_INCLUDE_PATH=/opt/homebrew/include
export CPLUS_INCLUDE_PATH=/opt/homebrew/include
export LIBRARY_PATH=/opt/homebrew/lib

Where Next?

Popular in Questions Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
Codball
Mix format works fine if run from the cmd. I’ve followed this to facilitate the implementation into VSC which involves downloading an ext...
New
wernerlaude
In AR this is so simple @articles = current_user.articles How to do in Ecto? def index(conn, _params) do current_user = conn.assig...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
idi527
I’ve been re-reading swift book again and noticed that multiline strings there don’t have a trailing line break, unlike in elixir iex(2)...
New

Other popular topics Top

yurko
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1140 51847 244
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 35421 110
New
New
polypush135
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New

We're in Beta

About us Mission Statement