Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 543840 - sys-boot/grub:2 fails to compile against musl
Summary: sys-boot/grub:2 fails to compile against musl
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Hardened (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: The Gentoo Linux Hardened Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-20 03:20 UTC by Travis Tilley
Modified: 2015-08-06 19:14 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
fix compilation against musl (0001-sys-boot-grub-fix-compilation-against-musl.patch,21.91 KB, patch)
2015-03-20 03:20 UTC, Travis Tilley
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Travis Tilley 2015-03-20 03:20:10 UTC
Created attachment 399298 [details, diff]
fix compilation against musl

there are two issues preventing the stable grub from compiling against musl. thankfully, the first (relating to a funky ifdef block for if-linux-but-not-glibc that i can only assume works for uclibc and nothing else) is already solved in the unstable marked ebuild, so i used that as a base. the second issue is that musl doesn't provide an error.h header.

a patch is included against the hardened-dev musl branch. my previous bugs submitted for pciutils, efivar, and efibootmgr are required for using grub in an efi environment. i've tested building with only the pc and efi-32 targets.
Comment 1 Travis Tilley 2015-03-20 03:22:17 UTC
my fix for a missing error.h here is a bit... icky. i add a check for the header to configure.ac and if not found, do an ugly define. you might want to do code review on this, but it works and that's currently good enough for me. ;)
Comment 2 Felix Janda 2015-03-21 10:43:39 UTC
In the git repo, the error.h include has just been removed:

http://git.savannah.gnu.org/cgit/grub.git/commit/grub-core/kern/emu/misc.c?id=989af025829b20a19f4d3ee01e86f4ee9de7cf1e

It is not possible to do the same with the version you are using?


I'll send a patch for kern/emu/hostdisk.c upstream. (Some time ago
I've sent a similar patch for osdep/unix/hostdisk.c.)
Comment 3 Felix Janda 2015-03-21 11:04:31 UTC
Actually the code from kern/emu/hostdisk.c had moved to osdep/unix/hostdisk.c.
So for grub-9999 none of these patches should be necessary.
Comment 4 Mike Gilbert gentoo-dev 2015-03-21 14:05:20 UTC
I could backport 989af025829b20a19f4d3ee01e86f4ee9de7cf1e to replace grub-2.02-musl-no-error.h.patch.

It seems like you based grub-2.00_musl.patch on some much older version of grub, and that patch is now unnecessary. I already backported Felix's version of the same patch.
Comment 5 Anthony Basile gentoo-dev 2015-05-13 17:43:58 UTC
(In reply to Mike Gilbert from comment #4)
> I could backport 989af025829b20a19f4d3ee01e86f4ee9de7cf1e to replace
> grub-2.02-musl-no-error.h.patch.
> 
> It seems like you based grub-2.00_musl.patch on some much older version of
> grub, and that patch is now unnecessary. I already backported Felix's
> version of the same patch.

Mike, what version of grub has the fix?
Comment 6 Mike Gilbert gentoo-dev 2015-05-13 18:18:14 UTC
The ChangeLog says grub-2.02_beta2-r7 has a (partial?) fix.

  01 Feb 2015; Mike Gilbert <floppym@gentoo.org> +grub-2.02_beta2-r7.ebuild:
  Add patches for XFS v5 superblocks, bug 525682. Fix build on musl, bug 529356.

I don't believe I ever backported 989af025829b20a19f4d3ee01e86f4ee9de7cf1e. I can do that shortly.
Comment 7 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2015-08-06 18:59:01 UTC
has the backport been done?
Comment 8 Mike Gilbert gentoo-dev 2015-08-06 19:14:42 UTC
+  06 Aug 2015; Mike Gilbert <floppym@gentoo.org> grub-2.02_beta2-r7.ebuild:
+  Backport another build fix for musl, bug 543840.