Snapcraft seems not handling deb dependencies correctly

Hi all,

I was trying to build a gadget snap in Jammy environment. Due to the toolchain issue, the toolchain in Jammy environment is not able to build the bootloader properly, so I set the Focal source list and try to install the older toolchain, here is part of my snapcraft.yaml

package-repositories:
  - type: apt
    architectures: [ amd64 ]
    components: [ main ]
    suites: [ focal ]
    key-id: F6ECB3762474EDA9D21B7022871920D1991BC93C
    url: http://archive.ubuntu.com/ubuntu


build-packages:
  - on amd64:                                                                                                                                                                                                                                            
    - cpp-aarch64-linux-gnu=4:9.3.0-1ubuntu2
    - gcc-aarch64-linux-gnu=4:9.3.0-1ubuntu2  

I tried with snapcraft version 6.x and 7.x, they all complain about Package 'gcc-aarch64-linux-gnu' has unmet dependencies, and I believe the dependency is already dpecified in snapcraft.yaml, which is cpp-aarch64-linux-gnu=4:9.3.0-1ubuntu2

According to the error log

2024-05-29 06:51:00.006 part build packages: ['bc', 'bison', 'build-essential', 'device-tree-compiler', 'flex', 'libssl-dev', 'python3-pycryptodome', 'python3-pyelftools', 'cpp-aarch64-linux-gnu=4:9.3.0-1ubuntu2', 'gcc-aarch64-linux-gnu=4:9.3.0-1ubuntu2']
2024-05-29 06:51:00.006 Requested build-packages: ['bc', 'bison', 'build-essential', 'cpp-aarch64-linux-gnu=4:9.3.0-1ubuntu2', 'device-tree-compiler', 'flex', 'gcc-aarch64-linux-gnu=4:9.3.0-1ubuntu2', 'git', 'libssl-dev', 'python3-pycryptodome', 'python3-pyelftools']
2024-05-29 06:51:00.722 Marking device-tree-compiler (and its dependencies) to be fetched
2024-05-29 06:51:00.722 package: device-tree-compiler
2024-05-29 06:51:00.738 Marking git (and its dependencies) to be fetched
2024-05-29 06:51:00.738 package: git
2024-05-29 06:51:00.753 Marking flex (and its dependencies) to be fetched
2024-05-29 06:51:00.753 package: flex
2024-05-29 06:51:00.767 Marking python3-pycryptodome (and its dependencies) to be fetched
2024-05-29 06:51:00.767 package: python3-pycryptodome
2024-05-29 06:51:00.782 Marking gcc-aarch64-linux-gnu=4:9.3.0-1ubuntu2 (and its dependencies) to be fetched
2024-05-29 06:51:00.797 package: gcc-aarch64-linux-gnu
2024-05-29 06:51:00.812 Package 'gcc-aarch64-linux-gnu' has unmet dependencies: .
2024-05-29 06:51:00.813 Traceback (most recent call last):
2024-05-29 06:51:00.813   File "/snap/snapcraft/11039/lib/python3.8/site-packages/snapcraft/parts/parts.py", line 176, in run
2024-05-29 06:51:00.813     with self._lcm.action_executor() as aex:
2024-05-29 06:51:00.813   File "/snap/snapcraft/11039/lib/python3.8/site-packages/craft_parts/executor/executor.py", line 284, in __enter__
2024-05-29 06:51:00.813     self._executor.prologue()
2024-05-29 06:51:00.813   File "/snap/snapcraft/11039/lib/python3.8/site-packages/craft_parts/executor/executor.py", line 89, in prologue
2024-05-29 06:51:00.813     self._install_build_packages()
2024-05-29 06:51:00.813   File "/snap/snapcraft/11039/lib/python3.8/site-packages/craft_parts/executor/executor.py", line 227, in _install_build_packages
2024-05-29 06:51:00.813     packages.Repository.install_packages(sorted(build_packages))
2024-05-29 06:51:00.813   File "/snap/snapcraft/11039/lib/python3.8/site-packages/craft_parts/packages/deb.py", line 523, in install_packages
2024-05-29 06:51:00.813     marked_packages = cls._get_packages_marked_for_installation(package_names)
2024-05-29 06:51:00.813   File "/snap/snapcraft/11039/lib/python3.8/site-packages/craft_parts/packages/deb.py", line 262, in wrapped
2024-05-29 06:51:00.813     return method(*args, **kwargs)
2024-05-29 06:51:00.813   File "/snap/snapcraft/11039/lib/python3.8/site-packages/craft_parts/packages/deb.py", line 466, in _get_packages_marked_for_installation
2024-05-29 06:51:00.813     apt_cache.mark_packages(set(package_names))
2024-05-29 06:51:00.813   File "/snap/snapcraft/11039/lib/python3.8/site-packages/craft_parts/packages/apt_cache.py", line 324, in mark_packages
2024-05-29 06:51:00.813     _verify_marked_install(package)
2024-05-29 06:51:00.813   File "/snap/snapcraft/11039/lib/python3.8/site-packages/craft_parts/packages/apt_cache.py", line 378, in _verify_marked_install
2024-05-29 06:51:00.813     raise errors.PackageBroken(package.name, deps=broken_deps)
2024-05-29 06:51:00.813 craft_parts.packages.errors.PackageBroken: Package 'gcc-aarch64-linux-gnu' has unmet dependencies: .
2024-05-29 06:51:00.813 Full execution log: '/root/.local/state/snapcraft/log/snapcraft-20240529-065059.175372.log'

AFAIK, looks like the snapcraft is trying to install gcc-aarch64-linux-gnu first instead of its dependency

is there any way to fix this? thanks!