Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 566632 - sys-boot/grub-2.02_beta2-r7 - USE=static causes x86_64-pc-linux-gnu/bin/ld: cannot find -ldevmapper
Summary: sys-boot/grub-2.02_beta2-r7 - USE=static causes x86_64-pc-linux-gnu/bin/ld: c...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Mike Gilbert
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-23 15:35 UTC by Martin Mokrejš
Modified: 2019-07-08 23:36 UTC (History)
1 user (show)

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


Attachments
build.log (build.log,760.77 KB, text/x-log)
2015-11-23 15:35 UTC, Martin Mokrejš
Details
build.log (USE=static) (build.log,768.16 KB, text/plain)
2015-11-23 18:10 UTC, Martin Mokrejš
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Mokrejš 2015-11-23 15:35:36 UTC
Created attachment 417668 [details]
build.log

First of all, I have /sbin/grub which for some reason is 0.97 version. Maybe a remnant from grub-static package?


Anyway, I have dynamically linked grub2 and wanted a static version, hoping it will overwrite the /sbin/grub binary. Portage suggested these to be added to package.use:

# required by sys-boot/grub-2.02_beta2-r7::gentoo[truetype,static]
# required by grub (argument)
>=media-libs/freetype-2.6.1-r1 static-libs
# required by sys-boot/grub-2.02_beta2-r7::gentoo[truetype,static]
# required by grub (argument)
>=sys-libs/zlib-1.2.8-r1 static-libs
# required by sys-boot/grub-2.02_beta2-r7::gentoo[truetype,static]
# required by grub (argument)
>=app-arch/bzip2-1.0.6-r7 static-libs
# required by sys-boot/grub-2.02_beta2-r7::gentoo[static]
# required by grub (argument)
>=app-arch/xz-utils-5.2.2 static-libs



After that, compiling started ... but I cannot link.

x86_64-pc-linux-gnu-gcc -O2 -pipe -maes -mpclmul -mpopcnt -mavx -march=native -Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value  -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wcast-align  -Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2 -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion   -Wl,-O1 -Wl,--as-needed -static    -o grub-mkrelpath util/grub_mkrelpath-grub-mkrelpath.o grub-core/kern/emu/grub_mkrelpath-argp_common.o grub-core/osdep/grub_mkrelpath-init.o  libgrubmods.a libgrubgcry.a libgrubkern.a grub-core/gnulib/libgnu.a  -ldevmapper      
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -ldevmapper
collect2: error: ld returned 1 exit status
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -ldevmapper
collect2: error: ld returned 1 exit status
Makefile:5202: recipe for target 'grub-mkrelpath' failed
make[2]: *** [grub-mkrelpath] Error 1
make[2]: *** Waiting for unfinished jobs....
Makefile:5113: recipe for target 'grub-mkimage' failed
make[2]: *** [grub-mkimage] Error 1
make[2]: Leaving directory '/var/tmp/portage/sys-boot/grub-2.02_beta2-r7/work/grub-2.02~beta2-guessed'
Makefile:11542: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/var/tmp/portage/sys-boot/grub-2.02_beta2-r7/work/grub-2.02~beta2-guessed'
Makefile:3938: recipe for target 'all' failed
make: *** [all] Error 2
 * ERROR: sys-boot/grub-2.02_beta2-r7::gentoo failed (compile phase):
 *   emake failed
