Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 375549 - net-misc/curl-7.21.4[-threads] still links to libpthread
Summary: net-misc/curl-7.21.4[-threads] still links to libpthread
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Christoph Mende (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-18 10:28 UTC by Marcin Mirosław
Modified: 2011-12-01 18:16 UTC (History)
1 user (show)

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 Marcin Mirosław 2011-07-18 10:28:46 UTC
I've started to figure out what can be a reson of segfaults in mod_php5. I've got php comipled without threads support, but ldd shows libphp5 is using libpthread. I found libcurl is linked to librt and librt links to libpthread, and as i understand correctly all elf machinery, it gives libphp5 indirectly links to libpthread.

ldd -v /usr/lib64/php5.3/apache2/libphp5.so
ldd: warning: you do not have execution permission for `/usr/lib64/php5.3/apache2/libphp5.so'
        linux-vdso.so.1 =>  (0x0000026cc9d7e000)
        libz.so.1 => /lib64/libz.so.1 (0x0000026cc9212000)
        libtidy-0.99.so.0 => /usr//lib64/libtidy-0.99.so.0 (0x0000026cc8fa8000)
        libresolv.so.2 => /lib64/libresolv.so.2 (0x0000026cc8d8f000)
        libm.so.6 => /lib64/libm.so.6 (0x0000026cc8b0d000)
        libssl.so.1.0.0 => /usr//lib64/libssl.so.1.0.0 (0x0000026cc88aa000)
        libcrypto.so.1.0.0 => /usr//lib64/libcrypto.so.1.0.0 (0x0000026cc84d0000)
        libmcrypt.so.4 => /usr//lib64/libmcrypt.so.4 (0x0000026cc8299000)
        libdl.so.2 => /lib64/libdl.so.2 (0x0000026cc8094000)
        libonig.so.2 => /usr//lib64/libonig.so.2 (0x0000026cc7e27000)
        libpng14.so.14 => /usr//lib64/libpng14.so.14 (0x0000026cc7bfc000)
        libjpeg.so.8 => /usr//lib64/libjpeg.so.8 (0x0000026cc79bd000)
        libcurl.so.4 => /usr//lib64/libcurl.so.4 (0x0000026cc7761000)
        libpcre.so.0 => /lib64/libpcre.so.0 (0x0000026cc7524000)
        libicui18n.so.46 => /usr//lib64/libicui18n.so.46 (0x0000026cc7118000)
        libicuuc.so.46 => /usr//lib64/libicuuc.so.46 (0x0000026cc6da7000)
        libmysqlclient.so.16 => /usr/lib64/mysql/libmysqlclient.so.16 (0x0000026cc6a1b000)
        libxml2.so.2 => /usr//lib64/libxml2.so.2 (0x0000026cc66ad000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000026cc6496000)
        libc.so.6 => /lib64/libc.so.6 (0x0000026cc6112000)
        /lib64/ld-linux-x86-64.so.2 (0x0000026cc9d7f000)
        librt.so.1 => /lib64/librt.so.1 (0x0000026cc5f08000)
        libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/libstdc++.so.6 (0x0000026cc5bd7000)
        libicudata.so.46 => /usr/lib64/libicudata.so.46 (0x0000026cc4b58000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x0000026cc493b000)
[...]
/usr//lib64/libcurl.so.4:
                librt.so.1 (GLIBC_2.2.5) => /lib64/librt.so.1
                libc.so.6 (GLIBC_2.4) => /lib64/libc.so.6
                libc.so.6 (GLIBC_2.3) => /lib64/libc.so.6
                libc.so.6 (GLIBC_2.3.4) => /lib64/libc.so.6
                libc.so.6 (GLIBC_2.7) => /lib64/libc.so.6
                libc.so.6 (GLIBC_2.11) => /lib64/libc.so.6
                libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
[...]
/lib64/librt.so.1:
                ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
                libpthread.so.0 (GLIBC_2.2.5) => /lib64/libpthread.so.0
                libpthread.so.0 (GLIBC_PRIVATE) => /lib64/libpthread.so.0
                libc.so.6 (GLIBC_2.3.2) => /lib64/libc.so.6
                libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
                libc.so.6 (GLIBC_PRIVATE) => /lib64/libc.so.6

I don't know if it is a reason of problems in php but meseems if curl is compiled without threads it couldn't links to libpthread (but it is not something i'm 100% sure...).
Here [1] is link woth info how to compile curl without linking to librt.
[1] - http://curl.haxx.se/mail/lib-2009-08/0082.html

Reproducible: Always




# emerge --info
Portage 2.1.10.3 (hardened/linux/amd64, gcc-4.4.5, glibc-2.12.2-r0, 2.6.38-hardened-r6 x86_64)
=================================================================
System uname: Linux-2.6.38-hardened-r6-x86_64-Intel-R-_Xeon-R-_CPU_5160_@_3.00GHz-with-gentoo-2.0.2
Timestamp of tree: Thu, 14 Jul 2011 09:30:01 +0000
app-shells/bash:          4.1_p9
dev-lang/python:          2.7.1-r1, 3.1.3-r1
dev-util/cmake:           2.8.4-r1
dev-util/pkgconfig:       0.25-r2
sys-apps/baselayout:      2.0.2
sys-apps/openrc:          0.8.3-r1
sys-apps/sandbox:         2.4
sys-devel/autoconf:       2.68
sys-devel/automake:       1.11.1
sys-devel/binutils:       2.20.1-r1
sys-devel/gcc:            4.4.5
sys-devel/gcc-config:     1.4.1-r1
sys-devel/libtool:        2.2.10
sys-devel/make:           3.82
sys-kernel/linux-headers: 2.6.36.1 (virtual/os-headers)
sys-libs/glibc:           2.12.2
Repositories: gentoo
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=native -ggdb"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/openvpn/easy-rsa /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=native -ggdb"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs collision-protect distlocks ebuild-locks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en pl"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="-O"
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"
PORTDIR_OVERLAY="/usr/portage/local/cadera-overlay"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="acl acpi amd64 apache2 bash-completion bzip2 caps cli cracklib crypt cxx device-mapper dri glibc-omitfp gpm hardened iconv justify mmx modules mudflap multilib mysql ncurses nls nptl nptlonly openmp pam pcre pppd readline session slang smp snmp sse sse2 sse3 ssl ssse3 sysfs truetype unicode urandom vhosts vim-syntax xml xorg 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_default authn_file authz_default authz_groupfile authz_host authz_user autoindex cgi dav dav_fs dav_lock deflate dbd dir env expires filter headers info log_config logio mime mime_magic negotiation rewrite setenvif status vhost_alias" APACHE2_MPMS="prefork" CALLIGRA_FEATURES="braindump flow karbon kexi kpresenter krita tables words" CAMERAS="ptp2" 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" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en pl" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga neomagic nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" 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, EMERGE_DEFAULT_OPTS, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS
Comment 1 Christoph Mende (RETIRED) gentoo-dev 2011-07-23 12:11:30 UTC
Have you tried if this actually fixes your problem? I don't think this is worth the effort if it doesn't.
Also not sure how to add this, I don't want to remove this unconditionally, putting it under USE=threads doesn't seem right either.
Comment 2 Marcin Mirosław 2011-08-11 13:01:06 UTC
I didn't try compile curl without librt. But segfaults in php appears too randomly to easy reproduce (or not) problem . It passed two weeks without any segfault and suddenly i've got 10 segfaults.
Comment 3 SpanKY gentoo-dev 2011-12-01 18:16:55 UTC
ldd doesn't tell you the whole story.  curl itself is not linked against libpthread when USE=-threads.  it is linked against librt, but there's nothing to be done about that -- curl wants clock_gettime(), and glibc provides that in librt.  glibc then links librt against libpthread.

however, none of that means the libraries in question are actually using threads.

$ cd /var/tmp/portage/net-misc/curl-7.23.1/image/
$ scanelf -qRn .
libcurl.so.4,libssl.so.1.0.0,libcrypto.so.1.0.0,librt.so.1,libz.so.1,libc.so.6  ./usr/bin/curl
librt.so.1,libssl.so.1.0.0,libcrypto.so.1.0.0,libz.so.1,libc.so.6  ./usr/lib64/libcurl.so.4.2.0