# genkernel fails to find -ldevmapper

## vwegert

Hello,

my "usual" kernel update procedure that has reliably worked for the past years suddenly failed with the following error messages from genkernel:

```
...

gcc -o dmraid dmraid.o commands.o toollib.o -Wl,--no-as-needed -static -L../lib -ldmraid -ldevmapper -lm -lrt -lpthread

/usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -ldevmapper

collect2: error: ld returned 1 exit status
```

As far as I understand, the devmapper library comes with the lvm2 package, and that is definitely installed. I re-merged it just to be safe, but that did not help. What might be going (wr)on(g) here?

Thanks

  Volker

----------

## orionbelt

I am having the exact same problem. It happens when invoking genkernel like this:

```
genkernel --dmraid --mdadm --mdadm-config=/etc/mdadm.conf --menuconfig --save-config --install --mountboot --bootloader=grub2 all
```

kernel-genkernel-x86_64-4.14.52-gentoo and System.map-genkernel-x86_64-4.14.52-gentoo are created successfully, and the bug occurs when genkernel wants to add dmraid support:

```
* DMRAID: Adding support (compiling binaries)...

* lvm: >> Patching ...

* lvm: >> Applying patches...

patching file configure.in

Hunk #1 succeeded at 32 (offset 1 line).

Hunk #2 succeeded at 2129 (offset 119 lines).

patching file daemons/dmeventd/Makefile.in

Hunk #1 succeeded at 66 (offset -1 lines).

patching file make.tmpl.in

Hunk #1 succeeded at 58 (offset 9 lines).

patching file tools/Makefile.in

Hunk #1 succeeded at 133 (offset 4 lines).

Hunk #2 succeeded at 160 (offset 14 lines).

*           - lvm2-2.02.139-dynamic-static-ldflags.patch

* lvm: >> Autoconf ...

* lvm: >> Configuring...

* lvm: >> Compiling...

* lvm: >> Installing to DESTDIR...

*       >> Copying to bincache...

* dmraid: >> No patches found in /usr/share/genkernel/patches/dmraid/1.0.0.rc16-3 ...

* dmraid: >> Configuring...

* dmraid: >> Compiling...

* ERROR: Failed to compile the "" target...

```

The devmapper library is installed, and the library path seems quite standard:

```
# equery f lvm2 | grep devmapper.so

/lib64/libdevmapper.so.1.02

/usr/lib64/libdevmapper.so

# ls -l /lib64/libdevmapper.so.1.02 /usr/lib64/libdevmapper.so

-r-xr-xr-x 1 root root 373992 Jul 12 15:45 /lib64/libdevmapper.so.1.02

lrwxrwxrwx 1 root root     32 Jul 12 15:45 /usr/lib64/libdevmapper.so -> ../../lib64/libdevmapper.so.1.02

```

Also, when the fix is found, is there a way to make genkernel compile just the dmraid part instead of waiting 50 minutes to recompile everything on my aging system?

----------

## orionbelt

There is apparently a quite old bug report for this.

----------

## idefix6

I had the same problem. Remove 

```
--dmraid
```

 that fixed it for me.

----------

## orionbelt

 *idefix6 wrote:*   

> I had the same problem. Remove 
> 
> ```
> --dmraid
> ```
> ...

 

Do you have a RAID system? Does it still boot?    :Smile: 

----------

## HePeR

For those who care:

Bug has been fixed by commit on GitHub somewhere in march 2019. 

Installing genkernel-9999 solved the compile error. 

For some reason dmraids devicenames changes with the new version.... A bit of a pain but better then nothing

----------

## orionbelt

May I also point out, for those who may not be aware of it, that most people probably do not need "--dmraid" these days.

----------

