Expected ')' before 'PRIi64' when trying to compile the CTP echo server

I am writing an emac driver for my platform and would like to follow the porting guide’s suggestion to run the tests that come with mbed-os. The readme for the emac tests tells me that I need to program a device as a CTP echo server. So in a fresh mbed project I do this:

cd mbed-os
mbed update mbed-os-6.3.0
mbed test --compile -m NUCLEO_H743ZI2 -t GCC_ARM -v -n tests-network-emac --app-config ./mbed-os/connectivity/netsocket/tests/TESTS/network/emac/template_mbed_app_echo_server.txt

This gives me:

[mbed] Working path "/home/extmaha/work/ctp-echo-server" (library)
[mbed] Program path "/home/extmaha/work/ctp-echo-server"
[mbed] Exec "/usr/bin/python3 -u /home/extmaha/work/ctp-echo-server/mbed-os/tools/test.py -D MBED_TEST_MODE -t GCC_ARM -m NUCLEO_H743ZI2 --source . --build ./BUILD/tests/NUCLEO_H743ZI2/GCC_ARM --test-spec ./BUILD/tests/NUCLEO_H743ZI2/GCC_ARM/test_spec.json --build-data ./BUILD/tests/NUCLEO_H743ZI2/GCC_ARM/build_data.json -n tests-network-emac -v --app-config ./mbed-os/connectivity/netsocket/tests/TESTS/network/emac/template_mbed_app_echo_server.txt --greentea" in "/home/extmaha/work/ctp-echo-server"
[Warning] Test with name 'tests-network-emac' was not found in the available tests
Building library mbed-build (NUCLEO_H743ZI2, GCC_ARM)
Scan: ctp-echo-server
Using ROM region application in this build.
  Region application: size 0x200000, offset 0x8000000
Using RAM region application_ram in this build.
  Region application_ram: size 0x80000, offset 0x24000000
