Page MenuHomePhabricator

Build TF-M 1.6 regression test failed with too long path on Windows
Open, HighPublic


On Windows 10 64-bit, build TF-M 1.6 (tag TF-Mv1.6.0),regression test:

cmake -S . \
-B cmake_build \
-DTFM_PLATFORM=nuvoton/m2354 \
-G"Unix Makefiles"

Meet failure like:

[ 7%] Built target tfm_app_rot_partition_secure_client_2
[ 7%] Building C object tf-m-tests/test/secure_fw/common_test_services/tfm_secure_client_service/CMakeFiles/tfm_psa_rot_partition_secure_client_service.dir/tfm_secure_client_service.o
[ 7%] Building C object tf-m-tests/test/secure_fw/common_test_services/tfm_secure_client_service/CMakeFiles/tfm_psa_rot_partition_secure_client_service.dir/__/__/__/__/__/generated/secure_fw/test_services/tfm_secure_client_service/auto_generated/intermedia_tfm_secure_client_service.o
C:/CCLi8/IoT/mbed/mbed-tfm/trusted-firmware-m/cmake_build/generated/secure_fw/test_services/tfm_secure_client_service/auto_generated/intermedia_tfm_secure_client_service.c:12:1: fatal error: opening dependency file CMakeFiles/tfm_psa_rot_partition_secure_client_service.dir/__/__/__/__/__/generated/secure_fw/test_services/tfm_secure_client_service/auto_generated/intermedia_tfm_secure_client_service.o.d: No such file or directory

12 | uint8_t tfm_sp_secure_test_partition_stack[0x0D00] __attribute__((aligned(8)));
   | ^~~~~~~

compilation terminated.
make[2]: * [tf-m-tests/test/secure_fw/common_test_services/tfm_secure_client_service/CMakeFiles/tfm_psa_rot_partition_secure_client_service.dir/build.make:90: tf-m-tests/test/secure_fw/common_test_services/tfm_secure_client_service/CMakeFiles/tfm_psa_rot_partition_secure_client_service.dir/__/__/__/__/__/generated/secure_fw/test_services/tfm_secure_client_service/auto_generated/intermedia_tfm_secure_client_service.o] Error 1
* [CMakeFiles/Makefile2:2453: tf-m-tests/test/secure_fw/common_test_services/tfm_secure_client_service/CMakeFiles/tfm_psa_rot_partition_secure_client_service.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Per look, it results from too long path. Though I try "subst" to short the build path, it is still too long.

OS: Windows 10 64-bit
Compiler: GNU Arm Embedded Toolchain 10.3-2021.07
TF-M: TF-Mv1.6.0

Event Timeline

ccli8 created this task.May 5 2022, 6:49 AM
adeaarm triaged this task as High priority.May 5 2022, 8:40 AM
KenLSoft added a subscriber: KenLSoft.EditedMay 5 2022, 10:54 AM


This issue was spotted by windows users, and here are some workarounds:

  • Try out of tree build, as the updated instructions in the document:, in section 'Build AN521 regression sample'.

The latest Windows support long paths, but if you are less lucky then you can reduce paths by moving the build directory closer to the root, using the ‘out of tree’ build. For example to build in C:\build folder you can:

cd trusted-firmware-m
cmake -G"Unix Makefiles" -S . -B C:/build -DTFM_PLATFORM=arm/mps2/an521 -DTFM_TOOLCHAIN_FILE=toolchain_GNUARM.cmake -DCMAKE_BUILD_TYPE=Debug -DTEST_S=ON -DTEST_NS=ON
cmake --build C:/build -- install
  • Put the project under a short path, such as c:/folder/ or something.

Tried to provide a default solution by modifying the root Cmakelist.txt:


But the gnutools may report long path issues as well (reported, not sure if it has been fixed).

Please try the possible solutions for you.


ccli8 added a comment.May 6 2022, 3:34 AM

Shorten the build directory -B C:/build can help, but not enough. The same error still occurs.

set(CMAKE_OBJECT_PATH_MAX 1000) doesn't work.

I find a workaround: Pass -DTFM_TEST_REPO_PATH to use pre-downloaded tf-m-tests repo, which has the below modification to shorten the too long path:


add_subdirectory(common_test_services/tfm_secure_client_service **${CMAKE_BINARY_DIR}/tfm_secure_client_service**)
add_subdirectory(common_test_services/tfm_secure_client_2 **${CMAKE_BINARY_DIR}/tfm_secure_client_2**)

The idea is to further shorten the build directory separately which generates the too long path error. Perhaps, it can help to come out with one general solution for you.

Thanks for your feedback.

If your modification can work on the project, could you create a patch? And we can create one based on your input if you are not available.

We were thinking to shorten the name and depth of the test repo but did not do it now as there is no report on this -- but now we have reported issues ;)

ccli8 added a comment.May 10 2022, 6:12 AM

My modification is very draft, so I just list it here. Actually, the above has mentioned in total.

In tf-m-tests repo tagged TF-Mv1.6.0, change the file test/secure_fw/secure_tests.cmake to specify shorter output path rather than default:


# secure test services are required if any secure test is opened


# secure test services are required if any secure test is opened
add_subdirectory(common_test_services/tfm_secure_client_service ${CMAKE_BINARY_DIR}/tfm_secure_client_service)
add_subdirectory(common_test_services/tfm_secure_client_2 ${CMAKE_BINARY_DIR}/tfm_secure_client_2)

Hi! Thanks for your draft! I created a patch: Does it meet your requirements?