alde103

alde103

Issues compiling a nerves custom system with v1.29.1 (buildroot 2024.08.3)

Hello everyone, I believe this issue is more related to Buildroot version (2024.08.3) than to Nerves itself, but I would still like to hear your thoughts.

I am trying to upgrade my custom_system based on rpi4 from version 1.27 to 1.29.1. However, when I try to compile, I get the following error:

** (Mix) Nerves encountered an error while constructing the artifact
/home/alde/Documents/Elixir/Nerves/repos/valiot_system_rpi4/packages/cloudflared/cloudflared.mk:19: *** Package 'cloudflared' defined a second time in '/home/alde/Documents/Elixir/Nerves/repos/valiot_system_rpi4/packages/cloudflared'; previous definition was in 'package/cloudflared'.  Stop.
make: *** [Makefile:23: _all] Error 2

It seems that in this new Buildroot version, the package I had manually added was included by default, causing a conflict. To resolve this, I had to rename the package (cloudflaredcloudflared-bin, since Buildroot does not have the latest version available). Everything seemed to work fine until another error appeared with the mosquitto package:

>>> mosquitto 2.0.19 Extracting
gzip -d -c /home/alde/.nerves/dl/mosquitto/mosquitto-2.0.19.tar.gz | /home/alde/Documents/Elixir/Nerves/repos/valiot_system_rpi4/.nerves/artifacts/valiot_system_rpi4-portable-1.29.1-valiot.16/host/bin/tar --strip-components=1 -C /home/alde/Documents/Elixir/Nerves/repos/valiot_system_rpi4/.nerves/artifacts/valiot_system_rpi4-portable-1.29.1-valiot.16/build/mosquitto-2.0.19  --no-same-owner -xf -
>>> mosquitto 2.0.19 Patching

Applying 0001-Revert-Fix-NetBSD-build.patch using patch: 
The next patch would create the file lib/dummypthread.h,
which already exists!  Skipping patch.
1 out of 1 hunk ignored
patching file lib/handle_pubackcomp.c
Reversed (or previously applied) patch detected!  Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file lib/handle_pubackcomp.c.rej
patching file lib/mosquitto_internal.h
Reversed (or previously applied) patch detected!  Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file lib/mosquitto_internal.h.rej
patching file lib/packet_mosq.c
Reversed (or previously applied) patch detected!  Skipping patch.
15 out of 15 hunks ignored -- saving rejects to file lib/packet_mosq.c.rej
The next patch would delete the file lib/pthread_compat.h,
which does not exist!  Skipping patch.
1 out of 1 hunk ignored
patching file lib/util_mosq.c
Reversed (or previously applied) patch detected!  Skipping patch.
8 out of 8 hunks ignored -- saving rejects to file lib/util_mosq.c.rej
make[1]: *** [package/pkg-generic.mk:247: /home/alde/Documents/Elixir/Nerves/repos/valiot_system_rpi4/.nerves/artifacts/valiot_system_rpi4-portable-1.29.1-valiot.16/build/mosquitto-2.0.19/.stamp_patched] Error 1
make: *** [Makefile:23: _all] Error 2

It seems that in this Buildroot version, the patch doesn’t works. My question is: what would be the best way to handle this situation?

I could do the same as with the cloudflared package—create an external package for Buildroot (mosquitto-2), disable mosquitto (from Buildroot), and enable mosquitto-2. However, I’m not sure if that is the best approach. What do you think?

P.S. To check if there were other problematic packages, I removed mosquitto from the system, and the compilation completed successfully :slight_smile: .

Most Liked

alde103

alde103

Just to wrap up the topic, I created a mosquitto-external package as an external Buildroot package. I copied the mosquitto package from the Buildroot 2024.11.2 release (which appears to have been updated to mosquitto 2.0.20), adjusted some environment variables to match the new package name, and it compiled successfully. :slightly_smiling_face:

Thanks, everyone!

jjcarstens

jjcarstens

Nerves Core Team

FWIW, both cloudflared and mosquito provide prebuilt binaries and I’ve used them with previous firmwares just downloading the version I need. It doesn’t answer the original question, but my preference is always prebuilt binaries over buildroot unless it’s absolutely required to use and compile myself

abelino

abelino

You can take a similar approach to what you did with cloudflared-bin by creating a new mosquitto package in your Nerves system under a different name. Thanks to Git history, you can easily retrieve a previous working version [0].

Alternatively, if you’re able to debug and fix the issue in the latest Mosquitto version, you could create a patch for it. Since Buildroot tends to lag behind on package versions, someone else might have already addressed the problem. The key is to find the relevant patch in the upstream project repo and incorporate it into your Nerves system.

[0] buildroot/package/mosquitto at 236dc1015cbda9b0c3479e2f37cb09c507da04dc · buildroot/buildroot · GitHub

Where Next?

Popular in Questions Top

9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
Kurisu
For example for a current url like http://localhost:4000/cosmetic/products?_utf8=✓&query=perfume&page=2, I would like to get: ...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New
dotdotdotPaul
Okay, I’m having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I’m sure I’...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

Other popular topics Top

JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

We're in Beta

About us Mission Statement