INCLUDE_DIRS with long path

62 views
Skip to first unread message

Tony Morris

unread,
Nov 7, 2023, 7:55:36 PM11/7/23
to cpputest
Hello,

I am using cpputest running within Docker and once I figured out the proper way to get the including "#include <functional>" from a NewMacros.h to work via the makefile CPPUTEST_CXXFLAGS, I thought I was home free.  ....then I ran across an INCLUDE_DIRS issue.  From STM32Cube, I can see that the one of the files I am adding a test for eventually includes a FreeRTOS file that then includes "reent.h" is from a long path.  In STM32Cube, I can F3 on that include an its folder is quite a long path.  I tried adding as an explicit path and then as relative but in both cases, it fails to find the file with the below error.

In file included from ../adc/CM7/Core/Inc/CC/Time/Timespan.h:11,
                 from ../adc/CM7/Core/Inc/CC/Time/Timespan.cc:8:
../adc/Middlewares/Third_Party/FreeRTOS/Source/include/FreeRTOS.h:71:18: fatal error: reent.h: No such file or directory
   71 |         #include <reent.h>
      |                  ^~~~~~~~~
compilation terminated.


Here are the ways I tried to add it in the makefile:
INCLUDE_DIRS += ../../../../ST/STM32CubeIDE_1.13.1/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.1.202309131626/tools/arm-none-eabi/include
 
INCLUDE_DIRS += C:/ST/STM32CubeIDE_1.13.1/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.1.202309131626/tools/arm-none-eabi/include

Note my other additions have worked so far but their path is far shorter such as this:
INCLUDE_DIRS += ../adc/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F

The only other issue I can imagine if path length is not the issue is if the '.' characters oin the path might be an issue.

Any thoughts?
Tony

Tony Morris

unread,
Nov 8, 2023, 3:43:28 PM11/8/23
to cpputest
Well, I found a way around this by first modifying the run.sh script to mount that folder fairly locally and then include that shorter path in the makefile:

== run.sh ==
#!/bin/bash

TAG=jwgrenning/cpputest-runner

HOST_WORKDIR=${PWD}
WORKDIR=/home
COMMAND=${1:-/bin/bash}

sudo docker run \
  --rm \
  --name cpputest-runner \
  --volume "${HOST_WORKDIR}":"${WORKDIR}" \
  --workdir "${WORKDIR}" \
  -v /mnt/c/ST/STM32CubeIDE_1.13.1/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.1.202309131626:/mnt/plgin \
  -it $TAG \
  $COMMAND


== makefile tail of file ==

...

include $(CPPUTEST_HOME)/build/MakefileWorker.mk
INCLUDE_DIRS += /mnt/plgin/tools/arm-none-eabi/include



That just moved the problem with the new error below so I am likely going to have to figure out how much I have to fake/mock...

make: Entering directory '/home/cpputest'
compiling StatisticsTests.cc
In file included from /opt/cpputest/include/CppUTest/StandardCLibrary.h:21,
                 from /opt/cpputest/include/CppUTest/CppUTestConfig.h:95,
                 from /opt/cpputest/include/CppUTest/MemoryLeakDetectorNewMacros.h:22,
                 from ./../adc/TestCodeTDD/NewMacros.h:4,
                 from <command-line>:
/mnt/plgin/tools/arm-none-eabi/include/stdlib.h:63: error: "RAND_MAX" redefined [-Werror]
   63 | #define RAND_MAX __RAND_MAX
      |
compilation terminated due to -Wfatal-errors.
cc1plus: all warnings being treated as errors



Anyway, I think I am over the hump, but I suppose the better long-term solution is to be able to use an alternate configuration the STM32Cube, like DEBUG CPPUTEST and have it be able to run the target tests outside of the hardware.  That will take time...
Reply all
Reply to author
Forward
0 new messages