[Azure Sphere] build error for Azure Sphere example(Blink)

ivan 100 Reputation points
2023-03-16T09:23:38.4266667+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

I use the AVNET Azure Sphere MT3620(version1). so i chaned the target hardware to "avnet_mt3620_sk".

# azsphere_target_hardware_definition(${PROJECT_NAME} TARGET_DIRECTORY "HardwareDefinitions/mt3620_rdb" TARGET_DEFINITION "template_appliance.json")
azsphere_target_hardware_definition(${PROJECT_NAME} TARGET_DIRECTORY "HardwareDefinitions/avnet_mt3620_sk" TARGET_DEFINITION "template_appliance.json")

and currently used Azure Sphere OS version is 23.02.


PS C:> azsphere device show-deployment-status

Your device is running Azure Sphere OS version 23.02.

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.
156 questions
{count} votes

1 answer

Sort by: Most helpful
  1. QuantumCache 20,031 Reputation points
    2023-03-22T06:43:15.74+00:00

    Hello @ivan, Just checking on this issue!

    few things you can try to resolve this issue:

    The error message indicates that there is an issue with the encoding of the command output. This could be caused by a non-UTF-8 character in the output. You can try running the command with the --output none option to disable output and see if that resolves the issue. If that doesn't work, you can try running the command with the --output json option to output the results in JSON format, which should be UTF-8 encoded. Additionally, you can try updating the Azure Sphere SDK to the latest version to see if that resolves the issue.

    Update the Azure Sphere SDK and make sure that the Capabilities section of the app_manifest.json file for your project is configured correctly.

    Please do let us know if your issue is still blocking!

    0 comments No comments