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

binutils override withAllTargets does not work #82792

Closed
parthy opened this issue Mar 17, 2020 · 8 comments · Fixed by #168106
Closed

binutils override withAllTargets does not work #82792

parthy opened this issue Mar 17, 2020 · 8 comments · Fixed by #168106
Labels
0.kind: bug Something is broken

Comments

@parthy
Copy link
Contributor

parthy commented Mar 17, 2020

Describe the bug
I am trying to get binutils to support all targets by overriding the withAllTargets argument. But I get the following error message:

error: anonymous function at /nix/store/5w02kc6nw8xybgfy4n787ssks3a88c5i-nixpkgs-20.03pre211462.0c960262d15/nixpkgs/pkgs/build-support/fetchurl/boot.nix:5:1 called with unexpected argument 'meta', at /nix/store/5w02kc6nw8xybgfy4n787ssks3a88c5i-nixpkgs-20.03pre211462.0c960262d15/nixpkgs/pkgs/build-support/fetchpatch/default.nix:14:1
(use '--show-trace' to show detailed location information)

To Reproduce
Steps to reproduce the behavior:

  1. Create shell.nix:
{
  pkgs ? import <nixpkgs> {},
}:

pkgs.mkShell {
  nativeBuildInputs = [ (pkgs.binutils-unwrapped.override { withAllTargets = true; }) ];
}
  1. Execute nix-shell

Expected behavior
A shell environment containing binutils with all targets enabled.

Additional context
The higher-level goal is to obtain a version of objcopy that supports pe-i386 and pe-x86-64 targets. I need to copy a 32-bit PE object file to a 64-bit one. If there is a better way to accomplish this goal, I'd appreciate guidance.

Metadata
Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 4.15.0-76-generic, Ubuntu, 18.04.4 LTS (Bionic Beaver)`
 - multi-user?: `no`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.2`
 - channels(parthy): `"nixpkgs-20.03pre211462.0c960262d15"`
 - nixpkgs: `/home/parthy/.nix-defexpr/channels/nixpkgs`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
@parthy parthy added the 0.kind: bug Something is broken label Mar 17, 2020
@parthy
Copy link
Contributor Author

parthy commented Mar 17, 2020

Setting enableShared = false as well seems to be working fine. Is this expected? Then maybe the error message should somehow reflect that, if possible.

@matthewbauer
Copy link
Member

/cc @Ericson2314

@stale
Copy link

stale bot commented Oct 7, 2020

Hello, I'm a bot and I thank you in the name of the community for opening this issue.

To help our human contributors focus on the most-relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human.

The community would appreciate your effort in checking if the issue is still valid. If it isn't, please close it.

If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me". If you'd like it to get more attention, you can ask for help by searching for maintainers and people that previously touched related code and @ mention them in a comment. You can use Git blame or GitHub's web interface on the relevant files to find them.

Lastly, you can always ask for help at our Discourse Forum or at #nixos' IRC channel.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Oct 7, 2020
@Enteee
Copy link
Contributor

Enteee commented Oct 24, 2020

Maybe i am completely wrong about this, but I think since this works with enableShared = false the issue most likely comes from here.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Oct 24, 2020
@stale
Copy link

stale bot commented Jun 6, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 6, 2021
@matthuszagh
Copy link
Contributor

I'm experiencing the same issue with 7e9b0df.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Feb 1, 2022
@trofi
Copy link
Contributor

trofi commented Apr 10, 2022

Still a problem. I think the trigger is the use of fetchpatch in libbfd, but I don't understand why it matter for override.

CLI reproducer:

$ nix build  --impure --expr 'with import ./. {}; binutils-unwrapped.override { withAllTargets = true; }'
error: anonymous function at /home/slyfox/dev/git/nixpkgs-master/pkgs/build-support/fetchurl/boot.nix:5:1 called with unexpected argument 'postFetch'

       at /home/slyfox/dev/git/nixpkgs-master/pkgs/build-support/fetchpatch/default.nix:31:1:

           30| in
           31| lib.throwIfNot (excludes == [] || includes == [])
             | ^
           32|   "fetchpatch: cannot use excludes and includes simultaneously"
(use '--show-trace' to show detailed location information)

@trofi
Copy link
Contributor

trofi commented Apr 10, 2022

Proposed the fix (and a new explicit attribute) as #168106

trofi added a commit to trofi/nixpkgs that referenced this issue Apr 10, 2022
It's not exactly a new package: binutils has been exposing
`withAllTargets = true;` knob for a while.

To give it more official status let's expose it as an
`binutils-unwrapped-all-targets` attribute.

Note that `binutils-unwrapped.override { withAllTargets = true; }`
does not work due to recursive definition of binutils.

Closes: NixOS#82792
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants