You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
cFE compiles (with warnings about implicit function declarations), but linking the cfe_core executable errors out with undefined references to symbols CFE_SB_ValueToMsgId and CFE_SB_MsgIdToValue.
To Reproduce
Steps to reproduce the behavior:
Create a mission configuration. Modify global_build_options.cmake by adding the following two lines:
set(MISSION_INCLUDE_CCSDSEXT_HEADER TRUE)
set(MISSION_MSGID_V2 TRUE)
Build cFS. The following warnings will be issued when compiling cfe_msg_msgid_v2.c:
[ 77%] Building C object msg/CMakeFiles/msg.dir/fsw/src/cfe_msg_msgid_v2.c.o
/home/dsa/lpnt_ws/dsa_lpnt_fsw/fsw/cFS/cfe/modules/msg/fsw/src/cfe_msg_msgid_v2.c: In function ‘CFE_MSG_GetMsgId’:
/home/dsa/lpnt_ws/dsa_lpnt_fsw/fsw/cFS/cfe/modules/msg/fsw/src/cfe_msg_msgid_v2.c:80:14: warning: implicit declaration of function ‘CFE_SB_ValueToMsgId’ [-Wimplicit-function-declaration]
80 | *MsgId = CFE_SB_ValueToMsgId(msgidval);
| ^~~~~~~~~~~~~~~~~~~
/home/dsa/lpnt_ws/dsa_lpnt_fsw/fsw/cFS/cfe/modules/msg/fsw/src/cfe_msg_msgid_v2.c: In function ‘CFE_MSG_SetMsgId’:
/home/dsa/lpnt_ws/dsa_lpnt_fsw/fsw/cFS/cfe/modules/msg/fsw/src/cfe_msg_msgid_v2.c:96:36: warning: implicit declaration of function ‘CFE_SB_MsgIdToValue’ [-Wimplicit-function-declaration]
96 | CFE_SB_MsgId_Atom_t msgidval = CFE_SB_MsgIdToValue(MsgId);
| ^~~~~~~~~~~~~~~~~~~
The following error will be reported at the link phase:
[100%] Linking C executable core-cpu1
/usr/bin/ld: ../msg/libmsg.a(cfe_msg_msgid_v2.c.o): in function CFE_MSG_GetMsgId': cfe_msg_msgid_v2.c:(.text+0x8b): undefined reference to CFE_SB_ValueToMsgId'
/usr/bin/ld: ../msg/libmsg.a(cfe_msg_msgid_v2.c.o): in function CFE_MSG_SetMsgId': cfe_msg_msgid_v2.c:(.text+0xd1): undefined reference to CFE_SB_MsgIdToValue'
collect2: error: ld returned 1 exit status
make[11]: *** [cpu1/CMakeFiles/core-cpu1.dir/build.make:199: cpu1/core-cpu1] Error 1
The bug occurs because the two functions are defined as 'static inline' in cfe_sb.h, which is not referenced in cfe_msg_msgid_v2.c, and because the C language prior to the C99 standard implicitly defines functions as int fn_name(int). Simply adding #include "cfe_sb.h" fixes the problem.
Expected behavior
core-cpu1 should compile and link cleanly.
Describe the bug
cFE compiles (with warnings about implicit function declarations), but linking the cfe_core executable errors out with undefined references to symbols
CFE_SB_ValueToMsgId
andCFE_SB_MsgIdToValue
.To Reproduce
Steps to reproduce the behavior:
Create a mission configuration. Modify global_build_options.cmake by adding the following two lines:
set(MISSION_INCLUDE_CCSDSEXT_HEADER TRUE)
set(MISSION_MSGID_V2 TRUE)
Build cFS. The following warnings will be issued when compiling cfe_msg_msgid_v2.c:
[ 77%] Building C object msg/CMakeFiles/msg.dir/fsw/src/cfe_msg_msgid_v2.c.o
/home/dsa/lpnt_ws/dsa_lpnt_fsw/fsw/cFS/cfe/modules/msg/fsw/src/cfe_msg_msgid_v2.c: In function ‘CFE_MSG_GetMsgId’:
/home/dsa/lpnt_ws/dsa_lpnt_fsw/fsw/cFS/cfe/modules/msg/fsw/src/cfe_msg_msgid_v2.c:80:14: warning: implicit declaration of function ‘CFE_SB_ValueToMsgId’ [-Wimplicit-function-declaration]
80 | *MsgId = CFE_SB_ValueToMsgId(msgidval);
| ^~~~~~~~~~~~~~~~~~~
/home/dsa/lpnt_ws/dsa_lpnt_fsw/fsw/cFS/cfe/modules/msg/fsw/src/cfe_msg_msgid_v2.c: In function ‘CFE_MSG_SetMsgId’:
/home/dsa/lpnt_ws/dsa_lpnt_fsw/fsw/cFS/cfe/modules/msg/fsw/src/cfe_msg_msgid_v2.c:96:36: warning: implicit declaration of function ‘CFE_SB_MsgIdToValue’ [-Wimplicit-function-declaration]
96 | CFE_SB_MsgId_Atom_t msgidval = CFE_SB_MsgIdToValue(MsgId);
| ^~~~~~~~~~~~~~~~~~~
The following error will be reported at the link phase:
[100%] Linking C executable core-cpu1
/usr/bin/ld: ../msg/libmsg.a(cfe_msg_msgid_v2.c.o): in function
CFE_MSG_GetMsgId': cfe_msg_msgid_v2.c:(.text+0x8b): undefined reference to
CFE_SB_ValueToMsgId'/usr/bin/ld: ../msg/libmsg.a(cfe_msg_msgid_v2.c.o): in function
CFE_MSG_SetMsgId': cfe_msg_msgid_v2.c:(.text+0xd1): undefined reference to
CFE_SB_MsgIdToValue'collect2: error: ld returned 1 exit status
make[11]: *** [cpu1/CMakeFiles/core-cpu1.dir/build.make:199: cpu1/core-cpu1] Error 1
The bug occurs because the two functions are defined as 'static inline' in cfe_sb.h, which is not referenced in cfe_msg_msgid_v2.c, and because the C language prior to the C99 standard implicitly defines functions as
int fn_name(int)
. Simply adding#include "cfe_sb.h"
fixes the problem.Expected behavior
core-cpu1 should compile and link cleanly.
Code snips
See attached patch file.
msg_v2_link_error_patch.txt
System observed on:
Additional context
Reporter Info
Chuck Fry, QTS Inc., subcontractor to KBR Wyle on the ISRDS3 contract, at NASA ARC Code TI
[email protected]
The text was updated successfully, but these errors were encountered: