Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 466178 - dev-vcs/git-1.8.2.1[subversion] undefined reference to `pthread_setspecific' while linking svn-fe
Summary: dev-vcs/git-1.8.2.1[subversion] undefined reference to `pthread_setspecific' ...
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Robin Johnson
URL:
Whiteboard:
Keywords:
: 466326 574196 (view as bug list)
Depends on:
Blocks: underlinking
  Show dependency tree
 
Reported: 2013-04-17 01:48 UTC by Mike Gilbert
Modified: 2020-12-07 07:35 UTC (History)
12 users (show)

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


Attachments
Build log (dev-vcs:git-1.8.2.1:20130417-014420.log,175.48 KB, text/plain)
2013-04-17 01:48 UTC, Mike Gilbert
Details
build.log with USE="-subversion" (dev-vcs_git-1.8.5.4_20140212-230816.log,141.94 KB, text/plain)
2014-02-12 23:12 UTC, Craig Andrews
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Gilbert gentoo-dev 2013-04-17 01:48:46 UTC
Created attachment 345736 [details]
Build log

gcc -g -O2 -Wall -o svn-fe svn-fe.o \
        -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu ../../vcs-svn/lib.a ../../libgit.a -lz -lssl /tmp/portage/dev-vcs/git-1.8.2.1/work/git-1.8.2.1/xdiff/lib.a -lpcre
../../libgit.a(run-command.o): In function `run_thread':
run-command.c:(.text+0x3ee): undefined reference to `pthread_setspecific'
../../libgit.a(run-command.o): In function `die_async':
run-command.c:(.text+0x446): undefined reference to `pthread_getspecific'
../../libgit.a(run-command.o): In function `start_async':
run-command.c:(.text+0x1155): undefined reference to `pthread_create'
run-command.c:(.text+0x11a2): undefined reference to `pthread_key_create'
../../libgit.a(run-command.o): In function `finish_async':
run-command.c:(.text+0x12f7): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status


