Skip to content

Comments

CMakeLists: use debuglib_null for Release builds#474

Merged
jyao1 merged 1 commit intoDMTF:mainfrom
Jino26:logging_fix
Feb 9, 2026
Merged

CMakeLists: use debuglib_null for Release builds#474
jyao1 merged 1 commit intoDMTF:mainfrom
Jino26:logging_fix

Conversation

@Jino26
Copy link
Contributor

@Jino26 Jino26 commented Feb 5, 2026

When TARGET=Release is set, debug logs such as SpdmReceiveRequest and SpdmSendResponse are still printed because the executables are hardcoded to link with debuglib. The -DLIBSPDM_DEBUG_ENABLE=0 flag only controls compile-time macros but does not switch the linked debug library implementation.

Add a SPDM_DEBUG_LIB_NAME variable in the main CMakeLists.txt that selects debuglib_null for Release builds and debuglib for Debug builds.

When TARGET=Release is set, debug logs such as SpdmReceiveRequest and
SpdmSendResponse are still printed because the executables are
hardcoded to link with debuglib. The -DLIBSPDM_DEBUG_ENABLE=0 flag
only controls compile-time macros but does not switch the linked
debug library implementation.

Add a SPDM_DEBUG_LIB_NAME variable in the main CMakeLists.txt that
selects debuglib_null for Release builds and debuglib for Debug
builds.

Signed-off-by: Jino Abraham <jinoabraham26@gmail.com>
@Jino26
Copy link
Contributor Author

Jino26 commented Feb 5, 2026

Tested with below flags:

EXTRA_OECMAKE += "\
    -DARCH=${@get_spdm_multiarch(bb, d)} \
        -DTOOLCHAIN=NONE \
        -DTARGET=Release \
        -DCRYPTO=openssl \
        -DENABLE_BINARY_BUILD=1 \
"

Output:

Before:

# spdm_responder_emu --trans TCP
spdm_responder_emu version 0.1
trans - 0x3
context_size - 0x2bf8
Platform server listening on port 4194
Platform port Receive command: 00 00 00 01
Platform port Receive transport_type: 00 00 00 03
Platform port Receive size: 00 00 00 08
Platform port Receive buffer:
    06 00 01 05 10 84 00 00
SpdmReceiveRequest[.] ...
SpdmReceiveRequest[0] msg SPDM_GET_VERSION(0x84), size (0x4):
0000: 10 84 00 00
SpdmSendResponse[0] ...
SpdmSendResponse[0]: msg SPDM_VERSION(0x4), size (0x10):
0000: 10 04 00 00 00 05 00 10 00 11 00 12 00 13 00 14
Platform port Transmit command: 00 00 00 01

After:

# spdm_responder_emu --trans TCP
spdm_responder_emu version 0.1
trans - 0x3
context_size - 0x2bf8
Platform server listening on port 4194
Platform port Receive command: 00 00 00 01
Platform port Receive transport_type: 00 00 00 03
Platform port Receive size: 00 00 00 08
Platform port Receive buffer:
    06 00 01 05 10 84 00 00
Platform port Transmit command: 00 00 00 01
Platform port Transmit transport_type: 00 00 00 03

Only spmd_responder_emu traces are printed now compared to before.

@Jino26
Copy link
Contributor Author

Jino26 commented Feb 5, 2026

Fixes #473

@jyao1 jyao1 merged commit b8b9e88 into DMTF:main Feb 9, 2026
44 checks passed
@Jino26 Jino26 deleted the logging_fix branch February 9, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spdm_responder_emu/libspdm prints verbose traces even in Release builds

2 participants