Intermittent CI failure in job test_tf_psa_crypto_shared #286

Closed
opened 2025-05-07 09:34:26 -05:00 by felixc-arm · 1 comment
felixc-arm commented 2025-05-07 09:34:26 -05:00 (Migrated from github.com)

The CI job tf-psa-crypto-all_u16-test_tf_psa_crypto_shared has occasional failures (in both OpenCI & Internal CI) with the build error:

[ 31%] Building C object core/CMakeFiles/tfpsacrypto.dir/psa_crypto.c.o
/var/lib/build/core/psa_crypto.c:21:10: fatal error: 'psa_crypto_driver_wrappers.h' file not found
 #include "psa_crypto_driver_wrappers.h"
         ^
 /var/lib/build/core/psa_crypto.c:21:10: fatal error: 'psa_crypto_driver_wrappers.h' file not found
 #include "psa_crypto_driver_wrappers.h"
         ^
1 error generated.
core/CMakeFiles/tfpsacrypto_static.dir/build.make:71: recipe for target 'core/CMakeFiles/tfpsacrypto_static.dir/psa_crypto.c.o' failed
make[2]: *** [core/CMakeFiles/tfpsacrypto_static.dir/psa_crypto.c.o] Error 1
CMakeFiles/Makefile2:329: recipe for target 'core/CMakeFiles/tfpsacrypto_static.dir/all' failed
make[1]: *** [core/CMakeFiles/tfpsacrypto_static.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
 31%] Building C object core/CMakeFiles/tfpsacrypto.dir/psa_crypto_client.c.o
1 error generated.
core/CMakeFiles/tfpsacrypto.dir/build.make:71: recipe for target 'core/CMakeFiles/tfpsacrypto.dir/psa_crypto.c.o' failed
make[2]: *** [core/CMakeFiles/tfpsacrypto.dir/psa_crypto.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:290: recipe for target 'core/CMakeFiles/tfpsacrypto.dir/all' failed
make[1]: *** [core/CMakeFiles/tfpsacrypto.dir/all] Error 2
make: *** [all] Error 2
Makefile:138: recipe for target 'all' failed
 ^^^^test_tf_psa_crypto_shared: build/test: shared libraries: make -> 2^^^^

This job executes cmake -DUSE_SHARED_TF_PSA_CRYPTO_LIBRARY=ON /var/lib/build and then make and runs on Ubuntu 16 with Clang 3.8 at the time of writing.

It has been seen on many PRs (I won't link the Jenkins jobs as they'll probably be stale & deleted by the time this is worked on):
https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/247 (inc https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/247#issuecomment-2858712634)
https://github.com/Mbed-TLS/mbedtls-framework/pull/153
https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/288 https://mbedtls.trustedfirmware.org/blue/organizations/jenkins/mbed-tls-tf-psa-crypto-multibranch/detail/PR-271-head/4/pipeline
None of which have obvious changes that should cause this error (especially the framework PR)

psa_crypto_driver_wrappers.h is a generated file from tf-psa-crypto/scripts/generate_driver_wrappers.py used in tf-psa-crypto/core/CMakeLists.txt, so it seems that in some circumstances this file fails to generate/is not generated fast enough to be present when core/psa_crypto.c is compiled.

The CI job `tf-psa-crypto-all_u16-test_tf_psa_crypto_shared` has occasional failures (in both OpenCI & Internal CI) with the build error: ``` [ 31%] Building C object core/CMakeFiles/tfpsacrypto.dir/psa_crypto.c.o /var/lib/build/core/psa_crypto.c:21:10: fatal error: 'psa_crypto_driver_wrappers.h' file not found #include "psa_crypto_driver_wrappers.h" ^ /var/lib/build/core/psa_crypto.c:21:10: fatal error: 'psa_crypto_driver_wrappers.h' file not found #include "psa_crypto_driver_wrappers.h" ^ 1 error generated. core/CMakeFiles/tfpsacrypto_static.dir/build.make:71: recipe for target 'core/CMakeFiles/tfpsacrypto_static.dir/psa_crypto.c.o' failed make[2]: *** [core/CMakeFiles/tfpsacrypto_static.dir/psa_crypto.c.o] Error 1 CMakeFiles/Makefile2:329: recipe for target 'core/CMakeFiles/tfpsacrypto_static.dir/all' failed make[1]: *** [core/CMakeFiles/tfpsacrypto_static.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... 31%] Building C object core/CMakeFiles/tfpsacrypto.dir/psa_crypto_client.c.o 1 error generated. core/CMakeFiles/tfpsacrypto.dir/build.make:71: recipe for target 'core/CMakeFiles/tfpsacrypto.dir/psa_crypto.c.o' failed make[2]: *** [core/CMakeFiles/tfpsacrypto.dir/psa_crypto.c.o] Error 1 make[2]: *** Waiting for unfinished jobs.... CMakeFiles/Makefile2:290: recipe for target 'core/CMakeFiles/tfpsacrypto.dir/all' failed make[1]: *** [core/CMakeFiles/tfpsacrypto.dir/all] Error 2 make: *** [all] Error 2 Makefile:138: recipe for target 'all' failed ^^^^test_tf_psa_crypto_shared: build/test: shared libraries: make -> 2^^^^ ``` This job executes `cmake -DUSE_SHARED_TF_PSA_CRYPTO_LIBRARY=ON /var/lib/build` and then `make` and runs on Ubuntu 16 with Clang 3.8 at the time of writing. It has been seen on many PRs (I won't link the Jenkins jobs as they'll probably be stale & deleted by the time this is worked on): https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/247 (inc https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/247#issuecomment-2858712634) https://github.com/Mbed-TLS/mbedtls-framework/pull/153 https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/288 https://mbedtls.trustedfirmware.org/blue/organizations/jenkins/mbed-tls-tf-psa-crypto-multibranch/detail/PR-271-head/4/pipeline None of which have obvious changes that should cause this error (especially the framework PR) `psa_crypto_driver_wrappers.h` is a generated file from `tf-psa-crypto/scripts/generate_driver_wrappers.py` used in `tf-psa-crypto/core/CMakeLists.txt`, so it seems that in some circumstances this file fails to generate/is not generated fast enough to be present when `core/psa_crypto.c` is compiled.
gilles-peskine-arm commented 2025-05-12 02:54:21 -05:00 (Migrated from github.com)

The symptom is a build that fails sometimes because a generated file is not present. The most likely explanation is a missing dependency in **/CMakeLists.txt. On the CI, we set MAKEFLAGS=-j2 in the environment, meaning that builds are done in parallel.

We run make generated_files before each all.sh component, so normally the generated files are already present in the source tree when a component's code runs make. But that doesn't help when doing an out-of-source build, if the build requires the generated file to be in the build tree.

The symptom is a build that fails sometimes because a generated file is not present. The most likely explanation is a missing dependency in `**/CMakeLists.txt`. On the CI, we set `MAKEFLAGS=-j2` in the environment, meaning that builds are done in parallel. We run `make generated_files` before each `all.sh` component, so normally the generated files are already present in the source tree when a component's code runs `make`. But that doesn't help when doing an out-of-source build, if the build requires the generated file to be in the build tree.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-Mbed-TLS/TF-PSA-Crypto#286
No description provided.