Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Fail to build EFR32 lighting-app example #23930

Closed
lboue opened this issue Dec 6, 2022 · 9 comments
Closed

[BUG] Fail to build EFR32 lighting-app example #23930

lboue opened this issue Dec 6, 2022 · 9 comments
Labels

Comments

@lboue
Copy link
Contributor

lboue commented Dec 6, 2022

Reproduction steps

1. cd ~/connectedhomeip
2. source scripts/activate.sh
3. ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/silabs/efr32/ ./out/efr32-lighting-app BRD4161A


+ USE_WIFI=false
+ SILABS_THREAD_TARGET='"../silabs:ot-efr32-cert"'
+ USAGE='./scripts/examples/gn_efr32_example.sh <AppRootFolder> <outputFolder> <silabs_board_name> [<Build options>]'
+ '[' 3 == 0 ']'
+ '[' 3 -lt 2 ']'
+ ROOT=./examples/thermostat/efr32/
+ OUTDIR=./out/thermostat-app
+ '[' 3 -gt 2 ']'
+ SILABS_BOARD=BRD4161A
+ shift
+ shift
+ shift
+ '[' 0 -gt 0 ']'
+ '[' -z BRD4161A ']'
+ BUILD_DIR=./out/thermostat-app/BRD4161A
+ echo BUILD_DIR=./out/thermostat-app/BRD4161A
BUILD_DIR=./out/thermostat-app/BRD4161A
+ '[' false == true ']'
+ '[' -z '' ']'
+ gn gen --check --fail-on-unused-args --export-compile-commands --root=./examples/thermostat/efr32/ '--args=silabs_board="BRD4161A"' ./out/thermostat-app/BRD4161A
ERROR at //third_party/connectedhomeip/third_party/openthread/BUILD.gn:27:23: Unable to load "/home/ubuntu/connectedhomeip/examples/thermostat/efr32/third_party/connectedhomeip/third_party/openthread/ot-efr32/openthread/BUILD.gn".
      public_deps = [ "${openthread_root}:libopenthread-ftd" ]
                      ^-------------------------------------
AUTO-DETECTING input matter IDL file.

Bug prevalence

Always

GitHub hash of the SDK that was being used

b149561

Platform

efr32

Platform Version(s)

Python 3.10.6

Anything else?

Full log:

ubuntu@RPI4:~$ cd ~/connectedhomeip
ubuntu@RPI4:~/connectedhomeip$ source scripts/activate.sh

  WELCOME TO...

         â–ˆ
         â–ˆ
     â–„   â–ˆ   â–„                                â–ˆ     â–ˆ
     ▀▀█████▀▀      ▄▀▀▀▄ ▄▀▀▀▄    ▄▀▀▀▀▄█  ▀▀█▀▀▀▀▀█▀▀   ▄▀▀▀▀▄    ▄▀▀
   ▀█▄       ▄█▀   █     █     █  █      █    █     █    █▄▄▄▄▄▄█  █   
     ▀█▄   ▄█▀     █     █     █  █      █    █     █    █         █   
  ▄██▀▀█   █▀▀██▄  █     █     █   ▀▄▄▄▄▀█    ▀▄▄   ▀▄▄   ▀▄▄▄▄▀   █   
 ▀▀    █   █    ▀▀

  ACTIVATOR! This sets your shell environment variables.

Activating environment (setting environment variables):

  Setting environment variables for CIPD package manager...done
  Setting environment variables for Python environment.....done
  Setting environment variables for pw packages............skipped
  Setting environment variables for Host tools.............done

Checking the environment:

20221206 12:17:30 WRN Current uname (5.15.0-1021-raspi #23-Ubuntu SMP PREEMPT Fri Nov 25 15:27:43 UTC 2022 aarch64) does not match Bootstrap uname (5.15.0-1017-raspi #19-Ubuntu SMP PREEMPT Fri Oct 14 08:22:47 UTC 2022 aarch64), you may need to rerun bootstrap on this system
20221206 12:17:30 INF Environment passes all checks!

Environment looks good, you are ready to go!

ubuntu@RPI4:~/connectedhomeip$ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/silabs/efr32/ ./out/efr32-lighting-app BRD4161A
Using default path for Matter root

  WELCOME TO...

         â–ˆ
         â–ˆ
     â–„   â–ˆ   â–„                                â–ˆ     â–ˆ
     ▀▀█████▀▀      ▄▀▀▀▄ ▄▀▀▀▄    ▄▀▀▀▀▄█  ▀▀█▀▀▀▀▀█▀▀   ▄▀▀▀▀▄    ▄▀▀
   ▀█▄       ▄█▀   █     █     █  █      █    █     █    █▄▄▄▄▄▄█  █   
     ▀█▄   ▄█▀     █     █     █  █      █    █     █    █         █   
  ▄██▀▀█   █▀▀██▄  █     █     █   ▀▄▄▄▄▀█    ▀▄▄   ▀▄▄   ▀▄▄▄▄▀   █   
 ▀▀    █   █    ▀▀

  ACTIVATOR! This sets your shell environment variables.

Activating environment (setting environment variables):

  Setting environment variables for CIPD package manager...done
  Setting environment variables for Python environment.....done
  Setting environment variables for pw packages............skipped
  Setting environment variables for Host tools.............done

Checking the environment:

20221206 12:18:00 WRN Current uname (5.15.0-1021-raspi #23-Ubuntu SMP PREEMPT Fri Nov 25 15:27:43 UTC 2022 aarch64) does not match Bootstrap uname (5.15.0-1017-raspi #19-Ubuntu SMP PREEMPT Fri Oct 14 08:22:47 UTC 2022 aarch64), you may need to rerun bootstrap on this system
20221206 12:18:00 INF Environment passes all checks!

Environment looks good, you are ready to go!

+ env
SHELL=/bin/bash
PW_PROJECT_ROOT=/home/ubuntu/connectedhomeip
PWD=/home/ubuntu/connectedhomeip
LOGNAME=ubuntu
XDG_SESSION_TYPE=tty
MOTD_SHOWN=pam
PW_ROOT=/home/ubuntu/connectedhomeip/third_party/pigweed/repo
HOME=/home/ubuntu
LANG=C.UTF-8
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
VIRTUAL_ENV=/home/ubuntu/connectedhomeip/.environment/pigweed-venv
SSH_CONNECTION=192.168.1.107 12565 192.168.1.100 22
PW_PYTHON_CIPD_INSTALL_DIR=/home/ubuntu/connectedhomeip/.environment/cipd/packages/python
_PW_ROSETTA=0
LESSCLOSE=/usr/bin/lesspipe %s %s
XDG_SESSION_CLASS=user
TERM=linux
LESSOPEN=| /usr/bin/lesspipe %s
USER=ubuntu
SHLVL=2
PW_PACKAGE_ROOT=/home/ubuntu/connectedhomeip/.environment/packages
PW_ENVIRONMENT_ROOT=/home/ubuntu/connectedhomeip/.environment
XDG_SESSION_ID=86
_PW_ENVIRONMENT_CONFIG_FILE=/home/ubuntu/connectedhomeip/scripts/environment.json
XDG_RUNTIME_DIR=/run/user/1000
PW_BRANDING_BANNER=/home/ubuntu/connectedhomeip/scripts/matter_banner.txt
_PW_ACTUAL_ENVIRONMENT_ROOT=/home/ubuntu/connectedhomeip/.environment
SSH_CLIENT=192.168.1.107 12565 22
PW_ARM_CIPD_INSTALL_DIR=/home/ubuntu/connectedhomeip/.environment/cipd/packages/arm
XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
PATH=/home/ubuntu/connectedhomeip/third_party/pigweed/repo/out/host/host_tools:/home/ubuntu/connectedhomeip/.environment/pigweed-venv/bin:/home/ubuntu/connectedhomeip/.environment/cipd/packages/pigweed/bin:/home/ubuntu/connectedhomeip/.environment/cipd/packages/pigweed:/home/ubuntu/connectedhomeip/.environment/cipd:/home/ubuntu/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
SSH_TTY=/dev/pts/1
PW_PIGWEED_CIPD_INSTALL_DIR=/home/ubuntu/connectedhomeip/.environment/cipd/packages/pigweed
OLDPWD=/home/ubuntu
_=/usr/bin/env
+ USE_WIFI=false
+ SILABS_THREAD_TARGET='"../silabs:ot-efr32-cert"'
+ USAGE='./scripts/examples/gn_efr32_example.sh <AppRootFolder> <outputFolder> <silabs_board_name> [<Build options>]'
+ '[' 3 == 0 ']'
+ '[' 3 -lt 2 ']'
+ ROOT=./examples/lighting-app/silabs/efr32/
+ OUTDIR=./out/efr32-lighting-app
+ '[' 3 -gt 2 ']'
+ SILABS_BOARD=BRD4161A
+ shift
+ shift
+ shift
+ '[' 0 -gt 0 ']'
+ '[' -z BRD4161A ']'
+ BUILD_DIR=./out/efr32-lighting-app/BRD4161A
+ echo BUILD_DIR=./out/efr32-lighting-app/BRD4161A
BUILD_DIR=./out/efr32-lighting-app/BRD4161A
+ '[' false == true ']'
+ '[' -z '' ']'
+ gn gen --check --fail-on-unused-args --export-compile-commands --root=./examples/lighting-app/silabs/efr32/ '--args=silabs_board="BRD4161A"' ./out/efr32-lighting-app/BRD4161A
ERROR at //third_party/connectedhomeip/third_party/openthread/BUILD.gn:27:23: Unable to load "/home/ubuntu/connectedhomeip/examples/lighting-app/silabs/efr32/third_party/connectedhomeip/third_party/openthread/ot-efr32/openthread/BUILD.gn".
      public_deps = [ "${openthread_root}:libopenthread-ftd" ]
                      ^-------------------------------------
AUTO-DETECTING input matter IDL file.
@chenek
Copy link

chenek commented Dec 8, 2022

@lboue
Copy link
Contributor Author

lboue commented Dec 8, 2022

The tutorial indicated does not work because the path of the files has changed.

 '[' -z '' ']'
+ gn gen --check --fail-on-unused-args --export-compile-commands --root=./examples/lighting-app/efr32/ '--args=silabs_board="BRD4161A"' ./out/efr32-lighting-app/BRD4161A
ERROR Root source path not found.
The path "./examples/lighting-app/efr32/" doesn't exist.

@chenek
Copy link

chenek commented Dec 8, 2022

Try to use Silicon Labs Matter GitHub v1.0.0.

@andy31415
Copy link
Contributor

Tot works for me:

./scripts/build/build_examples.py --target efr32-brd4161a-light build

In terms of commands if you want to run manually:

#> ./scripts/build/build_examples.py --target efr32-brd4161a-light --dry-run --log-level warn build
# Commands will be run in CHIP project root.
cd "."

# Generating efr32-brd4161a-light
gn gen --check --fail-on-unused-args --export-compile-commands --root=/workspace/examples/lighting-app/silabs/efr32 '--args=silabs_board="BRD4161A" sl_matter_version_str="v1.0-master-d1c9050543"' /workspace/out/efr32-brd4161a-light

# Building efr32-brd4161a-light
ninja -C /workspace/out/efr32-brd4161a-light

@lboue
Copy link
Contributor Author

lboue commented Dec 9, 2022

andy31415.
I tried this with lastest commit d1c9050 and unfortunately it fails

build_examples.py

Build script is looking for a wrong path:

/home/ubuntu/connectedhomeip/examples/lighting-app/silabs/efr32/third_party/connectedhomeip/third_party/openthread/ot-efr32/openthread/BUILD.gn

Instead of
/home/ubuntu/connectedhomeip/examples/lighting-app/silabs/efr32/BUILD.gn

Full log

ubuntu@RPI4:~/connectedhomeip$ ./scripts/build/build_examples.py --target efr32-brd4161a-light build
2022-12-09 15:26:19 INFO    Building targets: efr32-brd4161a-light
2022-12-09 15:26:19 INFO    Preparing builder 'efr32-brd4161a-light'
2022-12-09 15:26:19 INFO    Generating /home/ubuntu/connectedhomeip/out/efr32-brd4161a-light
2022-12-09 15:26:19 INFO    Generating efr32-brd4161a-light
2022-12-09 15:26:20 INFO    ERROR at //third_party/connectedhomeip/third_party/openthread/BUILD.gn:27:23: Unable to load "/home/ubuntu/connectedhomeip/examples/lighting-app/silabs/efr32/third_party/connectedhomeip/third_party/openthread/ot-efr32/openthread/BUILD.gn".
2022-12-09 15:26:20 INFO          public_deps = [ "${openthread_root}:libopenthread-ftd" ]
2022-12-09 15:26:20 INFO                          ^-------------------------------------
Traceback (most recent call last):
  File "/home/ubuntu/connectedhomeip/./scripts/build/build_examples.py", line 208, in <module>
    main(auto_envvar_prefix='CHIP')
  File "/home/ubuntu/connectedhomeip/.environment/pigweed-venv/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/ubuntu/connectedhomeip/.environment/pigweed-venv/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/ubuntu/connectedhomeip/.environment/pigweed-venv/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    rv.append(sub_ctx.command.invoke(sub_ctx))
  File "/home/ubuntu/connectedhomeip/.environment/pigweed-venv/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ubuntu/connectedhomeip/.environment/pigweed-venv/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/ubuntu/connectedhomeip/.environment/pigweed-venv/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/ubuntu/connectedhomeip/./scripts/build/build_examples.py", line 198, in cmd_build
    context.obj.Build()
  File "/home/ubuntu/connectedhomeip/scripts/build/build/__init__.py", line 67, in Build
    self.Generate()
  File "/home/ubuntu/connectedhomeip/scripts/build/build/__init__.py", line 62, in Generate
    builder.generate()
  File "/home/ubuntu/connectedhomeip/scripts/build/builders/efr32.py", line 264, in generate
    self._Execute(cmd, title=title)
  File "/home/ubuntu/connectedhomeip/scripts/build/builders/builder.py", line 104, in _Execute
    self._runner.Run(cmdarray, title=title)
  File "/home/ubuntu/connectedhomeip/scripts/build/runner/shell.py", line 73, in Run
    raise Exception('Command %r failed: %d' % (cmd, code))
Exception: Command ['gn', 'gen', '--check', '--fail-on-unused-args', '--export-compile-commands', '--root=/home/ubuntu/connectedhomeip/examples/lighting-app/silabs/efr32', '--args=silabs_board="BRD4161A" sl_matter_version_str="v1.0-master-d1c905054-dirty"', '/home/ubuntu/connectedhomeip/out/efr32-brd4161a-light'] failed: 1

run manually

ubuntu@RPI4:~/connectedhomeip$ gn gen --check --fail-on-unused-args --export-compile-commands --root=/home/ubuntu/connectedhomeip '--args=silabs_board="BRD4161A" sl_matter_version_str="v1.0-master-d1c9050543"' ./out/efr32-brd4161a-light
ERROR at //BUILD.gn:122:3: Unknown function.
  pw_python_pip_install("pip_install_matter_packages") {
  ^--------------------

@andy31415
Copy link
Contributor

is this a clean environment? Try:

which python # curious here what your env is ... 
git submodule sync --recursive
git submodule update -f --init --recursive

If that still fails, do rm -rf .environment (path may be different depending on what which python says.
In a fresh shell do the source scripts/bootstrap.sh again

@andy31415
Copy link
Contributor

For me:

❯ ls -l third_party/openthread/ot-efr32/openthread/BUILD.gn
.rw-r--r-- andrei andrei 3.3 KB Wed Oct  5 12:03:26 2022  third_party/openthread/ot-efr32/openthread/BUILD.gn

❯ md5sum third_party/openthread/ot-efr32/openthread/BUILD.gn
923ed8c10b386e83a52b16411523345c  third_party/openthread/ot-efr32/openthread/BUILD.gn

@lboue
Copy link
Contributor Author

lboue commented Dec 9, 2022

Thanks. I will run these commands then bootstrap and check if that fixes my problem.

@lboue
Copy link
Contributor Author

lboue commented Dec 9, 2022

Thanks. This solved my problem. I managed to build efr32-brd4161a-light:

ubuntu@RPI4:~/connectedhomeip$ ls -l ./out/efr32-brd4161a-light/
total 93384
-rw-rw-r-- 1 ubuntu ubuntu       74 Dec  9 21:40 args.gn
-rw------- 1 ubuntu ubuntu   741585 Dec  9 21:40 build.ninja
-rw------- 1 ubuntu ubuntu    49930 Dec  9 21:40 build.ninja.d
-rw------- 1 ubuntu ubuntu        0 Dec  9 21:40 build.ninja.stamp
-rwxr-xr-x 1 ubuntu ubuntu      297 Dec  9 19:25 chip-efr32-lighting-example.flash.py
-rw-rw-r-- 1 ubuntu ubuntu  2745981 Dec  9 19:48 chip-efr32-lighting-example.hex
-rwxrwxr-x 1 ubuntu ubuntu 57029628 Dec  9 19:48 chip-efr32-lighting-example.out
-rw-rw-r-- 1 ubuntu ubuntu  8159594 Dec  9 19:48 chip-efr32-lighting-example.out.map
-rwxrwxr-x 1 ubuntu ubuntu  2806814 Dec  9 19:48 chip-efr32-lighting-example.s37
-rw-rw-r-- 1 ubuntu ubuntu 23319552 Dec  9 19:25 compile_commands.json
-rwxrwxr-x 2 ubuntu ubuntu     5634 Nov 16 21:40 efr32_firmware_utils.py
-rw-rw-r-- 2 ubuntu ubuntu    17062 Nov 16 21:40 firmware_utils.py
drwxrwxr-x 7 ubuntu ubuntu     4096 Dec  9 21:39 gen
drwxrwxr-x 2 ubuntu ubuntu     4096 Dec  9 19:48 lib
-rw-rw-r-- 1 ubuntu ubuntu      111 Dec  9 19:25 lighting_app.flashbundle.txt
drwxrwxr-x 6 ubuntu ubuntu     4096 Dec  9 21:39 obj
drwxrwxr-x 3 ubuntu ubuntu     4096 Dec  9 19:25 protocol_buffer
drwxrwxr-x 3 ubuntu ubuntu     4096 Dec  9 19:25 python
-rw-rw-r-- 1 ubuntu ubuntu      247 Dec  9 21:40 relative_path_transformations.json
-rw-rw-r-- 1 ubuntu ubuntu   750661 Dec  9 21:40 toolchain.ninja

@lboue lboue closed this as completed Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants