[Azure Sphere] build error for Azure Sphere example

ivan 100 Reputation points
2023-03-14T02:01:36.99+00:00

Hello,

I'm trying to build the blink example for Azure Sphere as following the link.

but, there is an build error as below.


[main] Building folder: Blink 
[build] Starting build
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build C:/lab1/blink/Blink/out/ARM-Debug --parallel 18
[build] [1/4] Building C object CMakeFiles/Blink.dir/main.c.obj
[build] [2/4] Linking C executable Blink.out
[build] [3/4] Generating approotBlink/bin/app
[build] [4/4] Generating Blink.imagepackage
[build] FAILED: Blink.imagepackage C:/lab1/blink/Blink/out/ARM-Debug/Blink.imagepackage 
[build] cmd.exe /C "cd /D C:\lab1\blink\Blink\out\ARM-Debug && "C:\Program Files (x86)\Microsoft Azure Sphere SDK\Tools_v2\wbin\azsphere.cmd" image-package pack-application --verbose --application-manifest C:/lab1/blink/Blink/app_manifest.json --package-directory C:/lab1/blink/Blink/out/ARM-Debug/approotBlink --destination C:/lab1/blink/Blink/out/ARM-Debug/Blink.imagepackage --target-api-set "15" --hardware-definitions "C:/lab1/blink/Blink/HardwareDefinitions/avnet_mt3620_sk,C:/Program Files (x86)/Microsoft Azure Sphere SDK/HardwareDefinitions/" --target-definition-filename template_appliance.json"
[build] INFO: Azure Sphere Utility version 22.11.5.13799
[build] INFO: Copyright (C) Microsoft Corporation. All rights reserved.
[build] INFO: 
[build] INFO: Start time (UTC): Tuesday, 14 March 2023 01:54:58
[build] INFO: Creating image package.
[build] INFO: Azure Sphere application image package written.
[build] INFO: Appending metadata.
[build] INFO: Wrote metadata:
[build] INFO:   Section: Identity
[build] INFO:     Image Type:           Application
[build] INFO:     Component ID:         70c3014d-c9c9-4026-a1ff-305e1a327f56
[build] INFO:     Image ID:             58c98446-ba60-47f0-a23f-956c78a974ee
[build] INFO:   Section: Signature
[build] INFO:     Signing Type:         ECDsa256
[build] INFO:     Cert:                 a8d5cc6958f48710140d7a26160fc1cfc31f5df0
[build] INFO:   Section: Debug
[build] INFO:     Image Name:           Blink
[build] ERROR: The command failed with an unexpected error. Here is the traceback:
[build] ERROR: 'utf-8' codec can't decode byte 0xbf in position 46: invalid start byte
[build] Traceback (most recent call last):
[build]   File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 231, in invoke
[build]   File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 657, in execute
[build]   File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
[build]   File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 691, in _run_job
[build]   File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 328, in __call__
[build]   File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
[build]   File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azext_sphere_mammoth/custom/image_package.py", line 117, in image_package_pack_application
[build]   File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azext_sphere_mammoth/_utils.py", line 171, in call_with_transforms
[build]   File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azext_sphere_mammoth/_utils.py", line 120, in _call
[build] UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbf in position 46: invalid start byte
[build] To open an issue, please run: 'azsphere feedback'
[build] INFO: Command ran in 1.220 seconds (init: 0.011, invoke: 1.209)
[build] ninja: build stopped: subcommand failed.
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --build C:/lab1/blink/Blink/out/ARM-Debug --parallel 18 exited with code: 1
[build] Build finished with exit code 1


is there anyone who can help me?

my environment is Windows 11.

Thanks.

Azure Sphere
Azure Sphere
An Azure internet of things security solution including hardware, operating system, and cloud components.
168 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. LiJia Liu 170 Reputation points MVP
    2023-03-14T02:25:16.97+00:00

    Can you build and run the Azure IoT Hub Sample for MT3620 RDB project in Azure Sphere Preview SDK?

    Have you installed the latest Azure Sphere SDK?

    And… Have you upgraded your board to the Firmware 18.11?

    0 comments No comments

  2. LiJia Liu 170 Reputation points MVP
    2023-03-14T02:31:58.84+00:00

    Can you build and run the Azure IoT Hub Sample for MT3620 RDB project in Azure Sphere Preview SDK?

    And… Have you upgraded your board to the Firmware 18.11?


  3. Whisley.Wang 王文榮 0 Reputation points
    2023-12-18T06:25:36.3233333+00:00

    https://github.com/Azure/azure-cli/issues/24218#issuecomment-1281794304

    image

    Found this solution from Github and solve my problem, try it.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.