tobytripp

tobytripp

Hi there, I’m trying to get started with Nerves but I get an error on the final step of the installation process.

I’m on an M1 Mac,
Elixir 1.15.1
Erlang 26.0.2

When I try to install nerves_bootstrap, the following is the result:

$ mix archive.install hex nerves_bootstrap
Resolving Hex dependencies…
Resolution completed in 0.019s
New:
nerves_bootstrap 1.11.5

  • Getting nerves_bootstrap (Hex package)
    All dependencies are up to date
    Compiling 12 files (.ex)

== Compilation error in file lib/attic/env.ex ==
** (ArgumentError) could not call Module.put_attribute/3 because the module Nerves.Bootstrap.Aliases is in read-only mode (@after_compile)
(elixir 1.15.1) lib/module.ex:2305: Module.assert_not_readonly!/2
(elixir 1.15.1) lib/module.ex:2007: Module.put_attribute/5
lib/attic/env.ex:2: (module)

Any ideas?

First 10 of 19 Posts Switch mode

fhunleth

fhunleth

Co-author of Nerves

Hi @tobytripp,

I think this is the first time we’ve seen this error. I just tried reproducing the error on an M1 Mac w/ Elixir 1.15.1 and Erlang 26.0.2 and couldn’t.

Could you give more details on your setup? How did you install Elixir and are there other archives installed? (run mix archive to get the installed archive list)

tobytripp

tobytripp OP

I installed elixir with asdf as described in the Nerves installation page. It’s a fresh install of elixir, so there are no other–aside from hex–archives installed.

tobytripp

tobytripp OP

So, I blitzed my asdf dir and started over. Now I get a different error:

$ mix archive.install hex nerves_bootstrap

Resolving Hex dependencies…
Resolution completed in 0.018s
New:
nerves_bootstrap 1.11.5

  • Getting nerves_bootstrap (Hex package)
    All dependencies are up to date
    Compiling 12 files (.ex)
    ** (FunctionClauseError) no function clause matching in Mix.Tasks.Local.Nerves.info/1

    The following arguments were given to Mix.Tasks.Local.Nerves.info/1:

      # 1
      :exports_md5
    

    Mix.Tasks.Local.Nerves.info/1
    (mix 1.15.1) lib/mix/compilers/elixir.ex:1015: Mix.Compilers.Elixir.compiler_loop/4
    (mix 1.15.1) lib/mix/compilers/elixir.ex:168: Mix.Compilers.Elixir.compile/7
    (mix 1.15.1) lib/mix/state.ex:15: Mix.State.lock/2
    (mix 1.15.1) lib/mix/task.ex:447: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.15.1) lib/mix/task.ex:502: Mix.Task.run_alias/6
    (mix 1.15.1) lib/mix/tasks/compile.all.ex:124: Mix.Tasks.Compile.All.run_compiler/2
    (mix 1.15.1) lib/mix/tasks/compile.all.ex:104: Mix.Tasks.Compile.All.compile/4

Even more puzzling, if I run it again, I get a third error:

$ mix archive.install hex nerves_bootstrap

Resolving Hex dependencies…
Resolution completed in 0.019s
New:
nerves_bootstrap 1.11.5

  • Getting nerves_bootstrap (Hex package)
    All dependencies are up to date
    Compiling 12 files (.ex)

== Compilation error in file lib/attic/deps.get.ex ==
** (ArgumentError) could not call Module.put_attribute/3 because the module Mix.Nerves.IO is already compiled
(elixir 1.15.1) lib/module.ex:2310: Module.assert_not_readonly!/2
(elixir 1.15.1) lib/module.ex:2007: Module.put_attribute/5
lib/attic/deps.get.ex:2: (module)

fhunleth

fhunleth

Co-author of Nerves

Could you check if Erlang was built with SSL?

$ iex
Erlang/OTP 26 [erts-14.0.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]

Interactive Elixir (1.15.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Application.ensure_all_started(:ssl)
{:ok, [:crypto, :asn1, :public_key, :ssl]}

If you don’t get what I got, you’ll need to brew install openssl and reinstall Erlang. There might be something else that’s helpful at GitHub - asdf-vm/asdf-erlang: Erlang plugin for asdf version manager · GitHub.

I’m really grasping, though. If you could copy all output starting from installing asdf, Erlang, and Elixir and finally the mix install hex nerves_bootstrap line, perhaps there’s a warning buried in there.

tobytripp

tobytripp OP

I get:

$ iex
Erlang/OTP 26 [erts-14.0.2] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit:ns]

