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 <arm_neon.h>
          ^~~~~~~~~~~~
compilation terminated.
```

As you can see, the directory in question does not appear in the include list, 
but the other include arguments are present. Perhaps it is relevant that the 
directory I'm trying to include is one normally included by default by the 
compiler. Could it be that the `DeclareCAmkESComponent` is deliberately 
filtering out the compiler's default include directories?

You can look at the original source in the this repository: 
https://github.com/gjurgensen/attarch/blob/camkes-includes-issue/am-cakeml/apps/platAM/CMakeLists.txt#L32.

Thanks for the help!
Grant

On Sun, Aug 22, 2021, at 10:36 AM, Axel Heider wrote:
> 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
> 
_______________________________________________
Devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to