Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcc/common: add disableGdbPlugin option #216237

Merged
merged 1 commit into from Feb 23, 2023
Merged

gcc/common: add disableGdbPlugin option #216237

merged 1 commit into from Feb 23, 2023

Conversation

ghost
Copy link

@ghost ghost commented Feb 13, 2023

Description of changes

gcc/common: add disableGdbPlugin option

This commit adds an option disableGdbPlugin which controls whether
or not the plugin for GDB, which contains a copy of gcc, will be
built.

The configure flag that this option controls is called
--disable-libcc1. This is slightly confusing, because its is used
only by GDB (and apparently unmaintained), yet its name does not
mention GDB. This is why the option name is different from the
configure flag name.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.05 Release Notes (or backporting 22.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Copy link
Contributor

@trofi trofi left a comment

Choose a reason for hiding this comment

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

LGTM. Can you add a single sentence for commit description where it could be useful?

pkgs/development/compilers/gcc/common/configure-flags.nix Outdated Show resolved Hide resolved
@ghost ghost requested review from trofi and removed request for matthewbauer, Ericson2314, vcunat and Synthetica9 February 21, 2023 06:25
@ghost
Copy link
Author

ghost commented Feb 21, 2023

LGTM. Can you add a single sentence for commit description where it could be useful?

Sorry about that, fixed now.

@ghost ghost marked this pull request as draft February 21, 2023 06:27
@ofborg ofborg bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Feb 21, 2023
@ghost ghost changed the title gcc/common: add enableGdbPlugin option gcc/common: add disableGdbPlugin option Feb 21, 2023
@ghost ghost marked this pull request as ready for review February 21, 2023 07:08
@ofborg ofborg bot removed 2.status: merge conflict This PR has merge conflicts with the target branch 10.rebuild-linux-stdenv This PR causes stdenv to rebuild labels Feb 21, 2023
Copy link
Contributor

@trofi trofi left a comment

Choose a reason for hiding this comment

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

Apart from one flag inversion the change looks good.

Can you add a 1-sentence Why motivation description as well? A few reasons I could make up are:

  • cut down on build times (does it save a lot?)
  • does the default value cause some other problems during bootstrap? (which? extra depends? something probes it? some c++-specific failures?)
  • just a handy switch to flip to debug some gcc aspect?
  • something else?

pkgs/development/compilers/gcc/11/default.nix Outdated Show resolved Hide resolved
pkgs/development/compilers/gcc/common/configure-flags.nix Outdated Show resolved Hide resolved
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux and removed 10.rebuild-darwin: 11-100 10.rebuild-linux: 11-100 labels Feb 22, 2023
@ghost
Copy link
Author

ghost commented Feb 22, 2023

Squashed, with a more detailed commmit message explaining the motivation.

This raises the question of whether or not the behavior which causes us to need --disable-libcc1 is a bug that should be fixed upstream. I'm leaning pretty strongly towards "no". The "bootstrap-files reference leak phenomenon" is something that is pretty nixpkgs-specific; it's likely that upstream's reaction would be "NOTABUG" since this kind of thing doesn't matter to FHS distributions (or almost anything besides nixpkgs and guix).

Also, since libcc1 is considered unmaintained there would have to be a decision about whether the benefit of a fix upstream is worth the risk of breaking things that nobody is particularly motivated to fix.

@ghost ghost requested review from trofi and removed request for Synthetica9, Ericson2314 and vcunat February 22, 2023 06:48
Copy link
Contributor

@trofi trofi left a comment

Choose a reason for hiding this comment

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

Ah, early linking of libstdc++ makes sense. Yeah, disabling it early if needed is the simplest.

Generally, I saw the --with-stage1-libs= flag that might allow a similar kind of tweaking. But it's probably more fragile as it needs an exhaustive (AFAIU) list of libraries upfront.

@@ -26,6 +27,7 @@
, disableBootstrap ? stdenv.targetPlatform != stdenv.hostPlatform
}:

assert disableGdbPlugin -> enablePlugin;
Copy link
Contributor

Choose a reason for hiding this comment

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

Worth removing added assert? It should be fine to disable both.

Copy link
Author

Choose a reason for hiding this comment

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

Dammit, that should be !enablePlugin. Thank you for noticing.

Copy link
Author

Choose a reason for hiding this comment

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

Dammit, that should be !enablePlugin. Thank you for noticing.

This commit adds an option `disableGdbPlugin` which controls whether
or not the plugin *for* GDB will be built.  This plugin contains a
copy of `gcc`.

The configure flag that this option controls is called
`--disable-libcc1`.  This flag name is slightly confusing: it is
used only by GDB (and apparently unmaintained), yet the flag name
does not mention GDB.  This is why the option name is different from
the configure flag name.

The primary motivation for this commit is to allow the following PR
(which is not yet merged) to pass `--disable-libcc1` when building
the final native (build=host=target) compiler as part of the stdenv
bootstrap:

  #209870

We need to `--disable-libcc1` in this scenario because gcc's build
machinery links `libcc1` against the `libstdc++` that is part of the
*compiler used to compile gcc*, rather than against the `libstdc++`
that is built *by* gcc.  In an FHS distribution this distinction is
not terribly important because dynamically linked libraries are
late-bound (ld.so resolution).  However in nixpkgs this causes a
reference back to the bootstrapFiles to leak all the way through to
the final stdenv.

More details can be found in the comment in
`pkgs/stdenv/linux/default.nix` of the PR linked above.

Co-authored-by: Sandro <[email protected]>
@ghost ghost requested review from trofi and SuperSandro2000 and removed request for trofi and SuperSandro2000 February 23, 2023 03:37
@trofi trofi merged commit 6812dd9 into NixOS:staging Feb 23, 2023
@ghost ghost deleted the pr/gcc/enableGdbPlugin branch February 24, 2023 06:54
@ghost
Copy link
Author

ghost commented Feb 24, 2023

Dammit, I messed this up again:

@trofi
Copy link
Contributor

trofi commented Sep 30, 2024

Caused #342904

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants