Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 472056 - net-libs/gnutls-3.2.1 fails due to underlinking with gold
Summary: net-libs/gnutls-3.2.1 fails due to underlinking with gold
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Crypto team [DISABLED]
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: underlinking
  Show dependency tree
 
Reported: 2013-06-02 04:11 UTC by iGentoo
Modified: 2013-06-03 01:43 UTC (History)
4 users (show)

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


Attachments
gnutls-3.2.1-build.log (gnutls-3.2.1-build.log,325.11 KB, text/plain)
2013-06-02 04:11 UTC, iGentoo
Details
net-im/empathy build.log (build.log,17.53 KB, text/x-log)
2013-06-03 01:32 UTC, Ben Kohler
Details

Note You need to log in before you can comment on or make changes to this bug.
Description iGentoo 2013-06-02 04:11:54 UTC
Created attachment 349884 [details]
gnutls-3.2.1-build.log

/bin/sh ../../libtool  --tag=CC   --mode=link x86_64-pc-linux-gnu-gcc -std=gnu99  -Wall -Wextra -ggdb -march=native -pipe -O3 -fno-tree-vectorize -frecord-gcc-switches  -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu -Wl,--icf=safe -o crywrap crywrap.o ../../lib/libgnutls.la ../../gl/libgnu.la -lidn 
libtool: link: x86_64-pc-linux-gnu-gcc -std=gnu99 -Wall -Wextra -ggdb -march=native -pipe -O3 -fno-tree-vectorize -frecord-gcc-switches -Wl,-O1 -Wl,--hash-style=gnu -Wl,--icf=safe -o .libs/crywrap crywrap.o  -Wl,--as-needed ../../lib/.libs/libgnutls.so -L/usr/lib64 -lz -lnettle -lhogweed ../../gl/.libs/libgnu.a -lidn
../../lib/.libs/libgnutls.so: error: undefined reference to '__gmpz_invert'
../../lib/.libs/libgnutls.so: error: undefined reference to '__gmpz_init'
../../lib/.libs/libgnutls.so: error: undefined reference to '__gmpz_clear'
../../lib/.libs/libgnutls.so: error: undefined reference to '__gmpz_cmp'
../../lib/.libs/libgnutls.so: error: undefined reference to '__gmpz_powm'
../../lib/.libs/libgnutls.so: error: undefined reference to '__gmpz_probab_prime_p'
../../lib/.libs/libgnutls.so: error: undefined reference to '__gmpz_sizeinbase'
../../lib/.libs/libgnutls.so: error: undefined reference to '__gmpz_set'
../../lib/.libs/libgnutls.so: error: undefined reference to '__gmpz_cmp_ui'
../../lib/.libs/libgnutls.so: error: undefined reference to '__gmpz_init2'
../../lib/.libs/libgnutls.so: error: undefined reference to '__gmpz_mod'
../../lib/.libs/libgnutls.so: error: undefined reference to '__gmpz_set_ui'
../../lib/.libs/libgnutls.so: error: undefined reference to '__gmpz_sub_ui'
../../lib/.libs/libgnutls.so: error: undefined reference to '__gmpz_add'
../../lib/.libs/libgnutls.so: error: undefined reference to '__gmpz_cdiv_q'
../../lib/.libs/libgnutls.so: error: undefined reference to '__gmpz_mul'
../../lib/.libs/libgnutls.so: error: undefined reference to '__gmpz_mul_ui'
../../lib/.libs/libgnutls.so: error: undefined reference to '__gmpz_add_ui'
../../lib/.libs/libgnutls.so: error: undefined reference to '__gmpz_sub'
../../lib/.libs/libgnutls.so: error: undefined reference to '__gmpz_fdiv_r'
../../lib/.libs/libgnutls.so: error: undefined reference to '__gmpz_setbit'
collect2: error: ld returned 1 exit status
make[4]: *** [crywrap] Error 1
make[4]: Leaving directory `/var/tmp/portage/net-libs/gnutls-3.2.1/work/gnutls-3.2.1/src/crywrap'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/var/tmp/portage/net-libs/gnutls-3.2.1/work/gnutls-3.2.1/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/var/tmp/portage/net-libs/gnutls-3.2.1/work/gnutls-3.2.1/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/net-libs/gnutls-3.2.1/work/gnutls-3.2.1'
make: *** [all] Error 2



Portage 2.2.0_alpha177 (hardened/linux/amd64/selinux, gcc-4.8.0, glibc-2.17, 3.9.4-pax.x86_64 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-3.9.4-pax.x86_64-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q9300_@_2.50GHz-with-gentoo-2.2
KiB Mem:     6114252 total,    417408 free
KiB Swap:   10484724 total,  10382852 free
Timestamp of tree: Sun, 02 Jun 2013 03:15:01 +0000
ld GNU gold (GNU Binutils 2.23.2) 1.11
ccache version 3.1.9 [disabled]
app-shells/bash:          4.2_p45
dev-java/java-config:     2.2.0
dev-lang/python:          2.5.4-r5, 2.6.8-r1, 2.7.5, 3.1.5-r1, 3.2.5, 3.3.2
dev-util/ccache:          3.1.9
dev-util/cmake:           2.8.10.2-r2
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.13.2
sys-devel/binutils:       2.23.2
sys-devel/gcc:            4.6.4, 4.7.3, 4.8.0
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.9 (virtual/os-headers)
sys-libs/glibc:           2.17
Repositories: gentoo systemd hardened-dev custom
Installed sets: @local
ACCEPT_KEYWORDS="amd64 x86 ~amd64 ~x86"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-Wall -Wextra -ggdb -march=native -pipe -O3 -fno-tree-vectorize -frecord-gcc-switches"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/polkit-1/actions /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo"
CXXFLAGS="-Wall -Wextra -ggdb -march=native -pipe -O3 -fno-tree-vectorize -frecord-gcc-switches"
DISTDIR="/var/portage/distfiles"
EMERGE_DEFAULT_OPTS="--keep-going"
FCFLAGS="-Wall -Wextra -ggdb -march=native -pipe -O3 -fno-tree-vectorize -frecord-gcc-switches"
FEATURES="assume-digests binpkg-logs buildpkg collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox selinux sesandbox sfperms split-elog split-log splitdebug strict test test-fail-continue unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync webrsync-gpg xattr"
FFLAGS="-Wall -Wextra -ggdb -march=native -pipe -O3 -fno-tree-vectorize -frecord-gcc-switches"
GENTOO_MIRRORS="http://mirrors.163.com/gentoo http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu -Wl,--icf=safe"
MAKEOPTS="V=1 -j10"
PKGDIR="/var/portage/packages-amd64"
PORTAGE_BZIP2_COMMAND="lbzip2"
PORTAGE_COMPRESS="xz"
PORTAGE_COMPRESS_FLAGS="-9ef"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="--ipv4"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/systemd /var/lib/layman/hardened-development /usr/local/portage"
SYNC="rsync://mirrors.ustc.edu.cn/gentoo-portage"
USE="X acl alsa amd64 audit bash-completion berkdb bzip2 c++0x cairo caps cli cracklib crypt custom-cflags cxx dbus dri ffmpeg gdbm gmp gnome gpm gtk gtk3 hardened iconv icu ipv6 jit jpeg jpeg2k justify lzma mmx modules mudflap multilib ncurses nls nptl open_perms opengl openmp orc pam pax_kernel pcre png pulseaudio qt4 readline selinux session sse sse2 ssl svg systemd tcpd threads tiff udev unicode urandom vim-syntax xattr xinetd zlib" ABI_X86="x32 32 64" ALSA_CARDS="hda-intel" 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" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" DRACUT_MODULES="btrfs caps dmsquash-live gensplash livenet lvm nfs ssh-client syslog systemd" 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 ubx" INPUT_DEVICES="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 zh zh_CN" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="pypy1_9 pypy2_0 python3_1 python3_2 python3_3 python2_5 python2_6 python2_7" QEMU_SOFTMMU_TARGETS="x86_64 arm mips64el ppc64" RUBY_TARGETS="ruby19 ruby18" USERLAND="GNU" VIDEO_CARDS="nouveau nvidia" 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-pypy-1.9 2.7-pypy-2.0 3.1 3.2 3.3 2.5 2.6 2.7"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND

=================================================================
                        Package Settings
=================================================================

dev-libs/nettle-2.7 was built with the following:
USE="gmp test -doc (-neon) -static-libs"


net-libs/gnutls-3.2.1 was built with the following:
USE="cxx nls zlib -dane -doc -examples -guile -pkcs11 -static-libs -test" LINGUAS="en zh_CN -cs -de -fi -fr -it -ms -nl -pl -sv -uk -vi"


See also:
https://gitorious.org/gnutls/gnutls/commit/df049b3921a3b295facb251fe96bcf8aff69380c
Comment 1 Alon Bar-Lev (RETIRED) gentoo-dev 2013-06-02 11:20:40 UTC
Thanks for the information!

I cannot reproduce this for some reason...

gnutls should be linked with nettle not with gmp... why are the symbols of gmp appeared at the gnutls shared object?

I tried to use your flags, I cannot use -Wl,--icf=safe for some reason...

Anyway, the problem may be the nettle pkg-config file:

$ pkg-config --libs hogweed
-lhogweed  

$ pkg-config --libs --static hogweed
-lhogweed -lnettle -lgmp  

At your environment the static variant should work, question is what happens in other cases.
Comment 2 Justin Lecher (RETIRED) gentoo-dev 2013-06-02 11:25:14 UTC
It also fails with -O2 -march=native. The keypoint is you need to use ld.gold for linking.
Comment 3 Alon Bar-Lev (RETIRED) gentoo-dev 2013-06-02 11:28:42 UTC
(In reply to Justin Lecher from comment #2)
> It also fails with -O2 -march=native. The keypoint is you need to use
> ld.gold for linking.

So what is the policy for this? do we alter all upstream pkg-config files to contain all dependencies even in shared mode?
Comment 4 Justin Lecher (RETIRED) gentoo-dev 2013-06-02 11:34:55 UTC
(In reply to Alon Bar-Lev from comment #3)
> So what is the policy for this? do we alter all upstream pkg-config files to
> contain all dependencies even in shared mode?

no, it is no a problem with dev-libs/nettle and hogweed.pc, but libgnutls.so is using symbols from gmp but not linking to it. So you need to fix gnutls to link against libgmp.so additionally.
Comment 5 Alon Bar-Lev (RETIRED) gentoo-dev 2013-06-02 11:36:52 UTC
(In reply to Justin Lecher from comment #4)
> (In reply to Alon Bar-Lev from comment #3)
> > So what is the policy for this? do we alter all upstream pkg-config files to
> > contain all dependencies even in shared mode?
> 
> no, it is no a problem with dev-libs/nettle and hogweed.pc, but libgnutls.so
> is using symbols from gmp but not linking to it. So you need to fix gnutls
> to link against libgmp.so additionally.

Only at lib/nettle/mpi.c, but I think we are using external nettle... will investigate.
Comment 6 Alon Bar-Lev (RETIRED) gentoo-dev 2013-06-02 12:30:20 UTC
Ok, should be fixed in gnutls-3.2.1.ebuild, please confirm.
Comment 7 Justin Lecher (RETIRED) gentoo-dev 2013-06-02 12:34:19 UTC
Confirmed, that fixes it.
Comment 8 Alon Bar-Lev (RETIRED) gentoo-dev 2013-06-02 12:46:09 UTC
Sent to upstream.
Comment 9 Ben Kohler gentoo-dev 2013-06-03 01:32:29 UTC
Created attachment 349940 [details]
net-im/empathy build.log

This appears to have broken gnutls.pc, it now has:

Requires.private: nettle, hogweed, gmp, zlib

but dev-libs/gmp doesn't provide gmp.pc so attempting to configure against gnutls now gives an error:

# pkg-config --exists --print-errors "gnutls >= 2.11.0"
Package gmp was not found in the pkg-config search path.
Perhaps you should add the directory containing `gmp.pc'
to the PKG_CONFIG_PATH environment variable
Package 'gmp', required by 'gnutls', not found
#

I've attached an example full build.log.  Let me know if I need to open a fresh report, but I think it's directly related to the patch applied for this bug.
Comment 10 Ben Kohler gentoo-dev 2013-06-03 01:43:39 UTC
Sorry, this issue is not caused by your patch.  There were some other changes to gnutls.pc.in between 3.2.0 and 3.2.1 that must be to blame.  I will open a fresh report.