solokeys/solo1

Docker build all failed on macOS

dzianisv opened this issue · 3 comments

I run the following

make docker-build-toolchain
make docker-build-all

Docker images

docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
engineer@mybook13 solo1 % docker images
REPOSITORY                         TAG       IMAGE ID       CREATED        SIZE
solokeys/solo-firmware-toolchain   4         e153a31ec8cf   18 hours ago   1.66GB
solokeys/solo-firmware-toolchain   4.1       e153a31ec8cf   18 hours ago   1.66GB
solokeys/solo-firmware-toolchain   4.1.5     e153a31ec8cf   18 hours ago   1.66GB
solokeys/solo-firmware-toolchain   latest    e153a31ec8cf   18 hours ago   1.66GB

Build make docker-build-all fails on mergehex

/opt/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gcc ../../fido2/extensions/solo.c -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb  -Os -Isrc/ -Isrc/cmsis/ -Ilib/ -Ilib/usbd/ -I../../fido2/ -I../../fido2/extensions -I../../tinycbor/src -I../../crypto/sha256 -I../../crypto/micro-ecc -I../../crypto/tiny-AES-c -I../../crypto/cifra/src -I../../crypto/cifra/src/ext -I../../crypto/salty/c-api -c -DDEBUG_LEVEL=0 -DSTM32L432xx -DAES256=1  -DUSE_FULL_LL_DRIVER -DAPP_CONFIG=\"app.h\"    -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fdata-sections -ffunction-sections -fomit-frame-pointer -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -g -DSOLO_VERSION_MAJ=4 -DSOLO_VERSION_MIN=1 -DSOLO_VERSION_PATCH=5 -DSOLO_VERSION=\"4.1.5-8-gfc8d286\" -o ../../fido2/extensions/solo.o
/opt/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gcc ../../fido2/extensions/wallet.c -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb  -Os -Isrc/ -Isrc/cmsis/ -Ilib/ -Ilib/usbd/ -I../../fido2/ -I../../fido2/extensions -I../../tinycbor/src -I../../crypto/sha256 -I../../crypto/micro-ecc -I../../crypto/tiny-AES-c -I../../crypto/cifra/src -I../../crypto/cifra/src/ext -I../../crypto/salty/c-api -c -DDEBUG_LEVEL=0 -DSTM32L432xx -DAES256=1  -DUSE_FULL_LL_DRIVER -DAPP_CONFIG=\"app.h\"    -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fdata-sections -ffunction-sections -fomit-frame-pointer -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -g -DSOLO_VERSION_MAJ=4 -DSOLO_VERSION_MIN=1 -DSOLO_VERSION_PATCH=5 -DSOLO_VERSION=\"4.1.5-8-gfc8d286\" -o ../../fido2/extensions/wallet.o
/opt/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gcc ../../crypto/sha256/sha256.c -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb  -Os -Isrc/ -Isrc/cmsis/ -Ilib/ -Ilib/usbd/ -I../../fido2/ -I../../fido2/extensions -I../../tinycbor/src -I../../crypto/sha256 -I../../crypto/micro-ecc -I../../crypto/tiny-AES-c -I../../crypto/cifra/src -I../../crypto/cifra/src/ext -I../../crypto/salty/c-api -c -DDEBUG_LEVEL=0 -DSTM32L432xx -DAES256=1  -DUSE_FULL_LL_DRIVER -DAPP_CONFIG=\"app.h\"    -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fdata-sections -ffunction-sections -fomit-frame-pointer -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -g -DSOLO_VERSION_MAJ=4 -DSOLO_VERSION_MIN=1 -DSOLO_VERSION_PATCH=5 -DSOLO_VERSION=\"4.1.5-8-gfc8d286\" -o ../../crypto/sha256/sha256.o
/opt/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gcc ../../crypto/tiny-AES-c/aes.c -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb  -Os -Isrc/ -Isrc/cmsis/ -Ilib/ -Ilib/usbd/ -I../../fido2/ -I../../fido2/extensions -I../../tinycbor/src -I../../crypto/sha256 -I../../crypto/micro-ecc -I../../crypto/tiny-AES-c -I../../crypto/cifra/src -I../../crypto/cifra/src/ext -I../../crypto/salty/c-api -c -DDEBUG_LEVEL=0 -DSTM32L432xx -DAES256=1  -DUSE_FULL_LL_DRIVER -DAPP_CONFIG=\"app.h\"    -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fdata-sections -ffunction-sections -fomit-frame-pointer -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -g -DSOLO_VERSION_MAJ=4 -DSOLO_VERSION_MIN=1 -DSOLO_VERSION_PATCH=5 -DSOLO_VERSION=\"4.1.5-8-gfc8d286\" -o ../../crypto/tiny-AES-c/aes.o
/opt/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gcc ../../crypto/cifra/src/sha512.c -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb  -Os -Isrc/ -Isrc/cmsis/ -Ilib/ -Ilib/usbd/ -I../../fido2/ -I../../fido2/extensions -I../../tinycbor/src -I../../crypto/sha256 -I../../crypto/micro-ecc -I../../crypto/tiny-AES-c -I../../crypto/cifra/src -I../../crypto/cifra/src/ext -I../../crypto/salty/c-api -c -DDEBUG_LEVEL=0 -DSTM32L432xx -DAES256=1  -DUSE_FULL_LL_DRIVER -DAPP_CONFIG=\"app.h\"    -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fdata-sections -ffunction-sections -fomit-frame-pointer -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -g -DSOLO_VERSION_MAJ=4 -DSOLO_VERSION_MIN=1 -DSOLO_VERSION_PATCH=5 -DSOLO_VERSION=\"4.1.5-8-gfc8d286\" -o ../../crypto/cifra/src/sha512.o
/opt/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gcc ../../crypto/cifra/src/blockwise.c -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb  -Os -Isrc/ -Isrc/cmsis/ -Ilib/ -Ilib/usbd/ -I../../fido2/ -I../../fido2/extensions -I../../tinycbor/src -I../../crypto/sha256 -I../../crypto/micro-ecc -I../../crypto/tiny-AES-c -I../../crypto/cifra/src -I../../crypto/cifra/src/ext -I../../crypto/salty/c-api -c -DDEBUG_LEVEL=0 -DSTM32L432xx -DAES256=1  -DUSE_FULL_LL_DRIVER -DAPP_CONFIG=\"app.h\"    -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fdata-sections -ffunction-sections -fomit-frame-pointer -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -g -DSOLO_VERSION_MAJ=4 -DSOLO_VERSION_MIN=1 -DSOLO_VERSION_PATCH=5 -DSOLO_VERSION=\"4.1.5-8-gfc8d286\" -o ../../crypto/cifra/src/blockwise.o
/opt/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gcc src/main.o src/init.o src/redirect.o src/flash.o src/rng.o src/led.o src/device.o src/fifo.o src/attestation.o src/nfc.o src/ams.o src/sense.o src/startup_stm32l432xx.o src/system_stm32l4xx.o lib/stm32l4xx_hal_pcd.o lib/stm32l4xx_hal_pcd_ex.o lib/stm32l4xx_ll_gpio.o lib/stm32l4xx_ll_rcc.o lib/stm32l4xx_ll_rng.o lib/stm32l4xx_ll_tim.o lib/stm32l4xx_ll_usb.o lib/stm32l4xx_ll_utils.o lib/stm32l4xx_ll_pwr.o lib/stm32l4xx_ll_usart.o lib/stm32l4xx_ll_spi.o lib/stm32l4xx_ll_exti.o lib/usbd/usbd_cdc.o lib/usbd/usbd_cdc_if.o lib/usbd/usbd_composite.o lib/usbd/usbd_conf.o lib/usbd/usbd_core.o lib/usbd/usbd_ioreq.o lib/usbd/usbd_ctlreq.o lib/usbd/usbd_desc.o lib/usbd/usbd_hid.o lib/usbd/usbd_ccid.o ../../fido2/apdu.o ../../fido2/util.o ../../fido2/u2f.o ../../fido2/test_power.o ../../fido2/stubs.o ../../fido2/log.o ../../fido2/ctaphid.o ../../fido2/ctap.o ../../fido2/ctap_parse.o ../../fido2/crypto.o ../../fido2/version.o ../../fido2/data_migration.o ../../fido2/extensions/extensions.o ../../fido2/extensions/solo.o ../../fido2/extensions/wallet.o ../../crypto/sha256/sha256.o ../../crypto/micro-ecc/uECC.o ../../crypto/tiny-AES-c/aes.o ../../crypto/cifra/src/sha512.o ../../crypto/cifra/src/blockwise.o -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -L../../tinycbor/lib -L../../crypto/salty/c-api -specs=nano.specs  -specs=nosys.specs  -Wl,--gc-sections -lnosys -Tlinker/stm32l4xx.ld -Wl,-Map=solo.map,--cref -Wl,-Bstatic -ltinycbor -lsalty -o solo.elf
Built version: -DSOLO_VERSION_MAJ=4 -DSOLO_VERSION_MIN=1 -DSOLO_VERSION_PATCH=5 -DSOLO_VERSION="4.1.5-8-gfc8d286"
/opt/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-size solo.elf
   text	   data	    bss	    dec	    hex	filename
  83908	    592	  29688	 114188	  1be0c	solo.elf