Portage 2.2.0_alpha173 (default/linux/amd64/13.0/desktop/kde, gcc-4.8.0, glibc-2.15-r3, 3.8.4 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-3.8.4-x86_64-AMD_Phenom-tm-_II_X6_1055T_Processor-with-gentoo-2.2
KiB Mem:     8179940 total,   1570872 free
KiB Swap:          0 total,         0 free
Timestamp of tree: Unknown
ld GNU ld (GNU Binutils) 2.23.1
app-shells/bash:          4.2_p37
dev-java/java-config:     2.2.0
dev-lang/python:          2.5.4-r5, 2.6.8-r1, 2.7.4, 3.1.5-r1, 3.2.3-r2, 3.3.0-r1
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.9.6-r3, 1.11.6, 1.12.6, 1.13.1
sys-devel/binutils:       2.23.1
sys-devel/gcc:            4.4.7, 4.5.4, 4.6.3, 4.7.2-r1, 4.8.0
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.7 (virtual/os-headers)
sys-libs/glibc:           2.15-r3
Repositories: gentoo floppym local
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=native -frecord-gcc-switches -Wall"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/polkit-1/actions /usr/share/themes/oxygen-gtk/gtk-2.0 /usr/share/themes/oxygen-gtk/gtk-3.0"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.4/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /usr/share/themes"
CXXFLAGS="-O2 -pipe -march=native -frecord-gcc-switches -Wall"
DISTDIR="/var/portage/distfiles"
EMERGE_DEFAULT_OPTS="--autounmask=n --with-bdeps=y --quiet-build=n --jobs=6"
FCFLAGS="-O2 -pipe -march=native -frecord-gcc-switches -Wall"
FEATURES="assume-digests binpkg-logs buildpkg clean-logs config-protect-if-modified distlocks ebuild-locks fakeroot fixlafiles news parallel-fetch preserve-libs protect-owned sandbox sfperms sign strict unknown-features-warn unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -march=native -frecord-gcc-switches -Wall"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu"
MAKEOPTS="-j6"
PKGDIR="/var/portage/packages"
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="/tmp"
PORTDIR="/home/floppym/gentoo-x86"
PORTDIR_OVERLAY="/home/floppym/overlays/floppym /home/floppym/overlays/local"
SYNC="cvs://"
USE="3dnow 3dnowext X a52 aac acl acpi alsa amd64 bash-completion berkdb bluetooth branding bzip2 cairo caps cdda cdr cli cracklib crypt css cups cxx dbus declarative dri dts dvd dvdr emboss encode exif fam ffmpeg firefox flac fontconfig fortran gdbm gif gles gpm gtk iconv imap ipv6 jpeg kde kipi lcms libnotify lzma mad mmx mmxext mng modules mono mp3 mp4 mpeg mtp mudflap multilib ncurses nls nptl nsplugin offensive ogg opengl openmp pam pango pcre pdf phonon plasma png policykit ppds qt3support qt4 readline samba sdl semantic-desktop session spell sse sse2 sse3 ssl startup-notification suid svg systemd taglib tcpd theora threads tiff truetype udev udisks unicode upower usb vaapi vdpau vim-syntax vorbis wxwidgets x264 xattr xcb xcomposite xinerama xml xscreensaver xv xvid zlib zsh-completion" ABI_X86="32 64" 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="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" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" DRACUT_MODULES="btrfs 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" GRUB_PLATFORMS="efi-64 emu pc" 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" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-4" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_5 python2_6 python2_7 python3_1 python3_2 python3_3 pypy1_8 pypy1_9 pypy2_0" QEMU_SOFTMMU_TARGETS="arm i386 x86_64" QEMU_USER_TARGETS="arm i386 x86_64" RUBY_TARGETS="ruby19" 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.5 2.6 2.7 3.1 3.2 3.3 2.7-pypy-1.9 2.7-pypy-2.0"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS

=================================================================
                        Package Settings
=================================================================
USE="blksha1 curl cvs gpg gtk iconv (multilib) nls pcre perl (policykit) python threads tk webdav -cgi -doc -emacs -gnome-keyring -highlight (-ppcsha1) -subversion -test -xinetd" ABI_X86="64"
Comment 1 Yuri Sevatz 2013-04-17 06:22:10 UTC
I was able to repoduce this issue:

../../libgit.a(run-command.o): In function `run_thread':
run-command.c:(.text+0x11e): undefined reference to `pthread_setspecific'
../../libgit.a(run-command.o): In function `die_async':
run-command.c:(.text+0x166): undefined reference to `pthread_getspecific'
../../libgit.a(run-command.o): In function `start_async':
run-command.c:(.text+0x10f4): undefined reference to `pthread_create'
run-command.c:(.text+0x115e): undefined reference to `pthread_key_create'
../../libgit.a(run-command.o): In function `finish_async':
run-command.c:(.text+0x12b7): undefined reference to `pthread_join'


[ebuild     U ~] dev-vcs/git-1.8.2.1 [1.8.1.5] USE="blksha1 curl cvs gnome-keyring gpg gtk iconv nls pcre perl python subversion threads tk webdav -cgi -doc -emacs -highlight (-ppcsha1) {-test} -xinetd" 0 kB

Cheers :)
Comment 2 Justin Lecher (RETIRED) gentoo-dev 2013-04-17 13:09:28 UTC
It also seems to disrespect $CC
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2013-04-17 19:18:20 UTC
INCVS
Comment 4 Ari Entlich 2013-04-18 23:55:18 UTC
This is not fixed.
Comment 5 Ari Entlich 2013-04-19 00:33:39 UTC
The actual problem is that the thing with setting EXTLIBS for svn-fe in the 1.8.2.1 ebuild is a hack and there's no way you can ever completely fix this without properly integrating these contrib projects into git's actual build system. I realize that this isn't gentoo's responsibility, of course.

This specific problem could be fixed by adding -lpthread to EXTLIBS. By the way, THREADED_DELTA_SEARCH no longer exists (and hasn't since 1.7.0), and the only control you have with regards to threads is with NO_PTHREADS. So in the ebuild's current state, git will be built with threads whether you like it or not. At this point I'm not sure there's any point in having a threads USE flag at all.

I've been trying to figure out why the build is suddenly failing when it was succeeding with 1.8.1.5. I suspect that some code paths changed in libgit.a such that the functions being used by svn-fe now wind up requiring the ones that use threading (as well as pcre, zlib, and xdiff - it look like ssl is not actually required). However, I have not been able to prove this.
Comment 6 SpanKY gentoo-dev 2013-04-19 13:33:59 UTC
*** Bug 466326 has been marked as a duplicate of this bug. ***
Comment 7 SpanKY gentoo-dev 2013-04-19 13:38:17 UTC
should be all set now in the tree; thanks for the report!

Commit message: Add missing pthreads linkage for svn-fe
http://sources.gentoo.org/dev-vcs/git/git-1.8.2.1.ebuild?r1=1.2&r2=1.3
Comment 8 Ari Entlich 2013-04-20 15:32:08 UTC
Thanks for the fix, but there are still some problems here.

First of all, as I noted in comment #5, the threads USE flag _does_not_actually_impact_the_enabledness_of_threads_. Therefore, in the ebuild's current state, building with USE="subversion -threads" will _fail_, because svn-fe _still_requires_pthread_. Please just remove the threads USE flag - there is no point to its existence at this point.

Also, I don't think this is related at all to "underlinking" issue. This is really an issue related very specifically to git's build system. How are you thinking that the linker's specific behavior could ever cause svn-fe to be linked with pthread if it is not being linked with it explicitly?
Comment 9 Martin von Gagern 2013-04-20 21:23:26 UTC
(In reply to comment #8)
> How are you thinking that the linker's specific behavior could ever cause
> svn-fe to be linked with pthread if it is not being linked with it explicitly?

At least on my system, libpcre depends on libpthread, so git with USE=pcre will link all right as long as the linker uses --copy-dt-needed-entries. This explains why the linker error message I quoted in bug #466326 comment #0 already suggests what library should be added to the invocation.
Comment 10 Ari Entlich 2013-04-21 08:20:32 UTC
(In reply to comment #9)
> At least on my system, libpcre depends on libpthread, so git with USE=pcre
> will link all right as long as the linker uses --copy-dt-needed-entries.
> This explains why the linker error message I quoted in bug #466326 comment
> #0 already suggests what library should be added to the invocation.

Hmm, interesting. My copy of libpcre is not linked with libpthread, but it looks like it maybe should be. There is definitely some threading stuff in there, and the whole thing builds because stubs for most of the basic thread things are in libc, but using the stubs would make those functions not actually do anything. There was a commit: http://vcs.pcre.org/viewvc?view=revision&revision=1019 which makes libpcre's build system aware of the pthread requirement. I could be wrong, but it seems that before this commit libpcre might not have actually been thread safe. Oops!

My version of libpcre is 8.30, which does NOT include the above mentioned commit. That's probably why it doesn't link with pthread. Which version do you have? It looks like 8.32 includes that commit.

In any case, even if your pcre links with pthread, USE="subversion -threads -pcre" will still fail. The problem here is that when one is mixing static and dynamic libraries (as any program that uses static libraries, such as git with libgit.a, must do on a modern system), one has to keep track of the dynamic libraries that static libraries use - they can not do this themselves. git's build system knows what dynamic libraries libgit.a needs (including libpthread), but svn-fe's does not. That is the problem here.

So again, this has nothing to do with underlinking.
Comment 11 Ari Entlich 2013-04-22 00:56:20 UTC
Mike, could you re-open this? It needs more attention.
Comment 12 Craig Andrews gentoo-dev 2014-02-12 23:12:02 UTC
Created attachment 370256 [details]
build.log with USE="-subversion"

I'm getting this problem even with USE="-subversion"... even though this bug is specifically about USE="subversion" I thought it would be interesting to report this problem here.

[ebuild     U  ] dev-vcs/git-1.8.5.4 [1.8.5.2] USE="blksha1 curl gpg gtk highlight iconv nls pcre perl python threads webdav -cgi -cvs -doc -emacs -gnome-keyring -mediawiki% (-ppcsha1) -subversion {-test} -tk -xinetd" PYTHON_SINGLE_TARGET="python2_7 -python2_6" PYTHON_TARGETS="python2_7 -python2_6" 0 kB
Comment 13 Ari Entlich 2014-02-13 06:10:52 UTC
That is definitely not the same issue. My advice would be that you ask about it on IRC or on the forums or something. I'm sure it's just happening because you're using a non-stable gcc version or have -flto in your CFLAGS or something like that.
Comment 14 Felix Janda 2015-04-03 11:59:49 UTC
I think that upstream commit

https://github.com/git/git/commit/da011cb0e77a6d2f7c424c5b7dbf482df4723a11

likely fixes this.
Comment 15 Michael Palimaka (kensington) gentoo-dev 2016-02-09 10:46:13 UTC
*** Bug 574196 has been marked as a duplicate of this bug. ***
Comment 16 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2020-12-07 07:35:09 UTC
I believe this ticket is obsolete, if the problem persists, please reopen