Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 830461 - sys-fs/mdadm-4.2 fails on non-udev systems: Monitor.c:33:10: fatal error: libudev.h: No such file or directory (PATCH)
Summary: sys-fs/mdadm-4.2 fails on non-udev systems: Monitor.c:33:10: fatal error: lib...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal major
Assignee: Gentoo's Team for Core System packages
URL: https://git.kernel.org/pub/scm/utils/...
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2022-01-02 18:35 UTC by Krzysztof Olędzki
Modified: 2022-01-03 07:41 UTC (History)
3 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 Krzysztof Olędzki 2022-01-02 18:35:11 UTC
On one of my systems, where I don't use udev, emerge of sys-fs/mdadm-4.2 failed with:

x86_64-pc-linux-gnu-gcc -Wall -march=ivybridge -O2 -pipe -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -DMAP_DIR=\"/run/mdadm\" -DMAP_FILE=\"map\" -DMDMON_DIR=\"/run/mdadm\" -DFAILED_SLOTS_DIR=\"/run/mdadm/failed-slots\" -DNO_COROSYNC -DNO_DLM    -DUSE_PTHREADS -DBINDIR=\"/sbin\"  -o dlink.o -c dlink.c
Monitor.c:33:10: fatal error: libudev.h: No such file or directory
   33 | #include <libudev.h>
      |          ^~~~~~~~~~~
compilation terminated.

Based on https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/commit/?id=af3396dadfcd3b13480d021b8d3645c6d2420f79, this can be fixed with -DNO_LIBUDEV

With this fix, sys-fs/mdadm-4.2 compiles for me:

--- mdadm-4.2.ebuild	2022-01-01 07:39:53.000000000 -0800
+++ mdadm-4.2.ebuild	2022-01-02 10:26:01.056345710 -0800
@@ -14,11 +14,12 @@
 SLOT="0"
 [[ "${PV}" = *_rc* ]] || \
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
-IUSE="static"
+IUSE="static +udev"
 
 BDEPEND="virtual/pkgconfig
 	app-arch/xz-utils"
-RDEPEND=">=sys-apps/util-linux-2.16"
+RDEPEND=">=sys-apps/util-linux-2.16
+	udev? ( virtual/libudev )"
 DEPEND="${RDEPEND}"
 
 # The tests edit values in /proc and run tests on software raid devices.
@@ -51,6 +52,7 @@
 
 src_compile() {
 	use static && append-ldflags -static
+	use udev || append-cflags -DNO_LIBUDEV
 	mdadm_emake all
 }
Comment 1 Larry the Git Cow gentoo-dev 2022-01-03 07:41:50 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(+)