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
- Clone the repository
git clone https://github.com/unikraft/catalog-core
- 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.
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:
This is compiler-independent (both gcc and clang reject it) and affects
qemu.arm64andfc.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:This is the outermost issue; once it's fixed, the ARM64 C++ build reveals a further pre-existing blocker, which differs by compiler:
lib/ukpal/include/uk/pal/ectx.h-> conflicting declaration … with 'C' linkage, addressed by open PR plat/*/pal: Add extern "C" guard to ectx.h for C++ compatibility #1832ectx.c|isr/FP-assembly regression, addressed by Error building apps for ARM64 using Clang #1873.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
Build fails at
plat/native/pal/arch/arm64/include/uk/plat/pal/arch/except.h:43.Expected behavior
To build without errors.