Macros: -DUSE_FULL_LL_DRIVER -DTARGET_NUCLEO_H743ZI2 -DDEVICE_FLASH=1 -D__FPU_PRESENT=1 -DMBED_BUILD_TIMESTAMP=1600342346.2064257 -DDEVICE_TRNG=1 -DDEVICE_INTERRUPTIN=1 -DTRANSACTION_QUEUE_SIZE_SPI=2 -DDEVICE_SERIAL=1 -DDEVICE_I2C=1 -DDEVICE_USTICKER=1 -DDEVICE_RTC=1 -DEXTRA_IDLE_STACK_REQUIRED -DDEVICE_PORTIN=1 -DDEVICE_SLEEP=1 -DTARGET_RTOS_M4_M7 -DTARGET_M7 -DTARGET_LIKE_CORTEX_M7 -DDEVICE_SPISLAVE=1 -DDEVICE_ANALOGIN=1 -D__MBED__=1 -DDEVICE_I2CSLAVE=1 -D__MBED_CMSIS_RTOS_CM -DMBED_TICKLESS -DDEVICE_SPI_ASYNCH=1 -D__CORTEX_M7 -DTARGET_MCU_STM32H7 -DDEVICE_PORTOUT=1 -DARM_MATH_CM7 -DDEVICE_STDIO_MESSAGES=1 -D__CMSIS_RTOS -DTARGET_MCU_STM32 -DSTM32H743xx -DTARGET_STM -DDEVICE_RESET_REASON=1 -DDEVICE_LPTICKER=1 -DDEVICE_PORTINOUT=1 -DMBED_TEST_MODE -DDEVICE_CRC=1 -DTOOLCHAIN_GCC_ARM -DUSE_HAL_DRIVER -DTARGET_STM32H743xI -DTARGET_CORTEX_M -DTOOLCHAIN_GCC -DDEVICE_ANALOGOUT=1 -DTARGET_CORTEX -DTARGET_LIKE_MBED -DDEVICE_SPI=1 -DDEVICE_WATCHDOG=1 -DDEVICE_SERIAL_FC=1 -DCOMPONENT_FLASHIAP=1 -DTARGET_FF_ARDUINO -DDEVICE_MPU=1 -DTARGET_STM32H7 -DDEVICE_EMAC=1 -DDEVICE_I2C_ASYNCH=1 -DTARGET_NAME=NUCLEO_H743ZI2 -DTARGET_RELEASE -DDEVICE_PWMOUT=1 -DDEVICE_CAN=1
Compile [ 46.3%]: ws_pae_time.c
Compile: arm-none-eabi-gcc -c -std=gnu11 -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -ffunction-sections -fdata-sections -funsigned-char -MMD -fomit-frame-pointer -Os -g -DMBED_TRAP_ERRORS_ENABLED=1 -DMBED_MINIMAL_PRINTF -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=softfp -DAPPLICATION_ADDR=0x8000000 -DAPPLICATION_SIZE=0x200000 -DAPPLICATION_RAM_ADDR=0x24000000 -DAPPLICATION_RAM_SIZE=0x80000 -DMBED_ROM1_START=0x8100000 -DMBED_ROM1_SIZE=0x100000 -DMBED_ROM_START=0x8000000 -DMBED_ROM_SIZE=0x200000 -DMBED_RAM_START=0x24000000 -DMBED_RAM_SIZE=0x80000 -DMBED_RAM1_START=0x24000000 -DMBED_RAM1_SIZE=0x80000 -DUSE_FULL_LL_DRIVER -DTARGET_NUCLEO_H743ZI2 -DDEVICE_FLASH=1 -D__FPU_PRESENT=1 -DMBED_BUILD_TIMESTAMP=1600342346.2064257 -DDEVICE_TRNG=1 -DDEVICE_INTERRUPTIN=1 -DTRANSACTION_QUEUE_SIZE_SPI=2 -DDEVICE_SERIAL=1 -DDEVICE_I2C=1 -DDEVICE_USTICKER=1 -DDEVICE_RTC=1 -DEXTRA_IDLE_STACK_REQUIRED -DDEVICE_PORTIN=1 -DDEVICE_SLEEP=1 -DTARGET_RTOS_M4_M7 -DTARGET_M7 -DTARGET_LIKE_CORTEX_M7 -DDEVICE_SPISLAVE=1 -DDEVICE_ANALOGIN=1 -D__MBED__=1 -DDEVICE_I2CSLAVE=1 -D__MBED_CMSIS_RTOS_CM -DMBED_TICKLESS -DDEVICE_SPI_ASYNCH=1 -D__CORTEX_M7 -DTARGET_MCU_STM32H7 -DDEVICE_PORTOUT=1 -DARM_MATH_CM7 -DDEVICE_STDIO_MESSAGES=1 -D__CMSIS_RTOS -DTARGET_MCU_STM32 -DSTM32H743xx -DTARGET_STM -DDEVICE_RESET_REASON=1 -DDEVICE_LPTICKER=1 -DDEVICE_PORTINOUT=1 -DMBED_TEST_MODE -DDEVICE_CRC=1 -DTOOLCHAIN_GCC_ARM -DUSE_HAL_DRIVER -DTARGET_STM32H743xI -DTARGET_CORTEX_M -DTOOLCHAIN_GCC -DDEVICE_ANALOGOUT=1 -DTARGET_CORTEX -DTARGET_LIKE_MBED -DDEVICE_SPI=1 -DDEVICE_WATCHDOG=1 -DDEVICE_SERIAL_FC=1 -DCOMPONENT_FLASHIAP=1 -DTARGET_FF_ARDUINO -DDEVICE_MPU=1 -DTARGET_STM32H7 -DDEVICE_EMAC=1 -DDEVICE_I2C_ASYNCH=1 -DTARGET_NAME=NUCLEO_H743ZI2 -DTARGET_RELEASE -DDEVICE_PWMOUT=1 -DDEVICE_CAN=1 @./BUILD/tests/NUCLEO_H743ZI2/GCC_ARM/.includes_4bdf7e4ab6aac31284d5465d91842724.txt -include ./BUILD/tests/NUCLEO_H743ZI2/GCC_ARM/mbed_config.h -MD -MF BUILD/tests/NUCLEO_H743ZI2/GCC_ARM/mbed-os/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_time.d -o BUILD/tests/NUCLEO_H743ZI2/GCC_ARM/mbed-os/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_time.o ./mbed-os/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_time.c
[Error] ws_pae_time.c@174,103: expected ')' before 'PRIi64'
[Warning] ws_pae_time.c@174,22: spurious trailing '%' in format [-Wformat=]
[DEBUG] Return: 1
[DEBUG] Output: In file included from ./mbed-os/connectivity/libraries/nanostack-libservice/mbed-client-libservice/ns_trace.h:32,
[DEBUG] Output:                  from ./mbed-os/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_time.c:22:
[DEBUG] Output: ./mbed-os/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_time.c: In function 'ws_pae_current_time_set':
[DEBUG] Output: ./mbed-os/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_time.c:174:103: error: expected ')' before 'PRIi64'
[DEBUG] Output:   174 |             tr_error("FATAL: system time less than reference time or more than 12 months in future: %"PRIi64" reference time: %"PRIi64, system_time, current_time);
[DEBUG] Output:       |                                                                                                       ^~~~~~
[DEBUG] Output: ./mbed-os/platform/mbed-trace/include/mbed-trace/mbed_trace.h:143:79: note: in definition of macro 'tr_error'
[DEBUG] Output:   143 | #define tr_error(...)           mbed_tracef(TRACE_LEVEL_ERROR,   TRACE_GROUP, __VA_ARGS__)   //!< Print Error Message
[DEBUG] Output:       |                                                                               ^~~~~~~~~~~
[DEBUG] Output: ./mbed-os/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_time.c:174:22: warning: spurious trailing '%' in format [-Wformat=]
[DEBUG] Output:   174 |             tr_error("FATAL: system time less than reference time or more than 12 months in future: %"PRIi64" reference time: %"PRIi64, system_time, current_time);
[DEBUG] Output:       |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[DEBUG] Output: ./mbed-os/platform/mbed-trace/include/mbed-trace/mbed_trace.h:143:79: note: in definition of macro 'tr_error'
[DEBUG] Output:   143 | #define tr_error(...)           mbed_tracef(TRACE_LEVEL_ERROR,   TRACE_GROUP, __VA_ARGS__)   //!< Print Error Message
[DEBUG] Output:       |                                                                               ^~~~~~~~~~~
[DEBUG] Output: ./mbed-os/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_time.c:174:101: note: format string is defined here
[DEBUG] Output:   174 |             tr_error("FATAL: system time less than reference time or more than 12 months in future: %"PRIi64" reference time: %"PRIi64, system_time, current_time);
[DEBUG] Output:       |                                                                                                     ^
[ERROR] In file included from ./mbed-os/connectivity/libraries/nanostack-libservice/mbed-client-libservice/ns_trace.h:32,
                 from ./mbed-os/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_time.c:22:
