Skip to content

Error building C++ apps for ARM64 #1874

Description

@CristianAndrei1423

Describe the bug

Building C++ catalog-core apps (cpp-hello, cpp-http) for ARM64 fails to compile. The ARM64 PAL exception wrapper passes an int to a function whose parameter is an enum. C performs the int to enum conversion implicitly, but C++ does not, so the build fails:

plat/native/pal/arch/arm64/include/uk/plat/pal/arch/except.h:43:2:
 error: no matching function for call to 'uk_plat_native_arm64_except_err_ctx_set_eid'
plat/native/arch/arm64/include/uk/plat/native/arch/except.h:80:1:
  note: candidate function not viable: no known conversion from 'int'
        to 'enum uk_plat_native_arm64_except_id' for 2nd argument

This is compiler-independent (both gcc and clang reject it) and affects qemu.arm64 and fc.arm64.

Suggested fix

Add the missing cast at the call boundary (the same function already casts its first argument the same way), in plat/native/pal/arch/arm64/include/uk/plat/pal/arch/except.h:

  uk_plat_native_arm64_except_err_ctx_set_eid(
             (struct uk_plat_native_except_err_ctx *)ctx,
 -           eid);
 +           (enum uk_plat_native_arm64_except_id)eid);

This is the outermost issue; once it's fixed, the ARM64 C++ build reveals a further pre-existing blocker, which differs by compiler:

Confirmed with this fix + #1832, cpp-hello builds green for qemu.arm64 under gcc (produces cpp-hello_qemu-arm64). So a fully working ARM64 C++ build needs this fix + #1832 (gcc) and/or this fix + #1873 (clang).

Steps to reproduce

  1. Clone the repository
git clone https://github.com/unikraft/catalog-core
  1. Enter a C++ app and build for arm64
cd catalog-core/cpp-hello
./.scripts/build/qemu.arm64        # or: CC=clang ./.scripts/build/qemu.arm64

Build fails at plat/native/pal/arch/arm64/include/uk/plat/pal/arch/except.h:43.

Expected behavior

To build without errors.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugSomething isn't working

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions