libctf,libsframe: remove include of config.h
Fixes duplicate config.h includes in libctf/libsframe build when building in-source.
Andrew Burgess proposes to remove the inclusion of config.h from libctf/swap.h to resolve duplicate definition warnings that occur during in-source builds of GDB. The issue arises because libsframe/config.h is included first, and then a subsequent build of libctf creates libctf/config.h, leading to conflicts. Removing the libctf/swap.h include eliminates these warnings.
- proposer
Submits a patch to remove `config.h` include from `libctf/swap.h` to fix duplicate definition warnings during in-source GDB builds.
“After investigation I discovered that this issue only occurs when building in the source tree. Here's what happens, starting from a clean source tree. From Makefile.def we see that the 'all-bfd' target depends on 'all-libsframe', and the 'configure-libctf' target depends on 'all-bfd'. The dependency chain then is: all-libsframe → all-bfd → configure-libctf This means that, when libsfra…”
In Details
This patch addresses a build issue related to header inclusion in the libctf and libsframe components, often used by GDB. During an in-source build (where the build directory is within the source tree), the build system's dependency chain can lead to a situation where libsframe/config.h is included before libctf/config.h is generated. Subsequently, when libctf/swap.h (which is included by libsframe/sframe.c) includes config.h, it can pick up libsframe/config.h again. This leads to duplicate definition warnings for macros like PACKAGE defined in libctf/config.h. The fix rem…
- config.h
- A header file typically generated by the configure script, containing definitions for macros and configurations specific to the build environment.
- libctf
- A library for handling CTF (Compact Type Format) debug information, often used by debuggers like GDB.
- libsframe
- A library related to frame unwind information, likely used by debuggers for stack trace generation.
- in-source build
- A build process where the object files and intermediate build products are placed directly within the source code directory, as opposed to an out-of-source build where a separate directory is used.
- PACKAGE
- A preprocessor macro, typically defined in a
config.hfile, that holds the name of the software package being built.