Comment 1 Martin Mokrejš 2015-11-23 15:36:33 UTC
# emerge --info 
Portage 2.2.18 (python 2.7.10-final-0, default/linux/amd64/13.0, gcc-4.9.3, glibc-2.21-r1, 4.3.0-default-pciehp x86_64)
=================================================================
System uname: Linux-4.3.0-default-pciehp-x86_64-Intel-R-_Core-TM-_i7-2640M_CPU_@_2.80GHz-with-gentoo-2.2
KiB Mem:    16361252 total,  13951904 free
KiB Swap:   16776188 total,  16776188 free
Timestamp of repository gentoo: Mon, 23 Nov 2015 12:30:01 +0000
sh bash 4.3_p42
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
app-shells/bash:          4.3_p42::gentoo
dev-java/java-config:     2.2.0::gentoo
dev-lang/perl:            5.20.2-r1::gentoo
dev-lang/python:          2.7.10::gentoo, 3.4.3::gentoo
dev-util/cmake:           3.3.2-r1::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.18.3::gentoo
sys-apps/sandbox:         2.6-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r1::gentoo
sys-devel/automake:       1.11.6-r1::gentoo, 1.12.6::gentoo, 1.13.4::gentoo, 1.14::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.3.6-r1::gentoo, 4.4.7::gentoo, 4.6.4::gentoo, 4.7.4::gentoo, 4.8.5::gentoo, 4.9.3::gentoo
sys-devel/gcc-config:     1.8::gentoo
sys-devel/libtool:        2.4.6-r1::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.0::gentoo (virtual/os-headers)
sys-libs/glibc:           2.21-r1::gentoo
Repositories:

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

science
    location: /home/mmokrejs/proj/sci
    masters: gentoo
    priority: 0

x-portage
    location: /usr/local/portage
    masters: gentoo
    priority: 1

layman
    location: /var/lib/layman
    masters: gentoo
    priority: 2

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

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA dlj-1.1 sun-bcla-java-vm Oracle-BCLA-JavaSE IBM-J1.6 skype-eula Nero-EULA-US AdobeFlash-10.3 skype-4.0.0.7-copyright AdobeFlash-11.x"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -maes -mpclmul -mpopcnt -mavx -march=native"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /etc/stunnel/stunnel.conf /usr/lib64/libreoffice/program/sofficerc /usr/share/easy-rsa /usr/share/gnupg/qualified.txt /usr/share/maven-bin-3.2/conf /var/bind /var/lib/hsqldb /var/spool/torque"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.4/ext-active/ /etc/php/apache2-php5.5/ext-active/ /etc/php/apache2-php5.6/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/php/cli-php5.6/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -maes -mpclmul -mpopcnt -mavx -march=native"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news nostrip parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="rsync://ftp.fi.muni.cz/pub/linux/gentoo/ rsync://gentoo.mirror.dkm.cz/gentoo/ ftp://gentoo.mirror.web4u.cz/"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j2"
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"
PORTAGE_TMPDIR="/var/tmp"
USE="X acpi alsa amd64 amr apache apache2 apulse avx berkdb bindist bluetooth boost bzip2 cairo cgi cli coin consolekit cracklib crypt cryptlib cups cxx dbus device-mapper dhcp directfb dri drm dvd emboss encode fax fbcon ffmpeg flac fontconfig fortran gbm gd gdbm geoip gimp glpk gnutls gpm gtk hal hpijs hwdb iconv id3tag imaging innodb java jce jpeg jpg keymap ladspa lapack laptop lcms libnotify lm_sensors mad matroska mmx mmxext modules mpi mpich2 multilib mysql ncurses nfs nls nptl nptlonly nscd nsplugin ntfsprogs ocr ogg opengl openmp pam parport pcre pdf perl php png policykit polkit ppds pppd python qt3support readline rendering resolvconf scanner seccomp server session slideshow sndfile sqlite sse sse2 sse3 sse4_1 sse4_2 ssl ssse3 suexec svg syslog tcl tcpd threads tiff tk truetype udev unicode usb v4l v4l2 vim-syntax vnc wavpack wifi x11 xattr xcb xml xorg xrandr xv xvid xvmc zlib" 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="alias authz_host auth_basic auth_digest cgi cgid deflate dir env filter include info mem_cache mime mime_magic negotiation remoteip setenvif status userdir vhost_alias rewrite usertrack cache file_cache disk_cache charset_lite log_config log_forensic" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en en_US en_GB cs cz" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-4 php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" RUBY_TARGETS="ruby20 ruby21" USERLAND="GNU" VIDEO_CARDS="vesa vmware fbdev intel i915 i965" 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"
USE_PYTHON="2.7"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 2 Mike Gilbert gentoo-dev 2015-11-23 16:23:27 UTC
> Anyway, I have dynamically linked grub2 and wanted a static version, hoping it will overwrite the /sbin/grub binary.

There is really no reason to have a static build of grub:2. It will not replace /sbin/grub.

Anyway, what USE flags do you have enabled for grub:2? If you can provide the output of emerge -pv grub:2, that would be helpful.
Comment 3 Martin Mokrejš 2015-11-23 16:42:22 UTC
Here are my general settings (no manually added 'static'):

# emerge -pv grub:2

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] sys-boot/grub-2.02_beta2-r7:2::gentoo  USE="device-mapper fonts multislot nls themes truetype -debug -doc -efiemu -libzfs -mount -sdl -static {-test}" GRUB_PLATFORMS="-coreboot -efi-32 -efi-64 -emu -ieee1275 -loongson -multiboot -pc -qemu -qemu-mips -uboot% -xen" 0 KiB



Files in /sbin/ used to be statically linked ... OK, on other OSes. ;-) But how come I have grub-2 installed and the /sbin/grub says it is 0.97 version? 'equery files' claims it does belong to grub-2. So I am puzzled.
Comment 4 Mike Gilbert gentoo-dev 2015-11-23 17:11:41 UTC
Try enabling static-libs for sys-fs/lvm2. USE=device-mapper is pulling that in.

> Files in /sbin/ used to be statically linked ... OK, on other OSes.

That has never been the case on Gentoo, unless the sysadmin takes some action to make it so.

Also, grub2 installs all files in /usr, nothing in /.

> 'equery files' claims it does belong to grub-2.

That should be impossible. Either there is a buy in equery, or you are misinterpreting the output.
Comment 5 Martin Mokrejš 2015-11-23 18:08:43 UTC
(In reply to Mike Gilbert from comment #4)
> Try enabling static-libs for sys-fs/lvm2. USE=device-mapper is pulling that
> in.

So I did:

USE=static-libs emerge sys-fs/lvm2
USE=static emerge grub

Notably, udev was also updated and picked up incidentally he USE=static-libs. Grub failed elsewhere. See another build.log. Not sure if that was partly because udev provided no shared libs anymore.

> 
> > Files in /sbin/ used to be statically linked ... OK, on other OSes.
> 
> That has never been the case on Gentoo, unless the sysadmin takes some
> action to make it so.
> 
> Also, grub2 installs all files in /usr, nothing in /.
> 
> > 'equery files' claims it does belong to grub-2.
> 
> That should be impossible. Either there is a buy in equery, or you are
> misinterpreting the output.

Aha, I was kidding. Anyway, this is on another machine, not related to this grub-2 bug.

# equery belongs /sbin/grub
 * Searching for /sbin/grub ... 
sys-boot/grub-0.97-r14 (/sbin/grub)
#
Comment 6 Martin Mokrejš 2015-11-23 18:10:49 UTC
Created attachment 417692 [details]
build.log (USE=static)

USE=static-libs emerge sys-fs/lvm2; USE=static emerge grub

1448300193: Started emerge on: Nov 23, 2015 18:36:32
1448300193:  *** emerge  sys-fs/lvm2
1448300225:  >>> emerge (1 of 3) sys-fs/udev-225 to /
1448300225:  === (1 of 3) Cleaning (sys-fs/udev-225::/usr/portage/sys-fs/udev/udev-225.ebuild)
1448300225:  === (1 of 3) Compiling/Merging (sys-fs/udev-225::/usr/portage/sys-fs/udev/udev-225.ebuild)
1448300842:  === (1 of 3) Merging (sys-fs/udev-225::/usr/portage/sys-fs/udev/udev-225.ebuild)
1448300847:  >>> AUTOCLEAN: sys-fs/udev:0
1448300847:  === Unmerging... (sys-fs/udev-225)
1448300852:  >>> unmerge success: sys-fs/udev-225
1448300859:  === (1 of 3) Post-Build Cleaning (sys-fs/udev-225::/usr/portage/sys-fs/udev/udev-225.ebuild)
1448300859:  ::: completed emerge (1 of 3) sys-fs/udev-225 to /
1448300859:  >>> emerge (2 of 3) virtual/libudev-215-r1 to /
1448300859:  === (2 of 3) Cleaning (virtual/libudev-215-r1::/usr/portage/virtual/libudev/libudev-215-r1.ebuild)
1448300859:  === (2 of 3) Compiling/Merging (virtual/libudev-215-r1::/usr/portage/virtual/libudev/libudev-215-r1.ebuild)
1448300862:  === (2 of 3) Merging (virtual/libudev-215-r1::/usr/portage/virtual/libudev/libudev-215-r1.ebuild)
1448300866:  >>> AUTOCLEAN: virtual/libudev:0
1448300866:  === Unmerging... (virtual/libudev-215-r1)
1448300871:  >>> unmerge success: virtual/libudev-215-r1
1448300877:  === (2 of 3) Post-Build Cleaning (virtual/libudev-215-r1::/usr/portage/virtual/libudev/libudev-215-r1.ebuild)
1448300877:  ::: completed emerge (2 of 3) virtual/libudev-215-r1 to /
1448300877:  >>> emerge (3 of 3) sys-fs/lvm2-2.02.116-r2 to /
1448300877:  === (3 of 3) Cleaning (sys-fs/lvm2-2.02.116-r2::/usr/portage/sys-fs/lvm2/lvm2-2.02.116-r2.ebuild)
1448300877:  === (3 of 3) Compiling/Merging (sys-fs/lvm2-2.02.116-r2::/usr/portage/sys-fs/lvm2/lvm2-2.02.116-r2.ebuild)
1448300995:  === (3 of 3) Merging (sys-fs/lvm2-2.02.116-r2::/usr/portage/sys-fs/lvm2/lvm2-2.02.116-r2.ebuild)
1448301002:  >>> AUTOCLEAN: sys-fs/lvm2:0
1448301002:  === Unmerging... (sys-fs/lvm2-2.02.110)
1448301007:  >>> unmerge success: sys-fs/lvm2-2.02.110
1448301011:  === (3 of 3) Updating world file (sys-fs/lvm2-2.02.116-r2)
1448301011:  === (3 of 3) Post-Build Cleaning (sys-fs/lvm2-2.02.116-r2::/usr/portage/sys-fs/lvm2/lvm2-2.02.116-r2.ebuild)
1448301011:  ::: completed emerge (3 of 3) sys-fs/lvm2-2.02.116-r2 to /
1448301011:  *** Finished. Cleaning up...
1448301019:  *** exiting successfully.
1448301022:  *** terminating.
1448301024: Started emerge on: Nov 23, 2015 18:50:24
1448301024:  *** emerge  grub
1448301084:  >>> emerge (1 of 1) sys-boot/grub-2.02_beta2-r7 to /
1448301084:  === (1 of 1) Cleaning (sys-boot/grub-2.02_beta2-r7::/usr/portage/sys-boot/grub/grub-2.02_beta2-r7.ebuild)
1448301084:  === (1 of 1) Compiling/Merging (sys-boot/grub-2.02_beta2-r7::/usr/portage/sys-boot/grub/grub-2.02_beta2-r7.ebuild)
1448301263:  *** Finished. Cleaning up...
1448301263:  *** exiting unsuccessfully with status '1'.
1448301263:  *** terminating.
Comment 7 Mike Gilbert gentoo-dev 2015-11-23 18:48:28 UTC
I will probably just remove the static USE flag from grub:2. It's not worth the effort to support.
Comment 8 Larry the Git Cow gentoo-dev 2019-07-08 23:36:36 UTC
The bug has been closed via the following commit(s):

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

commit a2cc45b4f4161260a9a5e956c52b3cd4ae889c92
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2019-07-08 18:25:11 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2019-07-08 23:36:24 +0000

    sys-boot/grub: drop 'static' use flag
    
    Closes: https://bugs.gentoo.org/566632
    Package-Manager: Portage-2.3.68, Repoman-2.3.16_p2
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 sys-boot/grub/grub-9999.ebuild | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)