BitBoxSwiss / bitbox02-firmware

Firmware code of the BitBox02 hardware wallet
https://bitbox.swiss/bitbox02
Apache License 2.0
215 stars 80 forks source link

Dockerfile for reproducible build may have an issue #1218

Open 77corn opened 1 month ago

77corn commented 1 month ago
[+] Building 66.6s (9/38)                                                                                                                                                                                 docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                                                                      0.0s
 => => transferring dockerfile: 5.00kB                                                                                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                                                                                         0.0s
 => => transferring context: 74B                                                                                                                                                                                          0.0s
 => [internal] load metadata for docker.io/library/ubuntu:22.04                                                                                                                                                           2.3s
 => [internal] load build context                                                                                                                                                                                         0.0s
 => => transferring context: 285.32kB                                                                                                                                                                                     0.0s
 => CACHED [ 1/34] FROM docker.io/library/ubuntu:22.04@sha256:a6d2b38300ce017add71440577d5b0a90460d0e57fd7aec21dd0d1b0761bbfb2                                                                                            0.0s
 => [ 2/34] RUN apt-get update && apt-get upgrade -y && apt-get install -y wget nano rsync curl gnupg2 jq unzip bzip2                                                                                                    29.7s
 => [ 3/34] RUN echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" >> /etc/apt/sources.list &&     echo "deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" >> /etc/apt/sources.list &&     0.5s
 => [ 4/34] RUN mkdir ~/Downloads &&    cd ~/Downloads &&    wget -O gcc.tar.bz2 https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2018q4/gcc-arm-none-eabi-8-2018-q4-major-linux.tar.bz2?revision=d830f9dd-cd  27.5s 
 => ERROR [ 5/34] RUN apt-get update && apt-get install -y     build-essential     llvm-15     gcc-10     binutils     valgrind     cmake     git     autotools-dev     automake     autoconf     libtool     pkg-config  6.5s 
------                                                                                                                                                                                                                         
 > [ 5/34] RUN apt-get update && apt-get install -y     build-essential     llvm-15     gcc-10     binutils     valgrind     cmake     git     autotools-dev     automake     autoconf     libtool     pkg-config     libcmocka-dev     libc6-i386     lib32stdc++6     lib32z1     libusb-1.0-0-dev     libudev-dev     libhidapi-dev:                                                                                                                       
4.794 Hit:2 http://ports.ubuntu.com/ubuntu-ports jammy InRelease                                                                                                                                                               
4.825 Hit:3 http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease                                                                                                                                                       
4.875 Hit:4 http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease                                                                                                                                                     
4.933 Get:1 https://apt.llvm.org/jammy llvm-toolchain-jammy-15 InRelease [6833 B]
4.942 Hit:5 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease
5.034 Get:6 https://apt.llvm.org/jammy llvm-toolchain-jammy-15/main Sources [1997 B]
5.071 Get:7 https://apt.llvm.org/jammy llvm-toolchain-jammy-15/main arm64 Packages [12.1 kB]
5.077 Fetched 20.9 kB in 5s (4400 B/s)
5.077 Reading package lists...
5.538 W: http://apt.llvm.org/jammy/dists/llvm-toolchain-jammy-15/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
5.561 Reading package lists...
6.192 Building dependency tree...
6.365 Reading state information...
6.414 E: Unable to locate package libc6-i386
6.414 E: Unable to locate package lib32stdc++6
6.414 E: Couldn't find any package by regex 'lib32stdc++6'
6.414 E: Unable to locate package lib32z1
------
Dockerfile:38
--------------------
  37 |     # Tools for building
  38 | >>> RUN apt-get update && apt-get install -y \
  39 | >>>     build-essential \
  40 | >>>     llvm-15 \
  41 | >>>     gcc-10 \
  42 | >>>     binutils \
  43 | >>>     valgrind \
  44 | >>>     cmake \
  45 | >>>     git \
  46 | >>>     autotools-dev \
  47 | >>>     automake \
  48 | >>>     autoconf \
  49 | >>>     libtool \
  50 | >>>     pkg-config \
  51 | >>>     libcmocka-dev \
  52 | >>>     libc6-i386 \
  53 | >>>     lib32stdc++6 \
  54 | >>>     lib32z1 \
  55 | >>>     libusb-1.0-0-dev \
  56 | >>>     libudev-dev \
  57 | >>>     libhidapi-dev
  58 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c apt-get update && apt-get install -y     build-essential     llvm-15     gcc-10     binutils     valgrind     cmake     git     autotools-dev     automake     autoconf     libtool     pkg-config     libcmocka-dev     libc6-i386     lib32stdc++6     lib32z1     libusb-1.0-0-dev     libudev-dev     libhidapi-dev" did not complete successfully: exit code: 100

Seems like that some packages are not in the standard repository and therefore cannot be found.

benma commented 1 month ago

Maybe a transient issue? The package should be available: https://packages.ubuntu.com/jammy/lib32z1

NickeZ commented 1 month ago

Could it be that you are using an arm-based mac? In that case you will have to specify the amd64 platform since the way the docker image is constructed it requires that.

docker build --platform linux/amd64 .
sutterseba commented 3 weeks ago

--platform linux/amd64

Were you able to build this way? Simply specifying the platform never worked for me. I have been trying to build on my M1 device multiple times in the past, but always ended up with a segfault a few minutes into the build.

I never pursued it further and just used a different machine, but it would be great to know if there is a working and straight-forward solution.

NickeZ commented 2 weeks ago

I didn't actually try to build. I guess the Apple emulation of x86 is only so good. Probably better to see if it is possible to find a compiler that can build on the arm platform.