Hi Sebastian,

After discussing with JK from psa arch test team, we found the issue may be related to the Ninja build system.
If you try to build tfm with cmake -G " Unix Makefiles" in cmake 3.25, it could build successfully.
Ninja is a small build system that is focused on speed. I guess maybe it does some optimization to run builds parallel to speed up the build and that cause this issue.

Best Regards,
Summer


From: David Hu via TF-M <tf-m@lists.trustedfirmware.org>
Sent: Monday, November 28, 2022 1:24 PM
To: Bøe, Sebastian <Sebastian.Boe@nordicsemi.no>; tf-m@lists.trustedfirmware.org <tf-m@lists.trustedfirmware.org>
Cc: nd <nd@arm.com>
Subject: [TF-M] Re: CMake 3.25.0 build issue
 

Hi Sebastian,

 

Thanks a lot for reporting this.

I also reproduced it on AN521. `target_database.h` is generated and installed by PSA Arch test build. It is transparent to TF-M build.

 

The generation step is skipped with CMake 2.25 while it is generated successfully with CMake 2.21:

`

[218/494] Performing install step for 'psa_generate_database'

[1/5] [PSA] : Creating generator source /home/davhu01/project/tf-m/gerrit-tf-m/profile_test/build/tf-m-tests/app/psa_api_tests/targetConfigGen.c

[2/5] Building C object CMakeFiles/TargetConfigGen.dir/home/davhu01/project/tf-m/gerrit-tf-m/profile_test/build/tf-m-tests/app/psa_api_tests/targetConfigGen.c.o

[3/5] Linking C executable TargetConfigGen

[4/5] [PSA] : Creating output header target_database.h

[4/5] Install the project...

`

Since install() shall happen after all builds complete, I guess some dependencies are broken with CMake 2.25.

Can you please raise this issue to https://github.com/ARM-software/psa-arch-tests/issues? PSA Arch tests developers should know the root cause better.

 

Best regards,

Hu Ziji

 

From: Bøe, Sebastian via TF-M <tf-m@lists.trustedfirmware.org>
Sent: Friday, November 25, 2022 9:39 PM
To: tf-m@lists.trustedfirmware.org
Subject: [TF-M] CMake 3.25.0 build issue

 

Hi,

 

when I updated from CMake 3.24.0 to the new (two weeks old) CMake 3.25.0 I am no longer

able to build TF-M with -DTEST_PSA_API=CRYPTO.

 

(Downgrading CMake fixes the issue)

 

Is there an interoperability issue with the latest CMake release and the TF-M build system?

 

Reproduced with

TF-Mv1.7.0-RC1

TF-Mv1.6.0

 

Steps to reproduce:

 

  1. install CMake 3.25.0.
  1. cd trusted-firmware-m
  1. rm -rf cmake_build && cmake -G Ninja -S . -B cmake_build -DTEST_PSA_API=CRYPTO  -DTFM_PLATFORM=nordic_nrf/nrf5340dk_nrf5340_cpuapp -DTFM_TOOLCHAIN_FILE=toolchain_GNUARM.cmake -DCMAKE_BUILD_TYPE=Debug && ninja -C cmake_build

 

Only reproduces with TEST_PSA_API and CMake 3.25.0. Builds fine with 3.24.0 or non-PSA API builds.

 

error:

 

  file INSTALL cannot find

  "/home/sebo/ncs/modules/tee/tf-m/trusted-firmware-m/cmake_build/tf-m-tests/app/psa_api_tests/src/psa_generate_database-build/target_database.h":

  No such file or directory.