./mbed-os/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_time.c: In function 'ws_pae_current_time_set':
./mbed-os/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_time.c:174:103: error: expected ')' before 'PRIi64'
  174 |             tr_error("FATAL: system time less than reference time or more than 12 months in future: %"PRIi64" reference time: %"PRIi64, system_time, current_time);
      |                                                                                                       ^~~~~~
./mbed-os/platform/mbed-trace/include/mbed-trace/mbed_trace.h:143:79: note: in definition of macro 'tr_error'
  143 | #define tr_error(...)           mbed_tracef(TRACE_LEVEL_ERROR,   TRACE_GROUP, __VA_ARGS__)   //!< Print Error Message
      |                                                                               ^~~~~~~~~~~
./mbed-os/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_time.c:174:22: warning: spurious trailing '%' in format [-Wformat=]
  174 |             tr_error("FATAL: system time less than reference time or more than 12 months in future: %"PRIi64" reference time: %"PRIi64, system_time, current_time);
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./mbed-os/platform/mbed-trace/include/mbed-trace/mbed_trace.h:143:79: note: in definition of macro 'tr_error'
  143 | #define tr_error(...)           mbed_tracef(TRACE_LEVEL_ERROR,   TRACE_GROUP, __VA_ARGS__)   //!< Print Error Message
      |                                                                               ^~~~~~~~~~~
./mbed-os/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_time.c:174:101: note: format string is defined here
  174 |             tr_error("FATAL: system time less than reference time or more than 12 months in future: %"PRIi64" reference time: %"PRIi64, system_time, current_time);
      |                                                                                                     ^

Failed to build library

Memory map breakdown for built projects (values in Bytes):
| name | target | toolchain | static_ram | total_flash |
|------|--------|-----------|------------|-------------|


Build failures:
  * NUCLEO_H743ZI2::GCC_ARM::MBED-BUILD
        
[mbed] ERROR: "/usr/bin/python3" returned error.
       Code: 1
       Path: "/home/extmaha/work/ctp-echo-server"
       Command: "/usr/bin/python3 -u /home/extmaha/work/ctp-echo-server/mbed-os/tools/test.py -D MBED_TEST_MODE -t GCC_ARM -m NUCLEO_H743ZI2 --source . --build ./BUILD/tests/NUCLEO_H743ZI2/GCC_ARM --test-spec ./BUILD/tests/NUCLEO_H743ZI2/GCC_ARM/test_spec.json --build-data ./BUILD/tests/NUCLEO_H743ZI2/GCC_ARM/build_data.json -n tests-network-emac -v --app-config ./mbed-os/connectivity/netsocket/tests/TESTS/network/emac/template_mbed_app_echo_server.txt --greentea"
---

I have tried this on mbed-os 5.15.5 as well, but get pretty much the same result.

What should I do?

Martin

It looks like that c file that it’s complaining about needs to #include <inttypes.h>.