DeclareCAmkESComponent questions
Hi, I have a couple questions about the `DeclareCAmkESComponent` CMake function. First, is there a way to add a dependency to a CAmkES component? Normally I would use the CMake function `add_dependencies`, but this requires a target name, and I don't believe that the `DeclareCAmkESComponent` function exposes any such target name. If the function deliberately obscures the target name, perhaps a `DEPENDENCIES` argument could be added to the function? Second, does the `INCLUDES` argument to `DeclareCAmkESComponent` ignore / filter out certain include paths? My compilation was failing because it could not find the proper headers packaged with my compiler. Even if I added the path explicitly by passing it to the `INCLUDES` argument, it was seemingly ignored. It wasn't until I copied the headers to a new directory, and explicitly passed that directory to `INCLUDES` that my compilation succeeded. Any ideas what's going on here? Thanks! Grant Jurgensen
Grant,
First, is there a way to add a dependency to a CAmkES component? Normally I would use the CMake function `add_dependencies`, but this requires a target name, and I don't believe that the `DeclareCAmkESComponent` function exposes any such target name. If the function deliberately obscures the target name, perhaps a `DEPENDENCIES` argument could be added to the function?
The target name for a CAmkES component target name is `CAmkESComponent_${name}`, so you should be able to add dependencies using this. Adding a `DEPENDENCY` in the parameters seems doable. I have created https://github.com/seL4/seL4_tools/issues/101 for this. Can you add a comment there that descibes your use case?
Second, does the `INCLUDES` argument to `DeclareCAmkESComponent` ignore / filter out certain include paths? My compilation was failing because it could not find the proper headers packaged with my compiler. Even if I added the path explicitly by passing it to the `INCLUDES` argument, it was seemingly ignored. It wasn't until I copied the headers to a new directory, and explicitly passed that directory to `INCLUDES` that my compilation succeeded. Any ideas what's going on here?
`INCLUDES` are processed via `get_absolute_list_source_or_binary()`, maybe this causes a problem. You can add some debug messages to CMake with `message("hello world")` that might helps debugging this? Is your project avaialble somewhere to see the CMake code? Axel
Hi Axel,
Thanks for opening the github issue. I just commented on that with a little more detail regarding my use case.
As for the problem with `INCLUDES`, here is a small snippet of the code in question from my project:
```
DeclareCAmkESComponent(
Platam
SOURCES ${hacl_sources}
INCLUDES /usr/lib/gcc-cross/aarch64-linux-gnu/8/include ${hacl_path} ${kremlin_path} ${kremlib_path}
C_FLAGS -include ${CMAKE_CURRENT_SOURCE_DIR}/hacl_config.h
)
get_absolute_source_or_binary(out /usr/lib/gcc-cross/aarch64-linux-gnu/8/include/)
message(WARNING "absolute: ${out}")
```
The `get_absolute_source_or_binary` function behaves as expected, simply returning the directory path. When this directory path is provided in the `INCLUDES` section of the `DeclareCAmkESComponent` though, I get a compilation failure, because a header file is not found:
```
FAILED: CMakeFiles/platam.instance.bin.dir/apps/Arm/attarch/hacl-star/dist/gcc-compatible/Hacl_Chacha20.c.obj
/usr/bin/ccache /usr/bin/aarch64-linux-gnu-gcc --sysroot=/host/build2 -I/host/projects/vm-examples/apps/Arm/attarch/hacl-star/dist/gcc-compatible -I/host/projects/vm-examples/apps/Arm/attarch/hacl-star/dist/kremlin/include -I/host/projects/vm-examples/apps/Arm/attarch/hacl-star/dist/kremlin/kremlib/dist/minimal -I/host/build2/platam/include -I/host/kernel/libsel4/include -I/host/kernel/libsel4/arch_include/arm -I/host/kernel/libsel4/sel4_arch_include/aarch64 -I/host/kernel/libsel4/sel4_plat_include/qemu-arm-virt -I/host/kernel/libsel4/mode_include/64 -I/host/build2/libsel4/include -I/host/build2/libsel4/arch_include/arm -I/host/build2/libsel4/sel4_arch_include/aarch64 -I/host/projects/sel4runtime/include -I/host/projects/sel4runtime/include/mode/64 -I/host/projects/sel4runtime/include/arch/arm -I/host/projects/sel4runtime/include/sel4_arch/aarch64 -I/host/build2/libsel4/autoconf -I/host/build2/kernel/gen_config -I/host/build2/libsel4/gen_config -I/host/build2/musllibc/build-temp/stage/include -I/host/projects/camkes-tool/libsel4camkes/include -I/host/projects/seL4_libs/libsel4debug/include -I/host/projects/seL4_libs/libsel4debug/arch_include/arm -I/host/projects/seL4_libs/libsel4debug/sel4_arch_include/aarch64 -I/host/projects/util_libs/libutils/include -I/host/projects/util_libs/libutils/arch_include/arm -I/host/build2/util_libs/libutils/gen_config -I/host/projects/util_libs/libplatsupport/include -I/host/projects/util_libs/libplatsupport/plat_include/qemu-arm-virt -I/host/projects/util_libs/libplatsupport/sel4_arch_include/aarch64 -I/host/projects/util_libs/libplatsupport/arch_include/arm -I/host/projects/util_libs/libfdt/include -I/host/projects/util_libs/libfdt/. -I/host/build2/util_libs/libplatsupport/gen_config -I/host/projects/seL4_libs/libsel4muslcsys/include -I/host/projects/util_libs/libcpio/include -I/host/projects/seL4_libs/libsel4utils/include -I/host/projects/seL4_libs/libsel4utils/sel4_arch_include/aarch64 -I/host/projects/seL4_libs/libsel4utils/arch_include/arm -I/host/projects/seL4_libs/libsel4vspace/include -I/host/projects/seL4_libs/libsel4vspace/arch_include/arm -I/host/projects/seL4_libs/libsel4vka/include -I/host/projects/seL4_libs/libsel4vka/sel4_arch_include/aarch64 -I/host/projects/seL4_libs/libsel4vka/arch_include/arm -I/host/build2/seL4_libs/libsel4vka/gen_config -I/host/build2/seL4_libs/libsel4utils/gen_config -I/host/projects/seL4_libs/libsel4simple/include -I/host/projects/seL4_libs/libsel4simple/arch_include/arm -I/host/projects/seL4_libs/libsel4platsupport/include -I/host/projects/seL4_libs/libsel4platsupport/arch_include/arm -I/host/projects/seL4_libs/libsel4platsupport/plat_include/qemu-arm-virt -I/host/projects/seL4_libs/libsel4simple-default/include -I/host/projects/util_libs/libelf/include -I/host/build2/seL4_libs/libsel4muslcsys/gen_config -I/host/projects/seL4_libs/libsel4sync/include -I/host/projects/projects_libs/libvirtqueue/include -I/host/build2/camkes-tool/libsel4camkes/gen_config -I/host/build2/sel4runtime/gen_config -I/host/projects/seL4_libs/libsel4bench/include -I/host/projects/seL4_libs/libsel4bench/arch_include/arm/armv/armv8-a -I/host/projects/seL4_libs/libsel4bench/arch_include/arm/cpu/cortex-a53 -I/host/projects/seL4_libs/libsel4bench/sel4_arch_include/aarch64 -I/host/projects/seL4_libs/libsel4bench/arch_include/arm -I/host/projects/seL4_libs/libsel4bench/src -march=armv8-a -D__KERNEL_64__ -g -nostdinc -fno-pic -fno-pie -fno-stack-protector -fno-asynchronous-unwind-tables -ftls-model=local-exec -mstrict-align -include /host/projects/vm-examples/apps/Arm/attarch/am-cakeml/apps/platAM/hacl_config.h -Wno-main -std=gnu11 -MD -MT CMakeFiles/platam.instance.bin.dir/apps/Arm/attarch/hacl-star/dist/gcc-compatible/Hacl_Chacha20.c.obj -MF CMakeFiles/platam.instance.bin.dir/apps/Arm/attarch/hacl-star/dist/gcc-compatible/Hacl_Chacha20.c.obj.d -o CMakeFiles/platam.instance.bin.dir/apps/Arm/attarch/hacl-star/dist/gcc-compatible/Hacl_Chacha20.c.obj -c /host/projects/vm-examples/apps/Arm/attarch/hacl-star/dist/gcc-compatible/Hacl_Chacha20.c
In file included from /host/projects/vm-examples/apps/Arm/attarch/hacl-star/dist/gcc-compatible/Hacl_Chacha20.h:25,
from /host/projects/vm-examples/apps/Arm/attarch/hacl-star/dist/gcc-compatible/Hacl_Chacha20.c:25:
/host/projects/vm-examples/apps/Arm/attarch/hacl-star/dist/gcc-compatible/libintvector.h:423:10: fatal error: arm_neon.h: No such file or directory
#include
Grant,
First, is there a way to add a dependency to a CAmkES component? Normally I would use the CMake function `add_dependencies`, but this requires a target name, and I don't believe that the `DeclareCAmkESComponent` function exposes any such target name. If the function deliberately obscures the target name, perhaps a `DEPENDENCIES` argument could be added to the function?
The target name for a CAmkES component target name is `CAmkESComponent_${name}`, so you should be able to add dependencies using this. Adding a `DEPENDENCY` in the parameters seems doable. I have created https://github.com/seL4/seL4_tools/issues/101 for this. Can you add a comment there that descibes your use case?
Second, does the `INCLUDES` argument to `DeclareCAmkESComponent` ignore / filter out certain include paths? My compilation was failing because it could not find the proper headers packaged with my compiler. Even if I added the path explicitly by passing it to the `INCLUDES` argument, it was seemingly ignored. It wasn't until I copied the headers to a new directory, and explicitly passed that directory to `INCLUDES` that my compilation succeeded. Any ideas what's going on here?
`INCLUDES` are processed via `get_absolute_list_source_or_binary()`, maybe this causes a problem. You can add some debug messages to CMake with `message("hello world")` that might helps debugging this? Is your project avaialble somewhere to see the CMake code?
Axel
Grant,
``` DeclareCAmkESComponent( Platam SOURCES ${hacl_sources} INCLUDES /usr/lib/gcc-cross/aarch64-linux-gnu/8/include ${hacl_path} ${kremlin_path} ${kremlib_path} C_FLAGS -include ${CMAKE_CURRENT_SOURCE_DIR}/hacl_config.h ) ```
The problem might be that the build is running in a docker container that does not have access to your host system. Thus, the absolute path "/usr/lib/gcc-cross/aarch64-linux-gnu/8/include" to the cross compiler there cannot be resolved. The current directory where you invoke the build will be mapped at "/host" in the contianer, so everything in the tree is accessible. Axel
The build is indeed running in a docker container. However, I believe the directory in question "/usr/lib/gcc-cross/aarch64-linux-gnu/8/include" exists within the docker container. I can view it within the docker instance with "ls". No such directory exists on my host system. On Sun, Aug 22, 2021, at 4:10 PM, Axel Heider wrote:
Grant,
``` DeclareCAmkESComponent( Platam SOURCES ${hacl_sources} INCLUDES /usr/lib/gcc-cross/aarch64-linux-gnu/8/include ${hacl_path} ${kremlin_path} ${kremlib_path} C_FLAGS -include ${CMAKE_CURRENT_SOURCE_DIR}/hacl_config.h ) ```
The problem might be that the build is running in a docker container that does not have access to your host system. Thus, the absolute path "/usr/lib/gcc-cross/aarch64-linux-gnu/8/include" to the cross compiler there cannot be resolved. The current directory where you invoke the build will be mapped at "/host" in the contianer, so everything in the tree is accessible.
Axel _______________________________________________ Devel mailing list -- devel@sel4.systems To unsubscribe send an email to devel-leave@sel4.systems
On Mon, Aug 23, 2021 at 7:13 AM Axel Heider
Grant,
``` DeclareCAmkESComponent( Platam SOURCES ${hacl_sources} INCLUDES /usr/lib/gcc-cross/aarch64-linux-gnu/8/include ${hacl_path} ${kremlin_path} ${kremlib_path}
Each path given to DeclareCAmkESComponent as an include should end up in the final compilation command unless CMake is doing some magic argument substitutions which a compiler include path could potentially be affected by. If you insert the following 2 lines after DeclareCAmkESRootserver (https://github.com/gjurgensen/attarch/blob/camkes-includes-issue/CMakeLists....) you should be able to see whether the include path has made it into the CMake target definition. If the path is in that property, but not in the command line to gcc then the next place to look is in the generated build.ninja file for the Hacl_Chacha20.c.obj build rule to see if the include directory is there. If it isn't in build.ninja, but in the CMake target property, then that indicates that CMake is stripping it out when it generates the ninja build rules. ``` get_target_property(out CAmkESComponent_Platam_instance_platam INCLUDE_DIRECTORIES) message("${out}") ```
C_FLAGS -include ${CMAKE_CURRENT_SOURCE_DIR}/hacl_config.h ) ```
The problem might be that the build is running in a docker container that does not have access to your host system. Thus, the absolute path "/usr/lib/gcc-cross/aarch64-linux-gnu/8/include" to the cross compiler there cannot be resolved. The current directory where you invoke the build will be mapped at "/host" in the contianer, so everything in the tree is accessible.
Axel _______________________________________________ Devel mailing list -- devel@sel4.systems To unsubscribe send an email to devel-leave@sel4.systems
I can't seem to get the property in the location you suggest. CMake complains that the target doesn't exist. If I instead get the property after the `GenerateCAmkESRootServer()` command, the target exists, but the property is empty.
What I *can *fetch is the `COMPONENT_INCLUDES` property of `CAmkESComponent_Platam`, which shows the expected include list, including this directory which is seemingly getting dropped. Also, I can get the `INCLUDE_DIRECTORIES` property of `platam.instance.bin`, which outputs `$
On Mon, Aug 23, 2021 at 7:13 AM Axel Heider
wrote: Grant,
``` DeclareCAmkESComponent( Platam SOURCES ${hacl_sources} INCLUDES /usr/lib/gcc-cross/aarch64-linux-gnu/8/include ${hacl_path} ${kremlin_path} ${kremlib_path}
Each path given to DeclareCAmkESComponent as an include should end up in the final compilation command unless CMake is doing some magic argument substitutions which a compiler include path could potentially be affected by.
If you insert the following 2 lines after DeclareCAmkESRootserver (https://github.com/gjurgensen/attarch/blob/camkes-includes-issue/CMakeLists....) you should be able to see whether the include path has made it into the CMake target definition. If the path is in that property, but not in the command line to gcc then the next place to look is in the generated build.ninja file for the Hacl_Chacha20.c.obj build rule to see if the include directory is there. If it isn't in build.ninja, but in the CMake target property, then that indicates that CMake is stripping it out when it generates the ninja build rules.
``` get_target_property(out CAmkESComponent_Platam_instance_platam INCLUDE_DIRECTORIES) message("${out}") ```
C_FLAGS -include ${CMAKE_CURRENT_SOURCE_DIR}/hacl_config.h ) ```
The problem might be that the build is running in a docker container that does not have access to your host system. Thus, the absolute path "/usr/lib/gcc-cross/aarch64-linux-gnu/8/include" to the cross compiler there cannot be resolved. The current directory where you invoke the build will be mapped at "/host" in the contianer, so everything in the tree is accessible.
Axel _______________________________________________ Devel mailing list -- devel@sel4.systems To unsubscribe send an email to devel-leave@sel4.systems
Devel mailing list -- devel@sel4.systems To unsubscribe send an email to devel-leave@sel4.systems
participants (3)
-
Axel Heider
-
Grant Jurgensen
-
Kent Mcleod