-
Notifications
You must be signed in to change notification settings - Fork 45
Description
Describe the bug
The Cmake build system does not include directories from statically linked apps therefore will fail the build at the table build step.
To Reproduce
Steps to reproduce the behavior:
- Modify targets.cmake to statically build and link the ci_lab app
- Build cFS native BSP
- See error
[ 7%] Generating /home/cfs/build/tables/cpu1_to_lab.tbla0d6f7c6e66ad78aa3a1e5e8276d687c207b1f98.to_lab_sub.d
[ 7%] Built target generate_table_cpu1_to_lab_to_lab_sub
[ 7%] Building C object apps/sch_lab/CMakeFiles/tblobj_cpu1_sch_lab.tbld63915454be8d975ed82076090c29749730f0d8a.dir/fsw/tables/sch_lab_table.c.o
/home/cfs/apps/sch_lab/fsw/tables/sch_lab_table.c:59:10: fatal error: ci_lab_msgids.h: No such file or directory
59 | #include "ci_lab_msgids.h"
| ^~~~~~~~~~~~~~~~~
compilation terminated.
Expected behavior
Expected behavior is for the build system to properly target the correct include directories whether an app is built dynamically or statically.
Code snips
Root cause is that the list TGTSYS_${SYSVAR}_APPS only caches dynamically linked apps. A quick workaround is to use the MISSION_APPS list which includes all cFS components.
FROM:
Lines 8 to 15 in 82645f5
| foreach(EXT_APP ci_lab to_lab sample_app sc hs lc ds fm) | |
| list (FIND TGTSYS_${SYSVAR}_APPS ${EXT_APP} HAVE_APP) | |
| if (HAVE_APP GREATER_EQUAL 0) | |
| include_directories($<TARGET_PROPERTY:${EXT_APP},INTERFACE_INCLUDE_DIRECTORIES>) | |
| string(TOUPPER "HAVE_${EXT_APP}" APP_MACRO) | |
| add_definitions(-D${APP_MACRO}) | |
| endif() | |
| endforeach() |
TO:
foreach(EXT_APP ci_lab sample_app hs fm ds sc lc)
list (FIND MISSION_APPS ${EXT_APP} HAVE_APP)
if (HAVE_APP GREATER_EQUAL 0)
include_directories($<TARGET_PROPERTY:${EXT_APP},INTERFACE_INCLUDE_DIRECTORIES>)
string(TOUPPER "HAVE_${EXT_APP}" APP_MACRO)
add_definitions(-D${APP_MACRO})
endif()
endforeach()
Additional context
This issue is hidden if the #ifdef HAVE_app_APP macros are used around other app include files and macro definitions. The build will not fail, however the statically linked app(s) will not be scheduled.
This issue is also found in the to_lab app: Statically linked apps interface directories are not linked #212
System observed on:
- Hardware: VirtualBox
- OS: Ubuntu 24.04, GCC 13.3
- Versions: cFS equulues-rc1
Reporter Info
Mark Foster
NASA / Johnson Space Center / ER6