Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 340541 - dev-util/gtest: libgtest.so is not linked to pthread but uses it
Summary: dev-util/gtest: libgtest.so is not linked to pthread but uses it
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: MATSUU Takuto (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-11 14:59 UTC by Alexis Ballier
Modified: 2010-11-04 17:15 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexis Ballier gentoo-dev 2010-10-11 14:59:24 UTC
$ gcc foo.c -lgtest
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.1/../../../../lib64/libgtest.so: undefined reference to `pthread_key_create'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.1/../../../../lib64/libgtest.so: undefined reference to `pthread_getspecific'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.1/../../../../lib64/libgtest.so: undefined reference to `pthread_key_delete'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.1/../../../../lib64/libgtest.so: undefined reference to `pthread_setspecific'
collect2: ld returned 1 exit status


[ebuild   R   ] dev-util/gtest-1.5.0  USE="threads -examples -static-libs" 0 kB


$ emerge  --info --ignore-default-opts
Portage 2.2_rc92 (default/linux/amd64/10.0/desktop/kde, gcc-4.5.1, glibc-2.12.1-r1, 2.6.35.7 x86_64)
=================================================================
System uname: Linux-2.6.35.7-x86_64-Intel-R-_Core-TM-2_Duo_CPU_T9300_@_2.50GHz-with-gentoo-2.0.1
Timestamp of tree: Unknown
distcc 3.1 x86_64-pc-linux-gnu [disabled]
app-shells/bash:     4.1_p9
dev-lang/python:     2.6.6, 3.1.2-r4
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.6.3
sys-apps/sandbox:    2.3-r1
sys-devel/autoconf:  2.13, 2.68
sys-devel/automake:  1.8.5-r4, 1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.4-r2, 4.5.1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.10
sys-devel/make:      3.81-r2
virtual/os-headers:  2.6.35 (sys-kernel/linux-headers)
Repositories: gentoo
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -mssse3 -msse4.1 -O2 -pipe -ggdb"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /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=core2 -mssse3 -msse4.1 -O2 -pipe -ggdb"
DISTDIR="/usr/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y --verbose --keep-going"
FEATURES="assume-digests binpkg-logs buildpkg buildsyspkg collision-protect distlocks fixlafiles fixpackages multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms sign splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="http://gentoo.localhost.net.ar/ http://distfiles.gentoo.org http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,--as-needed -Wl,-O1 -Wl,--sort-common -Wl,--hash-style=gnu"
LINGUAS="en fr en_US"
MAKEOPTS="-j8"
PKGDIR="/usr/packages"
PORTAGE_COMPRESS="xz"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage_cvs/gentoo-x86"
PORTDIR_OVERLAY=""
SYNC="cvs://aballier@cvs.gentoo.org:/var/cvsroot"
USE="X a52 aac acpi alsa amd64 amr bash-completion bluetooth branding bzip2 cairo cdda cddb cdio cdparanoia cdr cli consolekit cracklib crypt cups curl custom-optimization cxx dbus device-mapper dirac djvu dri dssi dts dv dvb dvd dvdr emboss enca encode exif expat faac faad fam ffmpeg fftw firefox flac fluidsynth fontconfig fortran gcrypt gdbm gif gmp gpg gpm gtk hal iconv id3tag ieee1394 imagemagick inotify iphone ipod ipv6 jack jingle jpeg jpeg2k kate kde kpathsea ladspa lame lash latex lcms libass libcaca libnotify libsamplerate libtiger libv4l libv4l2 live lm_sensors lzma lzo mad matroska mikmod mmx mmxext mng modplug modules mp3 mp4 mpeg msn mudflap multilib musepack musicbrainz mysql ncurses networkmanager nls nptl nptlonly nsplugin ntp ocaml offensive ogg openexr opengl openmp otr pam pango pcre pdf perl png pnm policykit ppds pppd projectm pulseaudio python qt3support qt4 quicktime readline reflection rubberband schroedinger sdl semantic-desktop session shout skins skype sms sndfile sox speex spell sqlite sqlite3 sse sse2 sse3 sse4 ssl ssse3 startup-notification svg sysfs system-sqlite t1lib taglib tcpd theora threads tiff toolame truetype twolame udev unicode usb v4l v4l2 vaapi vdpau vim-syntax vorbis vpx wavpack wifi x264 xcb xine xml xorg xpm xulrunner xv xvid zip zlib" 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" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="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" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" 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="keyboard mouse evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en fr en_US" PHP_TARGETS="php-5.2" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="vesa nvidia nv nouveau" 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:  CPPFLAGS, CTARGET, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 MATSUU Takuto (RETIRED) gentoo-dev 2010-11-04 00:19:18 UTC
I think that it should be use $(gtest-config --ldflags --libs).

$ gcc foo.c $(gtest-config --ldflags --libs)
Comment 2 Alexis Ballier gentoo-dev 2010-11-04 17:15:09 UTC
I'm sorry but, simply, no: extra libs should be needed only for static linking. Shared elf objects have a way to express their library requirements by linking to them; not using this is, if not a bug, an annoying suboptimal use.