Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: api-tests: cmake falls back to default host compiler #265

Closed
microbuilder opened this issue May 7, 2021 · 2 comments · Fixed by #268
Closed

build: api-tests: cmake falls back to default host compiler #265

microbuilder opened this issue May 7, 2021 · 2 comments · Fixed by #268

Comments

@microbuilder
Copy link
Contributor

When building psa_arch_tests in Zephyr with TF-M, cmake falls back to the default C compiler, rather than forwarding the correct ARM cross-compiler, resulting in build failure.

The use of the host compiler is caused by this: https://github.com/ARM-software/psa-arch-tests/blob/master/api-tests/CMakeLists.txt#L415-L436

Where the compiler is not passed on, but a C compiler is being looked up here:
https://github.com/ARM-software/psa-arch-tests/blob/master/api-tests/tools/scripts/target_cfg/CMakeLists.txt#L29

# Let the CMake look for C compiler
project(TargetConfigGen LANGUAGES C)

To Reproduce

The twister command is part of Zephyr, but you can see the clang compiler being called as the default with this test suite:

$ ./scripts/twister -p mps2_an521_nonsecure -N --inline-logs \
  -s samples/tfm_integration/tfm_psa_test/sample.tfm.psa_internal_trusted_storage_test

This will result in trying to run the system C compiler (/Library/Developer/CommandLineTools/usr/bin/cc here, on OS X) instead of the toolchain that should be passed in (arm-none-eabi-gcc, arm-zephyr-eabi-gcc, etc.):

[2/5] Building C object CMakeFiles/TargetConfigGen.dir/Users/kevin/Linaro/zephyr/zephyr/twister-out/mps2_an521_nonsecure/samples/tfm_integration/tfm_psa_test/sample.tfm.psa_internal_trusted_storage_test/tfm/app/psa_api_tests/targetConfigGen.c.o
FAILED: CMakeFiles/TargetConfigGen.dir/Users/kevin/Linaro/zephyr/zephyr/twister-out/mps2_an521_nonsecure/samples/tfm_integration/tfm_psa_test/sample.tfm.psa_internal_trusted_storage_test/tfm/app/psa_api_tests/targetConfigGen.c.o 
/Library/Developer/CommandLineTools/usr/bin/cc  -I/Users/kevin/Linaro/zephyr/modules/tee/tfm/psa-arch-tests/api-tests/val/nspe -I/Users/kevin/Linaro/zephyr/modules/tee/tfm/psa-arch-tests/api-tests/val/common -I/Users/kevin/Linaro/zephyr/modules/tee/tfm/psa-arch-tests/api-tests/platform/targets/common/nspe -I/Users/kevin/Linaro/zephyr/modules/tee/tfm/psa-arch-tests/api-tests/platform/targets/common/nspe/crypto -I/Users/kevin/Linaro/zephyr/modules/tee/tfm/psa-arch-tests/api-tests/platform/targets/tgt_dev_apis_tfm_an521/nspe -arch arm64 -o CMakeFiles/TargetConfigGen.dir/Users/kevin/Linaro/zephyr/zephyr/twister-out/mps2_an521_nonsecure/samples/tfm_integration/tfm_psa_test/sample.tfm.psa_internal_trusted_storage_test/tfm/app/psa_api_tests/targetConfigGen.c.o -c /Users/kevin/Linaro/zephyr/zephyr/twister-out/mps2_an521_nonsecure/samples/tfm_integration/tfm_psa_test/sample.tfm.psa_internal_trusted_storage_test/tfm/app/psa_api_tests/targetConfigGen.c
/Users/kevin/Linaro/zephyr/zephyr/twister-out/mps2_an521_nonsecure/samples/tfm_integration/tfm_psa_test/sample.tfm.psa_internal_trusted_storage_test/tfm/app/psa_api_tests/targetConfigGen.c:1:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
         ^~~~~~~~~

Expected behavior

The toolchain triplet (CROSS_COMPILE) should be passed in to the cmake ExternalProject when running the PSA tests so that the right compiler is called.

@jk-arm
Copy link
Collaborator

jk-arm commented Jun 30, 2021

we will revisit this topic after july 11th as planned release activity psa arch test v1.2 on going

@jk-arm
Copy link
Collaborator

jk-arm commented Jul 15, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants