Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 642988 - sys-kernel/genkernel-3.5.2.5 fails to compile dmraid: cannot find -ldevmapper
Summary: sys-kernel/genkernel-3.5.2.5 fails to compile dmraid: cannot find -ldevmapper
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords:
: 671960 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-01-01 15:16 UTC by Martin Wegner
Modified: 2019-03-21 23:51 UTC (History)
8 users (show)

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


Attachments
genkernel.log with failed dmraid build (genkernel.log,46.96 KB, text/x-log)
2018-01-01 15:18 UTC, Martin Wegner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Wegner 2018-01-01 15:16:13 UTC
After bug #631368 was fixed (from which I was affected, too), when =sys-kernel/genkernel-3.5.2.5 now compiles dmraid for the initramfs it fails with this error:

[...]
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
make[1]: *** [Makefile:71: dmraid] Error 1
make[1]: Leaving directory '/var/tmp/genkernel/10530.2766.32186.16712/dmraid/1.0.0.rc16-3/dmraid/tools'
make: *** [make.tmpl:120: tools] Error 2

Full genkernel.log is attached. Please let me know if I can provide any more information to triage this.

% emerge --info
Portage 2.3.19 (python 2.7.14-final-0, default/linux/amd64/13.0/desktop/gnome/systemd, gcc-6.4.0, glibc-2.26-r3, 4.14.7-gentoo-vidar-i7-efi x86_64)
=================================================================
System uname: Linux-4.14.7-gentoo-vidar-i7-efi-x86_64-Intel-R-_Core-TM-_i7-7700K_CPU_@_4.20GHz-with-gentoo-2.4.1
KiB Mem:    16342724 total,   1647672 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Mon, 01 Jan 2018 13:45:01 +0000
Head commit of repository gentoo: fa85d5355b3c7d3f6d25127e1b6f4ea7450a5a88
Timestamp of repository poly-c: Sat, 30 Dec 2017 23:22:48 +0000
Head commit of repository steam-overlay: 699d267a7358ca340ee684e68e5366419f8e0ded

sh bash 4.4_p12
ld GNU ld (Gentoo 2.29.1 p3) 2.29.1
ccache version 3.3.4 [disabled]
app-shells/bash:          4.4_p12::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.26.1-r1::gentoo
dev-lang/python:          2.7.14-r1::gentoo, 3.4.6-r1::gentoo, 3.5.4-r1::gentoo
dev-util/ccache:          3.3.4-r1::gentoo
dev-util/cmake:           3.10.1::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.4.1-r2::gentoo
sys-apps/sandbox:         2.12::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.11.6-r2::gentoo, 1.15.1-r1::gentoo
sys-devel/binutils:       2.29.1-r1::gentoo
sys-devel/gcc:            6.4.0::gentoo, 7.2.0::gentoo
sys-devel/gcc-config:     1.9.1::gentoo
sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r1::gentoo
sys-kernel/linux-headers: 4.14::gentoo (virtual/os-headers)
sys-libs/glibc:           2.26-r3::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.de.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-extra-opts: 

local
    location: /usr/local/portage/mittwinter
    masters: gentoo
    priority: 0

betagarden
    location: /var/lib/layman/betagarden
    masters: gentoo
    priority: 50

fkmclane
    location: /var/lib/layman/fkmclane
    sync-type: laymansync
    sync-uri: https://github.com/fkmclane/overlay.git
    masters: gentoo
    priority: 50

gnome
    location: /var/lib/layman/gnome
    masters: gentoo
    priority: 50

hacking-gentoo
    location: /var/lib/layman/hacking-gentoo
    masters: gentoo
    priority: 50

jorgicio
    location: /var/lib/layman/jorgicio
    masters: gentoo
    priority: 50

mittwinter
    location: /var/lib/layman/mittwinter
    masters: gentoo
    priority: 50

mozilla
    location: /var/lib/layman/mozilla
    masters: gentoo
    priority: 50

poly-c
    location: /var/lib/layman/poly-c
    masters: gentoo
    priority: 50

steam-overlay
    location: /usr/local/portage/steam-overlay
    sync-type: git
    sync-uri: https://github.com/anyc/steam-overlay.git
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/chromium/policies/managed/chrome-gnome-shell.json /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/opt/chrome/policies/managed/chrome-gnome-shell.json /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS=" --alert y --verbose-conflicts --changed-deps y --changed-use --complete-graph y --with-bdeps y --autounmask n --deep --backtrack=1000 --keep-going y"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs clean-logs config-protect-if-modified distlocks ebuild-locks fakeroot fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-backup unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync webrsync-gpg xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS=" 	ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo 	ftp://mirror.netcologne.de/gentoo/ 	"
LANG="C"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j6 -l6"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac acl acpi aes alsa amd64 amr avahi avx avx2 berkdb bluetooth bluray branding bzip2 cairo cdda cdr cli colord cracklib crypt cryptsetup cups cxx dbus device-mapper dirac divx dri dts dvb dvd dvdr eds emboss encode exif f16c faac faad fam fat ffmpeg firefox flac fma3 fuse gdbm gif glamor gnome gnome-keyring gnome-online-accounts gstreamer gtk gtk3 iconv icu idn imagemagick inotify introspection ipv6 jpeg lame lastfm lcms libnotify libsecret lvm lz4 lzma lzo mad mmx mmxext mng modules mp3 mp4 mpeg mtp multilib nautilus ncurses networkmanager nls nptl nvenc nvidia offensive ogg opengl openmp opus pam pango pcre pcsc-lite pdf png policykit popcnt ppds pulseaudio qt3support qt5 readline realmedia samba schroedinger sdl seccomp sendto session smartcard spell sse sse2 sse3 sse4_1 sse4_2 ssl ssse3 startup-notification svg syslog systemd tcpd telepathy theora tiff tracker truetype udev udisks unicode upower usb v4l v4l2 vdpau vim-syntax vorbis vpx webm wifi wmp wxwidgets x264 x265 xattr xcb xinerama xml xv xvid xz zeroconf zlib zsh-completion" ABI_X86="64 32" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" CURL_SSL="openssl" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64 pc" INPUT_DEVICES="evdev keyboard mouse" KERNEL="linux" L10N="en de" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en de" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5" QEMU_SOFTMMU_TARGETS="x86_64 i386" RUBY_TARGETS="ruby21 ruby23 ruby24 ruby25" USERLAND="GNU" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Martin Wegner 2018-01-01 15:18:59 UTC
Created attachment 512628 [details]
genkernel.log with failed dmraid build

(Re-attached, initial attachment was rejected due to size limit.)
Comment 2 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2018-01-05 22:22:27 UTC
Do you have lvm2 installed? You should have /lib64/libdevmapper.so* on your system.
Comment 3 Martin Wegner 2018-01-05 22:34:48 UTC
(In reply to Robin Johnson from comment #2)
> Do you have lvm2 installed? You should have /lib64/libdevmapper.so* on your
> system.

Yes, lvm2 is installed:
[ebuild   R    ] sys-fs/lvm2-2.02.166-r2::gentoo  USE="readline systemd thin udev -clvm -cman -corosync -device-mapper-only -lvm1 -lvm2create_initrd -openais -sanlock (-selinux) (-static) (-static-libs)" 0 KiB

And lib is also there:
-r-xr-xr-x 1 root root 409K  2. Sep 23:30 /lib64/libdevmapper.so.1.02

Maybe type of the lib is somehow off so that the linker ignores it?
$ file /lib64/libdevmapper.so.1.02
/lib64/libdevmapper.so.1.02: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, stripped
Comment 4 Volker Wegert 2018-07-16 17:45:22 UTC
I am seeing the same error on my amd64 system since about two weeks ago - if there is any additional information I can provide to resolve the issue, please let me know.
Comment 5 orionbelt2 2018-07-17 10:16:45 UTC
I am experiencing the same problem here with sys-kernel/genkernel-3.5.3.3 .

Copying information from https://forums.gentoo.org/viewtopic-p-8240238.html :

I invoke genkernel this way:

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 compiles in 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 

Thanks.
Comment 6 Ben Kohler gentoo-dev 2018-07-26 15:45:58 UTC
(In reply to Robin Johnson from comment #2)
> Do you have lvm2 installed? You should have /lib64/libdevmapper.so* on your
> system.

If the system lvm2 is used here, and gk is trying to build a static dmraid, doesn't the system lvm2 need USE=static-libs on?  That seems to help the build o further, then I hit another failure due to bug 644094.
Comment 7 Ian Stakenvicius (RETIRED) gentoo-dev 2018-07-26 18:52:30 UTC
(In reply to Ben Kohler from comment #6)
> (In reply to Robin Johnson from comment #2)
> > Do you have lvm2 installed? You should have /lib64/libdevmapper.so* on your
> > system.
> 
> If the system lvm2 is used here, and gk is trying to build a static dmraid,
> doesn't the system lvm2 need USE=static-libs on?  That seems to help the
> build o further, then I hit another failure due to bug 644094.

If the system lvm2 is used, likely the system dmraid should be used too no?
Comment 8 Volker Wegert 2018-08-20 05:45:39 UTC
Is there any progress on this issue - can I do anything from my end to get this resolved? 

FWIW, I tried adding USE=static-libs on lvm2, which for some reason caused a request for eudev, which I don't use at the moment. Frankly, I don't understand what has changed in a way that broke the process that - at least from my POV - used to wok just fine...
Comment 9 Volker Wegert 2018-09-08 13:28:24 UTC
Seeing that this issue has been assigned to genkernel maintainers in January and it's September now without any visible progress... Is genkernel essentially unmaintained now?
Comment 10 Ben Kohler gentoo-dev 2018-09-08 16:01:13 UTC
Dmraid support appears to be, please attach a patch with a fix
Comment 11 Vieri 2018-11-26 18:29:20 UTC
(In reply to Ben Kohler from comment #10)
> Dmraid support appears to be, please attach a patch with a fix

If that's the case then genkernel should say so, and at least warn the user that using --dmraid is liable to compilation/linking issues.
Comment 12 Thomas Deutschmann (RETIRED) gentoo-dev 2019-03-21 03:52:51 UTC
This one is complicated.

It's easy to fix the reported issue, i.e. to help dmraid to find "-ldevmapper".
But this will only uncover the real problem: It won't find "-ldevmapper-event".

That's because since https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=b5719a7a45673faada9502bba39c5e9af9e16a30 we are building lvm2 without dmeventd but this is required to get libdevmapper-event.

Like the comment says, it was disabled because of the build failure

> libdm-string.c:(.text+0x1481): undefined reference to `nearbyintl'

There shouldn't be a build failure -- "-lm" is set. From my understanding linking is failing because "-lm" will be set at the wrong position (too early).

Long story short: We have to upgrade lvm2. Current LVM2.2.02.183 we have in repository is a good candidate. However, this will also require libaio.

I have a working PoC. Now I need to get this into genkernel.
Comment 13 orionbelt2 2019-03-21 12:14:56 UTC
Dear Thomas,

Thank you for the sensible and informative comment.

While waiting for the fix, may i ask whether someone could help with the following slightly off-topic question: Is it necessary to add --dmraid to the genkernel argument list if the --mdadm and --mdadm-config arguments are already present?

My understanding is that DMRAID does automatic RAID device discovery, so if the file pointed to by --mdadm-config already includes the device information, --dmraid should not be necessary. This could be a workaround while this bug is being worked on, or even a satisfactory solution, at least for simple RAID setups where the configuration is known at boot time.
Comment 14 Thomas Deutschmann (RETIRED) gentoo-dev 2019-03-21 14:09:15 UTC
Most people don't need "--dmraid" these days: You only need dmraid when you are using 'fake' raid provided by some cheap onboard RAID controller aka SoHo, ATARAID, firmware/driver RAID or HostRAID named. Incomplete list of known 'RAID providers' requiring dmraid:

Highpoint HPT37X/HPT45X
Intel Software RAID
LSI Logic MegaRAID
NVidia NForce RAID (nvraid)
Promise FastTrack
Silicon Image(tm) Medley(tm)
VIA Software RAID

When you use mdraid you only need "--mdadm" option in genkernel for your RAID (aside kernel support).

And of course, when you are using real hardware RAID, you don't need any RAID support in genkernel at all, you only need the controller's kernel module.


PS: While "AMD RAID" in recent Ryzen boards is also an example for "fake raid", it requires an own kernel module like if you have a real hardware controller. No dmraid option is needed.
Comment 15 Thomas Deutschmann (RETIRED) gentoo-dev 2019-03-21 20:53:33 UTC
*** Bug 671960 has been marked as a duplicate of this bug. ***
Comment 16 Larry the Git Cow gentoo-dev 2019-03-21 23:51:16 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=d29d35d22c47eed852d95cd7ea5b313d1c51929d

commit d29d35d22c47eed852d95cd7ea5b313d1c51929d
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2019-03-21 20:50:46 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2019-03-21 20:50:46 +0000

    Fix compilation of dmraid
    
    Fixes: https://bugs.gentoo.org/642988
    Fixes: https://bugs.gentoo.org/644094
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 gen_compile.sh                                     | 23 +++++++++++-----------
 .../dmraid-1.0.0.rc16-3-staticlink.patch           |  0
 .../dmraid-1.0.0_rc16-parallel-make.patch          | 11 +++++++++++
 .../dmraid-1.0.0_rc16-return-all-sets.patch        |  0
 .../dmraid-1.0.0_rc16-static-build-fixes.patch     |  0
 .../dmraid-1.0.0_rc16-undo-p-rename.patch          |  0
 patches/dmraid/dmraid-1.0.0_rc16-as-needed2.patch  | 11 -----------
 7 files changed, 23 insertions(+), 22 deletions(-)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=4c92b79d16789bfeddb02dcf7834111ca187359c

commit 4c92b79d16789bfeddb02dcf7834111ca187359c
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2019-03-21 20:43:38 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2019-03-21 20:43:38 +0000

    Bump LVM2 to v2.02.183
    
    Bug: https://bugs.gentoo.org/642988
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 gen_compile.sh                                     |  21 +++--
 .../lvm2-2.02.139-dynamic-static-ldflags.patch     |  63 -------------
 .../lvm/2.02.183/lvm2-001-example.conf.in.patch    |  50 ++++++++++
 .../lvm2-002-always-make-static-libdm.patch        |  42 +++++++++
 .../lvm/2.02.183/lvm2-003-lvm2create_initrd.patch  |  72 +++++++++++++++
 patches/lvm/2.02.183/lvm2-004-createinitrd.patch   |  18 ++++
 patches/lvm/2.02.183/lvm2-005-locale-muck.patch    |  11 +++
 patches/lvm/2.02.183/lvm2-006-asneeded.patch       |  15 +++
 .../2.02.183/lvm2-007-dynamic-static-ldflags.patch |  59 ++++++++++++
 .../2.02.183/lvm2-008-static-pkgconfig-libs.patch  | 102 +++++++++++++++++++++
 .../lvm/2.02.183/lvm2-009-pthread-pkgconfig.patch  |  29 ++++++
 patches/lvm/2.02.183/lvm2-010-static-libm.patch    |  13 +++
 .../lvm/2.02.183/lvm2-011-HPPA-no-O_DIRECT.patch   |  12 +++
 13 files changed, 437 insertions(+), 70 deletions(-)