Subject: Re: [bug#31999] [PATCH 4/7] gnu: lvm2: Add device-mapper-event support.

From: Marius Bakke <[email-masked]>
Date: Thu, 12 Jul 2018 23:26:49 +0200

Pierre Neidhardt <[email-masked]> writes:

> * GNU/packages/linux.scm (lvm2)[configure-flags]: Build device-mapper-event.

[...]

> +                               "--enable-cmdlib"
> +                               "--enable-dmeventd" ; Requires '--enable-cmdlib'.

I was able to get this working by modifying LDFLAGS *and* CLDFLAGS like
so:

1 file changed, 12 insertions(+), 1 deletion(-)
gnu/packages/linux.scm | 13 ++++++++++++-

modified   gnu/packages/linux.scm
@@ -2133,11 +2133,22 @@ time.")
                                "--enable-udev_rules"
                                "--enable-pkgconfig"
 
+                               "--enable-cmdlib"
+                               "--enable-dmeventd"
+
                                ;; Make sure programs such as 'dmsetup' can
                                ;; find libdevmapper.so.
                                (string-append "LDFLAGS=-Wl,-rpath="
                                               (assoc-ref %outputs "out")
-                                              "/lib"))
+                                              "/lib,-rpath="
+                                              (assoc-ref %outputs "out")
+                                              "/lib/device-mapper")
+                               (string-append "CLDFLAGS=-Wl,-rpath="
+                                              (assoc-ref %outputs "out")
+                                              "/lib,-rpath="
+                                              (assoc-ref %outputs "out")
+                                              "/lib/device-mapper")
+                               )
 
        ;; The tests use 'mknod', which requires root access.
        #:tests? #f))

[back]

The reason CLDFLAGS is required is because the dmeventd plugins do not
respect LDFLAGS.  See "%.so" (around line 449) in make.tmpl.in.

I think it would be okay to patch the Make template to also take LDFLAGS
into account.  Not sure what CLDFLAGS is used for, but it seems
redundant to have the same contents in both.  Can you try that?