Interactive Elixir (1.15.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Application.ensure_all_started(:ssl)
{:ok, [:crypto, :asn1, :public_key, :ssl]}

I’ll dig up the installation output momentarily.

tobytripp

tobytripp OP

Installation output:

$ asdf install erlang 26.0.2
Downloading kerl…
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 85117 100 85117 0 0 340k 0 --:–:-- --:–:-- --:–:-- 344k
asdf_26.0.2 is not a kerl-managed Erlang/OTP installation
No build named asdf_26.0.2
Downloading 26.0.2 to /Users/toby/.asdf/downloads/erlang/26.0.2…
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0
100 102M 100 102M 0 0 10.3M 0 0:00:09 0:00:09 --:–:-- 11.1M
Extracting source code
Building Erlang/OTP 26.0.2 (asdf_26.0.2), please wait…
DOCUMENTATION INFORMATION (See: /Users/toby/.asdf/plugins/erlang/kerl-home/builds/asdf_26.0.2/otp_build_26.0.2.log)

  • documentation :
  •              fop is missing.
    
  •              Using fakefop to generate placeholder PDF files.
    

Erlang/OTP 26.0.2 (asdf_26.0.2) has been successfully built
Cleaning up compilation products for 26.0.2
Cleaned up compilation products for 26.0.2 under /Users/toby/.asdf/plugins/erlang/kerl-home/builds

$ asdf install elixir 1.15.1-otp-26
==> Checking whether specified Elixir release exists…
==> Downloading 1.15.1-otp-26 to /Users/toby/.asdf/downloads/elixir/1.15.1-otp-26/elixir-precompiled-1.15.1-otp-26.zip
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6641k 100 6641k 0 0 5945k 0 0:00:01 0:00:01 --:–:-- 5972k
==> Copying release into place

jjcarstens

jjcarstens

Nerves Core Team

Can you run echo $KERL_CONFIGURE_OPTIONS and brew info openssl

Also, is Elixir 1.15.1 a hard requirement? Are you able to try 1.15.4?

tobytripp

tobytripp OP

$ echo $KERL_CONFIGURE_OPTIONS

$ brew info openssl
==> openssl@3: stable 3.1.2 (bottled)
Cryptography and SSL/TLS Toolkit
https://openssl.org/
/usr/local/Cellar/openssl@3/3.1.2 (6,495 files, 30.0MB) *
  Poured from bottle on 2023-08-12 at 12:39:26
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/openssl@3.rb
License: Apache-2.0
==> Dependencies
Required: ca-certificates ✔
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl@3/certs

and run
  /usr/local/opt/openssl@3/bin/c_rehash
==> Analytics
install: 419,609 (30 days), 945,723 (90 days), 1,199,741 (365 days)
install-on-request: 42,295 (30 days), 196,058 (90 days), 264,268 (365 days)
build-error: 1,658 (30 days)

I’ll try 1.15.4

tobytripp

tobytripp OP

mix archive.install hex nerves_bootstrap

* creating /Users/toby/.asdf/installs/elixir/1.15.4-otp-26/.mix/archives/hex-2.0.6
Resolving Hex dependencies...
Resolution completed in 0.018s
New:
  nerves_bootstrap 1.11.5
* Getting nerves_bootstrap (Hex package)
All dependencies are up to date
Compiling 12 files (.ex)

== Compilation error in file lib/mix/tasks/nerves/local.ex ==
** (ArgumentError) could not call Module.put_attribute/3 because the module Nerves.Bootstrap.MixProject is already compiled
    (elixir 1.15.4) lib/module.ex:2310: Module.assert_not_readonly!/2
    (elixir 1.15.4) lib/module.ex:2007: Module.__put_attribute__/5
    lib/mix/tasks/nerves/local.ex:2: (module)
jjcarstens

jjcarstens

Nerves Core Team

What directory are you in when running mix archive.install hex nerves_bootstrap?

Can you also try building Erlang with OpenSSL 1.1

brew install openssl@1.1
KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac --with-ssl=$(brew --prefix openssl@1.1)" asdf install Erlang 26.0.2

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
rahultumpala
Hello, I have an Elixir backend that implements a custom protocol over TCP. I want to load test the backend and assess the performance o...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New

We're in Beta

About us Mission Statement