/opt/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-objcopy -O ihex solo.elf solo.hex
make[1]: Leaving directory '/solo/targets/stm32l432'
+ out_hex=firmware-4.1.5-8-gfc8d286.hex
+ out_sha2=firmware-4.1.5-8-gfc8d286.sha2
+ mv solo.hex firmware-4.1.5-8-gfc8d286.hex
+ sha256sum firmware-4.1.5-8-gfc8d286.hex
+ cp firmware-4.1.5-8-gfc8d286.hex firmware-4.1.5-8-gfc8d286.sha2 /builds
+ cd /builds
+ bundle=bundle-hacker-4.1.5-8-gfc8d286
+ /opt/conda/bin/solo mergehex bootloader-nonverifying-4.1.5-8-gfc8d286.hex firmware-4.1.5-8-gfc8d286.hex bundle-hacker-4.1.5-8-gfc8d286.hex
Traceback (most recent call last):
  File "/opt/conda/bin/solo", line 5, in <module>
    from solo.cli import solo_cli
  File "/opt/conda/lib/python3.7/site-packages/solo/__init__.py", line 15, in <module>
    from . import client, commands, dfu, helpers, operations
  File "/opt/conda/lib/python3.7/site-packages/solo/client.py", line 15, in <module>
    from .devices import solo_v1
  File "/opt/conda/lib/python3.7/site-packages/solo/devices/solo_v1.py", line 11, in <module>
    from fido2.ctap1 import CTAP1
ImportError: cannot import name 'CTAP1' from 'fido2.ctap1' (/opt/conda/lib/python3.7/site-packages/fido2/ctap1.py)

I figured out that class name fido2.ctap1 was renamed from CTAP1 to Ctap1, https://github.com/Yubico/python-fido2/blame/ee319bea29bf9ba33572c6f2726db6000ff99f61/fido2/ctap1.py#L199

Interesting, class CTAP1 is available at https://vscode.dev/github/Yubico/python-fido2/fido2/ctap1.py#L199

$ git describe --tags
0.8.1-54-gee319be

But solo1-cli https://github.com/solokeys/solo1-cli/blob/a637aad18433e4eb54a5ff2c1a0087db5296d6f8/pyproject.toml#L17 defines

fido2 >= 0.9.1

I am not sure that it is the best fix here, but I updated dependencies in solo1-cli dzianisv/solo1-cli@4fd1165, then used an updated solo1-cli to build a docker image and then build an firmware image dzianisv@585dcff. It works now for me. Probably could help someone else.