Skip to content

Conversation

@stephanosio
Copy link
Member

@stephanosio stephanosio commented Jul 22, 2025

Add back the patches from zephyr-crosstool-ng-1.25.0 that were missed while porting to crosstool-ng 1.27.0.

In particular, "gdb: Add CT_GDB_CROSS_STATIC_LIBSTDCXX configuration" is absolutely critical in making the GDB executable self-contained on all host systems and usable on Windows.

Also note that the "gdb: Refactor cross GDB build step" patch initially ported by Anas is reverted because it messed up the file indentation by mixing spaces and tabs -- I have done another iteration of this with the correct indentation in this series.

"cross-gdb: Add LZMA support configuration " and "cross-gdb: Add Guile scripting support configuration" are ported as well because they are still relevant and useful. These will be eventually upstreamed.


Fixes zephyrproject-rtos/sdk-ng#972

This reverts commit 35934f2 because it
was ported with screwed up indentation ...

Signed-off-by: Stephanos Ioannidis <[email protected]>
This reverts commit e20c3fe because it
was ported with screwed up indentation ...

Signed-off-by: Stephanos Ioannidis <[email protected]>
This commit adds a new configuration `CT_GDB_CROSS_STATIC_LIBSTDCXX`,
which enables static linking of libstdc++ and libgcc for the cross-gdb
running on the host.

This configuration is enabled by default because using shared "standard
libraries" can often cause compatibility problems when distributing
toolchain binaries and it is therefore highly desirable to always
static-link them.

Note that this behaviour aligns with other similar symbols such as
`CT_CC_GCC_STATIC_LIBSTDCXX` and `CT_GDB_NATIVE_STATIC_LIBSTDCXX`.

For macOS, GDB is built using the Clang compiler, which is the default
compiler for the macOS hosts, and `libstdc++` and `libgcc` are not
applicable for obvious reasons.

Since macOS provides a fairly well known and controlled execution
environment, there is little point in static linking the C++ runtime
library.

Signed-off-by: Stephanos Ioannidis <[email protected]>
This commit moves the cross GDB build step out to a separate function
so that it can be invoked more than once.

When porting this patch in the future, run `git diff --histogram` to
more clearly see what this commit does.

Signed-off-by: Stephanos Ioannidis <[email protected]>
This commit adds an option to build an additional gdb variant (gdb-py)
that supports Python scripting.

When this option is enabled, the default gdb variant (gdb) does not
link against libpython; instead, an additional Python-capable gdb
variant executable (gdb-py) that links against libpython is built.

Signed-off-by: Stephanos Ioannidis <[email protected]>
This commit adds a new configuration for enabling the LZMA compression
support through the liblzma, which is required by the GDB's "mini
debuginfo" feature.

Note that this configuration is not enabled by default because it is a
niche feature and requires the liblzma, which is currently not built by
the crosstool-ng for the host (gdb also keeps this feature disabled by
default unless liblzma is available for the host).

Signed-off-by: Stephanos Ioannidis <[email protected]>
This commit adds a new configuration for enabling the GNU Guile
scripting support through the libguile.

Note that this configuration is not enabled by default because it is a
niche feature and requires the libguile, which is currently not built
by the crosstool-ng for the host (gdb also keeps this feature disabled
by default unless libguile is available for the host).

Signed-off-by: Stephanos Ioannidis <[email protected]>
Copy link
Member Author

@stephanosio stephanosio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

SDK 0.18.0-alpha4 GDB links against shared libgcc and libstdc++

2 participants