Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 830485 - sys-fs/mdadm-4.2[static] cannot build against sys-fs/udev
Summary: sys-fs/mdadm-4.2[static] cannot build against sys-fs/udev
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-03 05:00 UTC by Hank Leininger
Modified: 2023-09-12 13:39 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hank Leininger 2022-01-03 05:00:03 UTC
Trying to build USE=static sys-fs/mdadm fails when a recent sys-fs/udev is installed because sys-fs/udev no longer provides a libudev.a:

...
/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.1/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -ludev
...
collect2: error: ld returned 1 exit status
make: *** [Makefile:196: mdadm] Error 1

Static libudev.a was removed from sys-fs/udev a few months ago, and static+udev USE flag combination removed from various udev consumer packages here: https://github.com/gentoo/gentoo/pull/22217

...But mdadm was missed in the mass cleanup, probably because mdadm never declared a dependency on udev.

sys-fs/eudev does still have a static-libs USE flag, but mdadm static linking against eudev's libudev.a currently fails (but that's another story).

Currently the only way to get a static mdadm is to build without udev support at all, except that the mdadm ebuild lacks a knob for that (see https://bugs.gentoo.org/830461)
Comment 1 Hank Leininger 2022-01-03 05:26:32 UTC
(In reply to Hank Leininger from comment #0)

> sys-fs/eudev does still have a static-libs USE flag, but mdadm static
> linking against eudev's libudev.a currently fails (but that's another story).

Turns out to be a related story...

eudev (and udev) has a function called in_initrd. So does mdadm, but with a different function prototype. When trying to build mdadm linked statically against eudev's libudev.a, it fails with:

/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.1/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.1/../../../../lib64/libudev.a(util.o): in function `in_initrd':
util.c:(.text+0x2e80): multiple definition of `in_initrd'; util.o:util.c:(.text+0x4850): first defined here

Workaround is to rename mdadm's copy. It doesn't install a library so I don't think anything will notice or care about the rename.
Comment 2 Larry the Git Cow gentoo-dev 2022-01-03 07:41:48 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=83c7cf6db1a8db6ef050c0d31cd06e2c7d25d252

commit 83c7cf6db1a8db6ef050c0d31cd06e2c7d25d252
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-01-03 06:41:04 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-01-03 07:41:20 +0000

    sys-fs/mdadm: various build fixes
    
    - Fix udev automagic dependency (add USE=udev);
    
    - ... and fix building without udev too.
    
    - Add patch to fix static linking against udev (only option is
      sys-fs/eudev though, as we dropped static-libs from sys-fs/udev
      and sys-apps/systemd due to issues like this and upstream not
      supporting it).
    
    Thanks-to: Hank Leininger <hlein@korelogic.com> (static linking patch)
    Thanks-to: Krzysztof Olędzki <ole+gentoo@ans.pl> (udev report/fix)
    Closes: https://bugs.gentoo.org/830461
    Closes: https://bugs.gentoo.org/830485
    Signed-off-by: Sam James <sam@gentoo.org>

 .../files/mdadm-4.2-in_initrd-collision.patch      |  36 +++++++
 sys-fs/mdadm/mdadm-4.2-r1.ebuild                   | 105 +++++++++++++++++++++
 2 files changed, 141 insertions(+)
Comment 3 Larry the Git Cow gentoo-dev 2022-01-03 07:48:51 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=81a13f851b7502d547ff8c0434bf64a443877fb1

commit 81a13f851b7502d547ff8c0434bf64a443877fb1
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-01-03 07:45:55 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-01-03 07:48:41 +0000

    sys-fs/mdadm: add REQUIRED_USE for systemd/udev/static
    
    Bug: https://bugs.gentoo.org/830485
    Signed-off-by: Sam James <sam@gentoo.org>

 profiles/targets/systemd/package.use.force | 5 +++++
 sys-fs/mdadm/mdadm-4.2-r1.ebuild           | 9 +++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)
Comment 4 Larry the Git Cow gentoo-dev 2023-09-11 15:35:11 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d46677fd864b30315423c8364ca44db2de98e2a1

commit d46677fd864b30315423c8364ca44db2de98e2a1
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2023-09-11 15:31:33 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2023-09-11 15:34:30 +0000

    sys-fs/mdadm: clean up udev/static logic
    
    Since eudev has been masked for removal, drop the related logic.
    
    Bug: https://bugs.gentoo.org/830485
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 sys-fs/mdadm/{mdadm-4.2-r1.ebuild => mdadm-4.2-r2.ebuild} | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)