mix deps.get fails when using nerves-web-kiosk/kiosk_system_rpi4

When trying to do a mix deps.get in a freshly cloned copy of github nerves-web-kiosk/kiosk_system_rpi4. I get the following failure.

20:52:03.598 [error] GenServer #PID<0.306.0> terminating
** (FunctionClauseError) no function clause matching in Nerves.Utils.HTTPClient.handle_info/2
    (nerves 1.5.1) lib/nerves/utils/http_client.ex:81: Nerves.Utils.HTTPClient.handle_info({:http, {#Reference<0.1639108394.1962409985.197879>, {:error, :socket_closed_remotely}}}, %{buffer: "", buffer_size: 0, caller: {#PID<0.94.0>, #Reference<0.1639108394.1962409985.197862>}, content_length: 0, filename: "", number_of_redirects: 1, opts: [stream: :self, receiver: #PID<0.306.0>, sync: false], progress?: true, url: "https://github-releases.githubusercontent.com/63556949/7a2c2400-85ec-11e9-8c20-70a3c2696d5d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20211125%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20211125T204203Z&X-Amz-Expires=300&X-Amz-Signature=b05b3e0ee5ac6a968b37309d712c36e61e0d8e977966f0ee2e28c8ae38753703&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=63556949&response-content-disposition=attachment%3B%20filename%3Dnerves_toolchain_arm_unknown_linux_gnueabihf-linux_x86_64-1.2.0-EDC6266.tar.xz&response-content-type=application%2Foctet-stream"})
    (stdlib 3.16.1) gen_server.erl:695: :gen_server.try_dispatch/4
    (stdlib 3.16.1) gen_server.erl:771: :gen_server.handle_msg/6
    (stdlib 3.16.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: {:http, {#Reference<0.1639108394.1962409985.197879>, {:error, :socket_closed_remotely}}}
State: %{buffer: "", buffer_size: 0, caller: {#PID<0.94.0>, #Reference<0.1639108394.1962409985.197862>}, content_length: 0, filename: "", number_of_redirects: 1, opts: [stream: :self, receiver: #PID<0.306.0>, sync: false], progress?: true, url: "https://github-releases.githubusercontent.com/63556949/7a2c2400-85ec-11e9-8c20-70a3c2696d5d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20211125%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20211125T204203Z&X-Amz-Expires=300&X-Amz-Signature=b05b3e0ee5ac6a968b37309d712c36e61e0d8e977966f0ee2e28c8ae38753703&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=63556949&response-content-disposition=attachment%3B%20filename%3Dnerves_toolchain_arm_unknown_linux_gnueabihf-linux_x86_64-1.2.0-EDC6266.tar.xz&response-content-type=application%2Foctet-stream"}
** (EXIT from #PID<0.94.0>) an exception was raised:
    ** (FunctionClauseError) no function clause matching in Nerves.Utils.HTTPClient.handle_info/2
        (nerves 1.5.1) lib/nerves/utils/http_client.ex:81: Nerves.Utils.HTTPClient.handle_info({:http, {#Reference<0.1639108394.1962409985.197879>, {:error, :socket_closed_remotely}}}, %{buffer: "", buffer_size: 0, caller: {#PID<0.94.0>, #Reference<0.1639108394.1962409985.197862>}, content_length: 0, filename: "", number_of_redirects: 1, opts: [stream: :self, receiver: #PID<0.306.0>, sync: false], progress?: true, url: "https://github-releases.githubusercontent.com/63556949/7a2c2400-85ec-11e9-8c20-70a3c2696d5d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20211125%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20211125T204203Z&X-Amz-Expires=300&X-Amz-Signature=b05b3e0ee5ac6a968b37309d712c36e61e0d8e977966f0ee2e28c8ae38753703&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=63556949&response-content-disposition=attachment%3B%20filename%3Dnerves_toolchain_arm_unknown_linux_gnueabihf-linux_x86_64-1.2.0-EDC6266.tar.xz&response-content-type=application%2Foctet-stream"})
        (stdlib 3.16.1) gen_server.erl:695: :gen_server.try_dispatch/4
        (stdlib 3.16.1) gen_server.erl:771: :gen_server.handle_msg/6
        (stdlib 3.16.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3

I am complete newbie to nerves so I have no idea how to go about resolving this. My host system is Ubuntu 21.10.

Any help will be greatly appreciated.

try this: Browser in Nerves (kiosk-mode) - #10 by Sebb

Thanks @Sepp that gave me some more pointers.

The instructions in the README for the kiosk_system_rpi4 contain the following.

The most common way of using this Nerves System is create a project with mix nerves.new and to export MIX_TARGET=rpi4. See the Getting started guide for more information.

I realise now that this is misleading to a newbie like me. Having cloned the repo I took a guess and ran mix nerves.new in root of my cloned repo. This is obviously incorrect as that just creates an empty nerves project. I realise now the repo itself is an already created nerves project. So I tried running mix deps.get in the root of my repo. This gave this error.

======================================
Resolving Hex dependencies…
Dependency resolution completed:
Unchanged:
earmark_parser 1.4.17
elixir_make 0.6.3
ex_doc 0.26.0
makeup 1.0.5
makeup_elixir 0.15.2
makeup_erlang 0.1.1
nerves 1.7.12
nerves_system_br 1.9.1
nerves_system_linter 0.3.0
nerves_toolchain_arm_unknown_linux_gnueabihf 1.2.0
nerves_toolchain_ctng 1.6.0
nimble_parsec 1.2.0
All dependencies are up to date

Nerves environment
MIX_TARGET: target
MIX_ENV: dev

==> nerves
==> kiosk_system_rpi4
Resolving Nerves artifacts…
Resolving kiosk_system_rpi4
=> Trying https://github.com/nerves-project/kiosk_system_rpi4/releases/download/v1.8.2/kiosk_system_rpi4-portable-1.8.2-4489533.tar.gz

10:26:17.219 [warn] Description: ‘Authenticity is not established by certificate path validation’
Reason: ‘Option {verify, verify_peer} and cacertfile/cacerts is missing’

 Status 404 Not Found                                                                                 

=> Trying https://github.com/nerves-project/kiosk_system_rpi4/releases/download/v1.8.2/kiosk_system_rpi4-portable-1.8.2-448953331EB7DC0EEFCB57351D1F199F2984DC770AF4E224BFBEA3F73E228D48.tar.gz
Status 404 Not Found
=> no_result
Cached nerves_toolchain_arm_unknown_linux_gnueabihf

The next thing I tried was running mix deps.get in the example subdirectory. This gave me this error.

===================================
Resolving Hex dependencies…
Dependency resolution completed:
Unchanged:
circular_buffer 0.4.0
dns 2.3.0
elixir_make 0.6.3
mdns 1.0.12
muontrap 1.0.0
nerves 1.5.5
nerves_firmware_ssh 0.4.6
nerves_init_gadget 0.7.0
nerves_network 0.5.5
nerves_network_interface 0.4.6
nerves_runtime 0.11.8
nerves_system_br 1.9.1
nerves_system_linter 0.3.0
nerves_time 0.4.4
nerves_toolchain_arm_unknown_linux_gnueabihf 1.2.0
nerves_toolchain_ctng 1.6.0
nerves_wpa_supplicant 0.5.2
one_dhcpd 0.2.5
ring_logger 0.8.2
shoehorn 0.8.0
socket 0.3.13
system_registry 0.8.2
toolshed 0.2.25
uboot_env 1.0.0

Nerves environment
MIX_TARGET: host
MIX_ENV: dev

Unchecked dependencies for environment dev:

  • webengine_kiosk (~/dev/fhunleth/webengine_kiosk)
    the dependency is not available
    ** (Mix) Can’t continue due to errors on dependencies
    =================================

So I am guessing that I have got to work out where these resources really are. Then move out of the cloned repo and do a mix create.new somewhere else. Then using the two mix.exs files in the repo as examples create my own mix.exs file thay points to the right locations.

Am I on the right track now?

Can anyone give me a hint about what these dependency urls should be?

Roger

You have to use the kiosk-system as dependency in a project you created with mix nerves.new, You should not have a dependency to another system. You need a compatible Erlang/Elixir version installed. Or: just rpeeat the steps I linked.

I have made some progress. This is a steep learning curve!
The mix.exs files in the kiosk-system-rpi4 repo are significantly different from the ones in kiosk_system_rpi3 repo. I have modified the one in the top level of the rpi4 repo as below.

defmodule KioskSystemRpi4.MixProject do
  use Mix.Project

  @app :kiosk_system_rpi4
  @version Path.join(__DIR__, "VERSION")
           |> File.read!()
           |> String.trim()


  def project do
    [
      app: @app,
      version: @version,
      elixir: "~> 1.6",
      compilers: Mix.compilers() ++ [:nerves_package],
      nerves_package: nerves_package(),
      description: description(),
      package: package(),
      deps: deps(),
      aliases: [loadconfig: [&bootstrap/1], docs: ["docs", &copy_images/1]],
      docs: [extras: ["README.md"], main: "readme"]
    ]
  end

  def application do
    []
  end

  defp bootstrap(args) do
    set_target()
    Application.start(:nerves_bootstrap)
    Mix.Task.run("loadconfig", args)
  end

  defp nerves_package do
    [
      type: :system,
#      artifact_sites: [
#       {:github_releases, "nerves-project/#{@app}"}
#      ],
      build_runner_opts: build_runner_opts(),
      platform: Nerves.System.BR,
      platform_config: [
        defconfig: "nerves_defconfig"
      ],
      checksum: package_files()
    ]
  end

  defp deps do
    [
      {:nerves, "~> 1.7", runtime: false},
      {:nerves_system_br, "1.13.2", runtime: false},
      {:nerves_toolchain_arm_unknown_linux_gnueabihf, "1.3.2", runtime: false},
      {:nerves_system_linter, "~> 0.4", runtime: false},
      {:ex_doc, "~> 0.18", only: [:dev, :test], runtime: false}
    ]
  end

  defp description do
    """
    Nerves System - Raspberry Pi 4
    """
  end

  defp package do
    [
      files: package_files(),
      licenses: ["Apache 2.0"],
      links: %{"GitHub" => "https://github.com/nerves-project/#{@app}"}
    ]
  end

  defp package_files do
    [
      "fwup_include",
      "rootfs_overlay",
      "CHANGELOG.md",
      "cmdline.txt",
      "config.txt",
      "fwup-revert.conf",
      "fwup.conf",
      "LICENSE",
      "linux-4.19.defconfig",
      "mix.exs",
      "nerves_defconfig",
      "post-build.sh",
      "post-createfs.sh",
      "ramoops.dts",
      "README.md",
      "VERSION"
    ]
  end

  # Copy the images referenced by docs, since ex_doc doesn't do this.
  defp copy_images(_) do
    File.cp_r("assets", "doc/assets")
  end

  defp build_runner_opts() do
    if primary_site = System.get_env("BR2_PRIMARY_SITE") do
      [make_args: ["BR2_PRIMARY_SITE=#{primary_site}"]]
    else
      []
    end
  end

  defp set_target() do
    if function_exported?(Mix, :target, 1) do
      apply(Mix, :target, [:target])
    else
      System.put_env("MIX_TARGET", "target")
    end
  end
end

This should stop the build system looking for non existent relwase targets. I have created a mix,exs for my project as shown below

defmodule Kiosk.MixProject do
  use Mix.Project

  @app :kiosk
  @version "0.1.0"
  @all_targets [:rpi, :rpi0, :rpi2, :rpi3, :rpi3a, :rpi4, :bbb, :osd32mp1, :x86_64]

  def project do
    [
      app: @app,
      version: @version,
      elixir: "~> 1.9",
      archives: [nerves_bootstrap: "~> 1.10"],
      start_permanent: Mix.env() == :prod,
      build_embedded: true,
      deps: deps(),
      releases: [{@app, release()}],
      preferred_cli_target: [run: :host, test: :host]
    ]
  end

  # Run "mix help compile.app" to learn about applications.
  def application do
    [
      mod: {Kiosk.Application, []},
      extra_applications: [:logger, :runtime_tools]
    ]
  end

  # Run "mix help deps" to learn about dependencies.
  defp deps do
    [
      # Dependencies for all targets
      {:nerves, "~> 1.7.4", runtime: false},
      {:shoehorn, "~> 0.7.0"},
      {:ring_logger, "~> 0.8.1"},
      {:toolshed, "~> 0.2.13"},
      {:webengine_kiosk, "~> 0.3"},

      # Dependencies for all targets except :host
      {:nerves_runtime, "~> 0.11.3", targets: @all_targets},
      {:nerves_pack, "~> 0.6.0", targets: @all_targets},

      # Dependencies for specific targets
      {:kiosk_system_rpi4,
        path: "~/kiosk_system_rpi4/",
        nerves: [compile: true],
        runtime: false, targets: :rpi4}
    ]
  end

  def release do
    [
      overwrite: true,
      # Erlang distribution is not started automatically.
      # See https://hexdocs.pm/nerves_pack/readme.html#erlang-distribution
      cookie: "#{@app}_cookie",
      include_erts: &Nerves.Release.erts/0,
      steps: [&Nerves.Release.init/1, :assemble],
      strip_beams: Mix.env() == :prod or [keep: ["Docs"]]
    ]
  end
end

My hope was this force mix to to recompile the kiosk project. This appears to work. But the compile fails as below.

Resolving Hex dependencies...
Dependency resolution completed:
Unchanged:
  beam_notify 1.0.0
  circular_buffer 0.4.0
  elixir_make 0.6.3
  gen_state_machine 3.0.0
  mdns_lite 0.8.4
  muontrap 1.0.0
  nerves 1.7.12
  nerves_motd 0.1.5
  nerves_pack 0.6.0
  nerves_runtime 0.11.8
  nerves_ssh 0.2.3
  nerves_system_br 1.13.2
  nerves_system_linter 0.4.0
  nerves_time 0.4.4
  nerves_toolchain_arm_unknown_linux_gnueabihf 1.3.2
  nerves_toolchain_ctng 1.7.2
  one_dhcpd 1.0.0
  ring_logger 0.8.2
  shoehorn 0.7.0
  ssh_subsystem_fwup 0.6.0
  system_registry 0.8.2
  toolshed 0.2.25
  uboot_env 1.0.0
  vintage_net 0.11.3
  vintage_net_direct 0.10.3
  vintage_net_ethernet 0.10.3
  vintage_net_wifi 0.10.6
  webengine_kiosk 0.3.0

Nerves environment
  MIX_TARGET:   rpi4
  MIX_ENV:      dev

==> nerves
==> kiosk
Resolving Nerves artifacts...
  Resolving kiosk_system_rpi4
  Skipping kiosk_system_rpi4
  Cached nerves_toolchain_arm_unknown_linux_gnueabihf
roger@dragon:~/toasty/kiosk$ mix firmware
==> nerves
make: Entering directory '/home/roger/toasty/kiosk/deps/nerves_system_br/buildroot-2020.08'
  GEN     /home/roger/kiosk_system_rpi4/.nerves/artifacts/kiosk_system_rpi4-portable-1.8.2/Makefile
#
# configuration written to /home/roger/kiosk_system_rpi4/.nerves/artifacts/kiosk_system_rpi4-portable-1.8.2/.config
#
make: Leaving directory '/home/roger/toasty/kiosk/deps/nerves_system_br/buildroot-2020.08'
------------

Build directory successfully created.

Configuration: /home/roger/kiosk_system_rpi4/nerves_defconfig

Next, do the following:
   1. cd /home/roger/kiosk_system_rpi4/.nerves/artifacts/kiosk_system_rpi4-portable-1.8.2
   2. make

For additional options, run 'make help' in the build directory.

IMPORTANT: If you update nerves_system_br, you should rerun this script.

>>> host-m4 1.4.18 Building==> kiosk_system_rpi4
could not compile dependency :kiosk_system_rpi4, "mix compile" failed. You can recompile this dependency with "mix deps.compile kiosk_system_rpi4", update it with "mix deps.update kiosk_system_rpi4" or clean it with "mix deps.clean kiosk_system_rpi4"
==> kiosk
** (Mix) Nerves encountered an error while constructing the artifact
/usr/bin/make -j1 O=/home/roger/kiosk_system_rpi4/.nerves/artifacts/kiosk_system_rpi4-portable-1.8.2 HOSTCC="/usr/bin/gcc" HOSTCXX="/usr/bin/g++" syncconfig
  GEN     /home/roger/kiosk_system_rpi4/.nerves/artifacts/kiosk_system_rpi4-portable-1.8.2/Makefile
>>> host-m4 1.4.18 Building
PATH="/home/roger/kiosk_system_rpi4/.nerves/artifacts/kiosk_system_rpi4-portable-1.8.2/host/bin:/home/roger/kiosk_system_rpi4/.nerves/artifacts/kiosk_system_rpi4-portable-1.8.2/host/sbin:/home/roger/.asdf/installs/erlang/24.1.5/erts-12.1.5/bin:/home/roger/.asdf/installs/erlang/24.1.5/bin:/home/roger/.asdf/plugins/elixir/shims:/home/roger/.asdf/installs/elixir/1.12.3-otp-24/bin:/home/roger/.asdf/installs/elixir/1.12.3-otp-24/.mix/escripts:/home/roger/.asdf/shims:/home/roger/.asdf/bin:/home/roger/.yarn/bin:/home/roger/.config/yarn/global/node_modules/.bin:/home/roger/.local/bin:/opt/cross-pi-gcc/bin:/home/roger/xamarin.android-oss_v8.3.99.189_Linux-x86_64_HEAD_7b85e47/bin/Release/bin:/home/roger/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/roger/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin" PKG_CONFIG="/home/roger/kiosk_system_rpi4/.nerves/artifacts/kiosk_system_rpi4-portable-1.8.2/host/bin/pkg-config" PKG_CONFIG_SYSROOT_DIR="/" PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_LIBDIR="/home/roger/kiosk_system_rpi4/.nerves/artifacts/kiosk_system_rpi4-portable-1.8.2/host/lib/pkgconfig:/home/roger/kiosk_system_rpi4/.nerves/artifacts/kiosk_system_rpi4-portable-1.8.2/host/share/pkgconfig"  /usr/bin/make -j9  -C /home/roger/kiosk_system_rpi4/.nerves/artifacts/kiosk_system_rpi4-portable-1.8.2/build/host-m4-1.4.18/
/usr/bin/make  all-recursive
Making all in .
make[4]: Nothing to be done for 'all-am'.
Making all in examples
make[4]: Nothing to be done for 'all'.
Making all in lib
/usr/bin/make  all-am
  CC       c-stack.o
  CC       getprogname.o
  CC       hard-locale.o
  CC       gl_linkedhash_list.o
  CC       gl_list.o
  CC       localcharset.o
  CC       malloca.o
  CC       math.o
  CC       memchr2.o
  CC       gl_oset.o
  CC       pipe2.o
In file included from /usr/include/signal.h:328,
                 from ./signal.h:52,
                 from c-stack.c:49:
c-stack.c:55:26: error: missing binary operator before token "("
   55 | #elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384
      |                          ^~~~~~~~
make[5]: *** [Makefile:1915: c-stack.o] Error 1
make[5]: *** Waiting for unfinished jobs....
make[4]: *** [Makefile:1674: all] Error 2
make[3]: *** [Makefile:1572: all-recursive] Error 1
make[2]: *** [Makefile:1528: all] Error 2
make[1]: *** [package/pkg-generic.mk:250: /home/roger/kiosk_system_rpi4/.nerves/artifacts/kiosk_system_rpi4-portable-1.8.2/build/host-m4-1.4.18/.stamp_built] Error 2
make: *** [Makefile:23: _all] Error 2

It is hard work out what is going on here! Is there any way to force mix not run make in multiple job mode?
Hast anyone got any ideas on the error?

Roger

sorry I thought you wanted to use rpi3.
The rpi4 system has no release, so its harder to get running.
Maybe impossible if you don’t know some internals.
Also the example has some local links in there and you’ve to adjust the paths and make sure everything is there (except if youre fhunleth).

I’d go for the rpi3 version if possible.
I can’t tell you what to do for rpi4 without trying out myself first and I do not have the time right now.

I was thinking the same way myself. I think I will put the pi4 version on the back burner for now.

I ran into exactly the same problems when trying to use the rpi3 version.

The default seems to be to build a host “firmware” as well as a target firmware. It is the host build that is failing.

The problem is occurring because of a recent change in the gnu libc definition of SIGSTKSZ in the architecture dependant sigstksz.h file for x86_64. This is now no longer a constant but a function call. The causes an error in the build for host-m4.

See https://sourceware.org/pipermail/libc-alpha/2021-March/123553.html

I managed to get past this with these mods to the mix.exs

--- a/mix.exs
+++ b/mix.exs
@@ -36,9 +36,9 @@ defmodule KioskSystemRpi3.MixProject do
   defp nerves_package do
     [
       type: :system,
-      artifact_sites: [
-        {:github_releases, "#{@github_organization}/#{@app}"}
-      ],
+      #artifact_sites: [
+      #  {:github_releases, "#{@github_organization}/#{@app}"}
+      #],
       build_runner_opts: build_runner_opts(),
       platform: Nerves.System.BR,
       platform_config: [
@@ -51,7 +51,7 @@ defmodule KioskSystemRpi3.MixProject do
   defp deps do
     [
       {:nerves, "~> 1.5.4 or ~> 1.6.0 or ~> 1.7.0", runtime: false},
-      {:nerves_system_br, "1.13.5", runtime: false},
+      {:nerves_system_br, "> 1.13.5", runtime: false},
       {:nerves_toolchain_arm_unknown_linux_gnueabihf, "~> 1.3.0", runtime: false},
       {:nerves_system_linter, "~> 0.3.0", only: [:dev, :test], runtime: false},
       {:ex_doc, "~> 0.18", only: [:dev, :test], runtime: false}

Unfortunately after a number of hours of building it failed with the following.

Package freetype2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `freetype2.pc'
to the PKG_CONFIG_PATH environment variable
Package 'freetype2', required by 'virtual:world', not found
Could not run pkg-config.

See //build/linux/BUILD.gn:24:3: whence it was called.
  pkg_config("freetype_from_pkgconfig") {
  ^--------------------------------------
See //build/config/freetype/BUILD.gn:10:24: which caused the file to be included.
    public_configs = [ "//build/linux:freetype_from_pkgconfig" ]
                       ^--------------------------------------
Project ERROR: GN run error!
make[4]: *** [Makefile:82: sub-gn_run-pro-make_first] Error 3
make[3]: *** [Makefile:79: sub-core-make_first] Error 2
make[2]: *** [Makefile:49: sub-src-make_first] Error 2
make[1]: *** [package/pkg-generic.mk:270: /home/roger/kiosk_system_rpi3/.nerves/artifacts/kiosk_system_rpi3-portable-1.10.0/build/qt5webengine-5.15.2/.stamp_built] Error 2
make: *** [Makefile:23: _all] Error 2

Before I dive into this. Is there an easy way to stop mix building the host version? I do not need it.

Roger

Why do you think, that nerves tries to build a firmware for the host? I don’t think that’s right.

You normally do not need to build a nerves system (if it has a release).
If you create a new project with mix nerves.new and set the kiosk-system as a dependency, mix deps.get will load the prebuild system from artifact_sites given in nerves_package/0.

If you think you have to rebuild the system for whatever reason, there is an easier way - some option I forgot. :roll_eyes:

If you want to understand whats going on, this may help: WIP - nerves bootstrap walkthrough · GitHub

I’m taking notes while I try to understand whats going on when you do

mix nerves.new dummy
dummy$ mix deps.get
dummy$ mix firmware

Warning: WIP

I suspect this would all work if I went back to system with an earlier version of ubuntu. My current system is 21.10 and the libc version is 2.34. The change to sigstksz.h that causes the build problems falls between the 2.33 and 2.34 versions.

mix firmware initially fails because {:github_releases, “#{@github_organization}/#{@app}”} generates a url for a file that does not exist. The only way I can get past that is to comment out the artifact_sites clause.

mix firmware starts off by building a whole slew of host-*** make targets and then eventually fails building the host-m4 target.

It does not make any sense to me either that this is done. I suppose it is to provide some sort of host container for testing.

Catch 22.

ok, thats odd. What is the URL generated? Should be

https://github.com/nerves-web-kiosk/kiosk_system_rpi3/releases/download/v1.10.0/kiosk_system_rpi3-portable-1.10.0-FE56A7F.tar.gz

which is there.

Show me how you added the kiosk system to your project’s mix.exs deps.

You can also download the file manually if for some reason you really can’t download the file (there was a bug that prevents this, but with the correct erlang/elixir version and mix deps.update --all - see steps I posted in the other thread - you should not run into this.)

It tries

https://github.com/nerves-web-kiosk/kiosk_system_rpi3/releases/download/v1.10.0/kiosk_system_rpi3-portable-1.10.0-0095F22.tar.gz

Then

https://github.com/nerves-web-kiosk/kiosk_system_rpi3/releases/download/v1.10.0/kiosk_system_rpi3-portable-1.10.0-0095F222E0F78A6A147BDB227BA3BBBBE14644ECCDB18745B658070C045B8F26.tar.gz

I know this Is because I am not using the versions you suggest. If I use them, then I end up with a firmware that hangs on boot. Catch 22. This is why I am trying to fix it. I am using the mix.exs in the example directory.

I will try the manual download route as you suggest.

I had a delve into buildroot. My problem is occuring when buildroot is trying to build the cross compilation toolchain. This obviously has to be compiled for the host environment. That is why signal.h from my host system was being used.

The reason can be found here [Buildroot] [PATCH 1/1] package/m4: fix build with glibc 2.34

I just have to work out how to fix it! Looks like I need to be using the 2021.02.x version of buildroot.

Did you also keep this line: kiosk_system_rpi3/mix.exs at ce63a8184749ae9007c9e9c0492f3f3b0402788f · nerves-web-kiosk/kiosk_system_rpi3 · GitHub

That would be the reason why you can’t download the release.
If you want the release to be downloaded you have to reference the the dep on hex.

Assuming you want to build the system (because of the hang) I am not of much help, because I just start to understand how to do that. But I think you then should clone the kiosk-system-repo and build it there.

I think you do not need to build the toolchain, you can also download this. I think if you clone the system-repo and rebuild it the cached toolchain will be used.

Thanks Sebb for all the help you are giving me!

The patch went into the buildroot source on April 26th this year. So I need a nerves_system_br version from after that date. For my own satisfaction I want to fix this. But then I will probably end up having to go back to the prebuilt versions anyway :-).

Once again thanks for your time on this.

best of luck, would be great if you could write some notes about what you did.

I have not made any changes to the mix.exs in the example directory. Not sure what you mean by “reference the dep on hex”.

The bad link is generated by the following lines in the mix.exs in the kiosk…pi3 directory.

      #artifact_sites: [
      #  {:github_releases, "#{@github_organization}/#{@app}"}
      #],

That is why I commented them out, and started on this long and tortuous journey.

Hot off the press. mix deps.compile has just got past building host-m4. These are to changes to mix.exs.

diff --git a/mix.exs b/mix.exs
index 562e332..c22f3ed 100644
--- a/mix.exs
+++ b/mix.exs
@@ -36,9 +36,9 @@ defmodule KioskSystemRpi3.MixProject do
   defp nerves_package do
     [
       type: :system,
-      artifact_sites: [
-        {:github_releases, "#{@github_organization}/#{@app}"}
-      ],
+      #artifact_sites: [
+      #  {:github_releases, "#{@github_organization}/#{@app}"}
+      #],
       build_runner_opts: build_runner_opts(),
       platform: Nerves.System.BR,
       platform_config: [
@@ -51,7 +51,7 @@ defmodule KioskSystemRpi3.MixProject do
   defp deps do
     [
       {:nerves, "~> 1.5.4 or ~> 1.6.0 or ~> 1.7.0", runtime: false},
-      {:nerves_system_br, "1.13.5", runtime: false},
+      {:nerves_system_br, "1.16.0", runtime: false},
       {:nerves_toolchain_arm_unknown_linux_gnueabihf, "~> 1.3.0", runtime: false},
       {:nerves_system_linter, "~> 0.3.0", only: [:dev, :test], runtime: false},
       {:ex_doc, "~> 0.18", only: [:dev, :test], runtime: false}

It takes a few hours to build or fail to build all the deps. The last time I got past this it failed in the cross compilation phase for the pi3 target looking for freetype2.

{:kiosk_system_rpi3, path: "../", runtime: false, targets: :rpi3}

references a local version, if you want to use the official release you have to get the dep from hex like

{:kiosk_system_rpi3, path: "~> 1.10.0", targets: :rpi3}

But please, keep on going building those yourself. Should be more fun (and pain).

Btw, if you want to get around version conflicts, there is also a docker builder. But I did not look into that yet. Will continue my venture into the depths of nerves next week.

I am throwing in the towel. I cannot get any of this stuff to work. I have reached an absolute dead end. The gcc and glibc environment on Ubuntu 21.10 will not build this stuff.

The only way to get anywhere near a bootable system is Sebb’s solution. But that does not get past the nerves boot screen on a pi3, and cannot be booted on a pi4 (as expected). The kiosk_system_rpi3 repo has not had any updates since last January. The rpi4 repo has not had any significant updates since September 2019.

I really, really like the concept of nerves. So I hope the good work goes on. I think it would make a great fit for the rpi compute module 400 in the future.

Roger