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

elfutils: 0.180 -> 0.182, fix building under musl #110405

Merged
merged 3 commits into from Feb 2, 2021

Conversation

pjjw
Copy link
Contributor

@pjjw pjjw commented Jan 21, 2021

Motivation for this change

Trying to restore runctionality to a good amount of pkgsMusl- have copied the approach Alpine uses to get elfutils working in nixpkgs. Had to add two additional packages that are there essentially just for musl packages.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

pkgs/development/tools/misc/elfutils/default.nix Outdated Show resolved Hide resolved
pkgs/development/tools/misc/elfutils/default.nix Outdated Show resolved Hide resolved
pkgs/os-specific/linux/musl-fts/default.nix Outdated Show resolved Hide resolved
pkgs/os-specific/linux/musl-fts/default.nix Outdated Show resolved Hide resolved
pkgs/os-specific/linux/musl-fts/default.nix Outdated Show resolved Hide resolved
pkgs/os-specific/linux/musl-obstack/default.nix Outdated Show resolved Hide resolved
pkgs/os-specific/linux/musl-obstack/default.nix Outdated Show resolved Hide resolved
pkgs/os-specific/linux/musl-obstack/default.nix Outdated Show resolved Hide resolved
pkgs/os-specific/linux/musl-fts/default.nix Outdated Show resolved Hide resolved
@pjjw pjjw force-pushed the musl-elfutils branch 3 times, most recently from 618fa86 to d2654de Compare January 22, 2021 01:52
@pjjw
Copy link
Contributor Author

pjjw commented Jan 22, 2021

@SuperSandro2000 ah thanks for the early review! left this one a draft b/c there was still some copypasta around but wanted to get CI on it. thanks for the formatting fixes, i'm relatively new here and don't have a firm grip on all convention.

@pjjw
Copy link
Contributor Author

pjjw commented Jan 22, 2021

@GrahamcOfBorg build pkgsMusl.elfutils

};

patches = [ ./debug-info-from-env.patch ];
patches = [ ./debug-info-from-env.patch ]
++ lib.optional stdenv.hostPlatform.isMusl ./musl-compat.patch;
Copy link
Member

Choose a reason for hiding this comment

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

Can we apply this patch all the time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could, though the patch adds extra warnings about null pointer derefs in both versions. This is just cribbed from alpine and nearly unmodified, but didn't want to introduce a warning suppress where it's not needed. I could try and work the patch and see if I can make the compiler happy, but it's an unfamilar codebase and wasn't feeling all the way up to it.

Open to any option, applying and suppressing, keeping them separate with a note to come back, or trying to tweak the patch.

Copy link
Member

Choose a reason for hiding this comment

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

The problem with applying patches conditional is that they will bit rot because no one will test them on the next update.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, so I switched around the patch stuff to just pull from alpine's git repo, and only conditionally-applying the one making up for musl's lack of error.h, which is the one that causes the null-pointer warning (again, not sure why). also applies a patch that fixes the aarch64 musl build. PTAL.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, right, well, this patch now makes the aarch64 build succeed if pkgsMusl.coreutils succeeds, which it does not right now due to a test failure i can't quite pin down.

@pjjw pjjw force-pushed the musl-elfutils branch 2 times, most recently from 2e8048b to d7c4615 Compare January 25, 2021 01:18
Copy link
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

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

Can we just fetch the commit alpinelinux/aports@2e3d497 and apply it only to the files we require? fetchpatch should be able to do that and it would be a lot cleaner I think.

pkgs/development/tools/misc/elfutils/default.nix Outdated Show resolved Hide resolved
pkgs/development/tools/misc/elfutils/default.nix Outdated Show resolved Hide resolved
pkgs/development/tools/misc/elfutils/default.nix Outdated Show resolved Hide resolved
pkgs/development/tools/misc/elfutils/default.nix Outdated Show resolved Hide resolved
pkgs/development/tools/misc/elfutils/default.nix Outdated Show resolved Hide resolved
pkgs/development/tools/misc/elfutils/default.nix Outdated Show resolved Hide resolved
pkgs/development/tools/misc/elfutils/default.nix Outdated Show resolved Hide resolved
pkgs/development/tools/misc/elfutils/default.nix Outdated Show resolved Hide resolved
pkgs/development/tools/misc/elfutils/default.nix Outdated Show resolved Hide resolved
@pjjw
Copy link
Contributor Author

pjjw commented Jan 25, 2021

not sure i understand, that's what i'm doing here, just pulling the minimum set of patches from alpine master- but the commit you refer to is also for an older ver of elfutils and has incompatible patches. the other bits I was just letting nixfmt do its thing, is that not suggested?

@SuperSandro2000
Copy link
Member

not sure i understand, that's what i'm doing here, just pulling the minimum set of patches from alpine master- but the commit you refer to is also for an older ver of elfutils and has incompatible patches

Nothing wrong with that but we can condense that to maybe one or two fetchpatches. fetchpatch supports excludes and includes which takes file paths you want to remove or which you want to keep. I couldn't find a good documentation on that so you need to take a look pkgs/build-support/fetchpatch/default.nix for more details.

the other bits I was just letting nixfmt do its thing, is that not suggested?

It takes 80 line lengths very serious and I don't like the line break style it does with url = \n **very long string**.

@pjjw
Copy link
Contributor Author

pjjw commented Jan 25, 2021

I looked at that and I still don't understand- include and exclude works per-patch- AFAICT fetchpatch still expects to be fetching a patchfile, not a git directory composed of patches

@SuperSandro2000
Copy link
Member

AFAICT fetchpatch still expects to be fetching a patchfile

Yeah, it is. I thought you are fetching a big patch in small parts instead of the entire patch at once but after taking a closer look at https://github.com/alpinelinux/aports/tree/master/main/elfutils it is clear that the patch are 7 files. Never mind then.

@pjjw
Copy link
Contributor Author

pjjw commented Jan 29, 2021

@SuperSandro2000 you still show as wanting changes. Anything in particular you're looking for from this patch to get it landed?

@SuperSandro2000
Copy link
Member

SuperSandro2000 commented Jan 30, 2021

@SuperSandro2000 you still show as wanting changes. Anything in particular you're looking for from this patch to get it landed?

GitHub just keeps my last review action and only clears it when I submit a new one. I don't know the musl infrastructure to well so I just did not merge it to not break anything.

@pjjw
Copy link
Contributor Author

pjjw commented Feb 1, 2021

@SuperSandro2000 rebased to staging- look good?

@pjjw
Copy link
Contributor Author

pjjw commented Feb 1, 2021

also, for the record, not sure why the robot rebase failed:
image

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

Successfully merging this pull request may close these issues.

None yet

3 participants