Out of the box, building GDB will also build the GNU simulator
project[1]. When building GDB with --enable-target=all, this result in
all simulators to be built, which accounts for a significant amount of
space.
This patch makes the default GDB package to not bundle sim. Sim can be
enabled using `enableSim = true`;
As a result, the default GDB install is now about 40M v.s. 650M when all
simulators are included.
[1] https://sourceware.org/gdb/wiki/Sim
with structuredAttrs lists will be bash arrays which cannot be exported
which will be a issue with some patches and some wrappers like cc-wrapper
this makes it clearer that NIX_CFLAGS_COMPILE must be a string as lists
in env cause a eval failure
Without the change gdb fails build on `readline-8.2` as:
../../gdb/completer.c: In function 'char* gdb_completion_word_break_characters_throw()':
../../gdb/completer.c:2014:10: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]
2014 | return rl_completer_word_break_characters;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| const char*
Fixes the following issue:
[host@user:/nix/pkgs]$ nix build .\#pkgsStatic.gdb
checking size of unsigned long long... CXXLD libinproctrace.so
/nix/store/gzms61swp55fg5qbvshyqv5jfsnfvybz-x86_64-unknown-linux-musl-binutils-2.38/bin/x86_64-unknown-linux-musl-ld: /nix/store/dnmh1aj0kd60qz8yl4srak8kn2bspbxc-x86_64-unknown-linux-musl-stage-final-gcc-11.3.0/lib/gcc/x86_64-unknown-linux-musl/11.3.0/crtbeginT.o: relocation R_X86_64_32 against hidden symbol `__TMC_END__' can not be used when making a shared object
/nix/store/gzms61swp55fg5qbvshyqv5jfsnfvybz-x86_64-unknown-linux-musl-binutils-2.38/bin/x86_64-unknown-linux-musl-ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:383: libinproctrace.so] Error 1
make[2]: *** Waiting for unfinished jobs....
8
checking size of unsigned long... make[2]: Leaving directory '/build/gdb-12.1/_build/gdbserver'
make[1]: *** [Makefile:11064: all-gdbserver] Error 2
as the inprocess library can only be compiled as a shared library
A few rare targets don't have clean format strings on 32-bit systems:
https://github.com/NixOS/nixpkgs/pull/171216#issuecomment-1133541978
/build/gdb-12.1/_build/sim/../../sim/cris/sim-if.c:575:28:
error: format '%lx' expects argument of type 'long unsigned int',
but argument 4 has type 'bfd_size_type' {aka 'long long unsigned int'} [-Werror=format=]
We pull in patch pending upstream inclusion.
Added trivial updater script.
Refreshed nix-specific patch with path to debug symbols.
Dropped upstreamed patches for gcc-12 support and musl support.
Changes: https://www.sourceware.org/gdb/download/ANNOUNCEMENT
* gdb: fix on musl, sys/termios.h -> termios.h
* gdb: grab upstream patch to fix w/musl
Fixes instances of PAGESIZE/PAGE_SIZE that conflict
with header-provided definitions.
I was concerned about stability (IIRC version in these can change?)
but already risking that with the gcc-12 patch, so this is probably
okay.
Stale/unstable URL's are especially important to avoid on less
commonly used combinations such as w/musl, but also don't
want to bloat the tree :).
Risk is low, as this will be included in next update.
Without the change the build fails as:
sim/cr16/interp.c: In function 'lookup_hash':
sim/cr16/interp.c:89:25: error:
the comparison will always evaluate as 'true'
for the address of 'mnimonic' will never be NULL [-Werror=address]
89 | if ((h->ops->mnimonic != NULL) &&
| ^~
This makes the targetPrefix always conform to nixpkgs' expectations
instead of relying on the autotools build system to figure it out
correctly (which is also inconsistent across versions).
See also ca9be0511b.
continuation of #109595
pkgconfig was aliased in 2018, however, it remained in
all-packages.nix due to its wide usage. This cleans
up the remaining references to pkgs.pkgsconfig and
moves the entry to aliases.nix.
python3Packages.pkgconfig remained unchanged because
it's the canonical name of the upstream package
on pypi.
The current gdb patch to support NIX_DEBUG_INFO_DIRS fails if
the user attempts to change the debug file directory to a
value other than the default. For instance:
(gdb) set debug-file-directory /run/booted-system/sw/lib/debug
results in:
munmap_chunk(): invalid pointer
Aborted (core dumped)
To fix this issue, the debug_file_directory is allocated
with xstrdup so that a subsequent call to xfree will succeed.