Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 496810 - media-libs/ilmbase-2.0.1-r1: libIlmThread.so doesn't link to libpthread
Summary: media-libs/ilmbase-2.0.1-r1: libIlmThread.so doesn't link to libpthread
Status: RESOLVED DUPLICATE of bug 462494
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Media-video project
URL:
Whiteboard:
Keywords:
: 497612 498296 499462 (view as bug list)
Depends on:
Blocks: 378027
  Show dependency tree
 
Reported: 2014-01-02 22:42 UTC by Robert Cabrera
Modified: 2014-01-28 04:15 UTC (History)
14 users (show)

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


Attachments
build.log (build.log,96.84 KB, text/plain)
2014-01-02 22:46 UTC, Robert Cabrera
Details
ilmbase-2.0.1-pthreads.patch (ilmbase-2.0.1-pthreads.patch,642 bytes, patch)
2014-01-04 23:52 UTC, Mike Auty (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Cabrera 2014-01-02 22:42:47 UTC
I recompiled my system over the holiday to start the New Year off fresh. Everything on my ~amd64 laptop emerged without a hitch except for =media-libs/openexr-2.0.1-r1 or =media-libs/openexr-2.0.1. Both versions fail with the same error message in the same place.

libtool: link: x86_64-pc-linux-gnu-g++ -m32 -pipe -O2 -pipe -march=native -Wl,-O1 -o .libs/exrheader main.o -pthread  -Wl,--as-needed -L/usr/lib32 ../IlmImf/.libs/libIlmImf.so -lImath -lHalf -lIex -lIexMath -lIlmThread -lz -pthread
/usr/lib32/libIlmThread.so: undefined reference to `sem_init'
/usr/lib32/libIlmThread.so: undefined reference to `sem_destroy'
/usr/lib32/libIlmThread.so: undefined reference to `pthread_create'
/usr/lib32/libIlmThread.so: undefined reference to `sem_post'
/usr/lib32/libIlmThread.so: undefined reference to `sem_trywait'
/usr/lib32/libIlmThread.so: undefined reference to `sem_getvalue'
/usr/lib32/libIlmThread.so: undefined reference to `sem_wait'
/usr/lib32/libIlmThread.so: undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
Makefile:299: recipe for target 'exrheader' failed
make[1]: *** [exrheader] Error 1
make[1]: Leaving directory '/var/tmp/portage/media-libs/openexr-2.0.1-r1/work/openexr-2.0.1-x86/exrheader'
Makefile:385: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
 * ERROR: media-libs/openexr-2.0.1-r1::gentoo failed (compile phase):
 *   emake failed

Reproducible: Always

Steps to Reproduce:
1. emerge -1 openexr
2.
3.
Actual Results:  
Build fails with above mentioned error.

Expected Results:  
Successful emerge.

My emerge --info:

Portage 2.2.7 (default/linux/amd64/13.0/desktop/kde, gcc-4.8.2, glibc-2.17, 3.12.2-pf x86_64)
=================================================================
System uname: Linux-3.12.2-pf-x86_64-Intel-R-_Core-TM-2_CPU_T7200_@_2.00GHz-with-gentoo-2.2
KiB Mem:     3337472 total,    449216 free
KiB Swap:    4200960 total,   4200920 free
Timestamp of tree: Thu, 02 Jan 2014 20:15:01 +0000
ld GNU ld (GNU Binutils) 2.24
app-shells/bash:          4.2_p45
dev-java/java-config:     2.2.0
dev-lang/python:          2.7.6, 3.3.3
dev-util/cmake:           2.8.12.1-r2
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.12.4
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.11.6, 1.12.6, 1.14.1
sys-devel/binutils:       2.24
sys-devel/gcc:            4.8.2
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2
sys-devel/make:           4.0-r1
sys-kernel/linux-headers: 3.12 (virtual/os-headers)
sys-libs/glibc:           2.17
Repositories: gentoo sunrise my_local_overlay
Installed sets: @nicefonts, @toolchain, @xorgupdate
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=native"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0 /var/lib/hsqldb"
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/splash /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=native"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--jobs=2 --with-bdeps=y --keep-going --complete-graph --load-average=1.5"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs candy collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch parallel-install preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe -march=native"
GENTOO_MIRRORS="http://gentoo.netnitco.net http://gentoo.osuosl.org/ http://gentoo.mirrors.tds.net/gentoo http://mirror.csclub.uwaterloo.ca/gentoo-distfiles/ http://gentoo.wetzlmayr.com/ http://osmirrors.cerias.purdue.edu/pub/gentoo/ http://www.cyberuse.com/gentoo/ http://gentoo.mirrors.hoobly.com/ ftp://gentoo.imj.fr/pub/gentoo/ http://130.59.10.35/ftp/mirror/gentoo/"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j2 -l1.5 -s"
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"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/sunrise /usr/local/portage"
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"
USE="X a52 aac aacplus aacs aalib acl acpi alsa amd64 amr avahi berkdb bidi bluetooth bluray branding btrfs bzip2 cairo cdda cddb cdio cdparanoia cdr cli consolekit cracklib crypt cups curl cvs cxx dbus declarative device-mapper dirac djvu dri dts dv dvd dvdr emboss encode exif faac fam fat ffmpeg firefox flac fontconfig fortran gdbm gif git gphoto2 gtk iconv idn ieee1394 imagemagick ipv6 java jbig joystick jpeg jpeg2k kde kipi lame lastfm lcms ldap libass libnotify libsamplerate live lua lzma lzo mad matroska mime mjpeg mms mmx mmxext mng modplug modules mp3 mp4 mpeg mudflap multilib musepack musicbrainz ncurses netlink nls nptl nsplugin ntfs ntp ogg openal openexr opengl openmp pam pango pcre pdf phonon plasma png policykit postproc ppds qalculate qt3support qt4 quicktime rar readline samba scanner schroedinger sdl semantic-desktop session smp sndfile sox speex spell sse sse2 sse3 ssl ssse3 startup-notification subversion svg symlink taglib tcpd telepathy theora tiff truetype twolame udev udisks unicode upower usb vcd vcdx vlm vnc vorbis vpx wavpack wicd wifi wmf wxwidgets x264 xa xcb xcomposite xinerama xml xscreensaver xv xvid xvmc zeroconf zlib" ABI_X86="64 32" 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" 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" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev keyboard mouse synaptics joystick" 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-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python3_3 python2_7" RUBY_TARGETS="ruby19 ruby18" SANE_BACKENDS="epson epson2" USERLAND="GNU" VIDEO_CARDS="nvidia nv" 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="3.3 2.7"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Robert Cabrera 2014-01-02 22:46:56 UTC
Created attachment 366798 [details]
build.log

Attached build.log
Comment 2 Johannes Hirte 2014-01-03 10:02:57 UTC
Seems to be a parallel-make problem. Restricting MAKEOPTS to -j1 works for me.
Comment 3 Robert Cabrera 2014-01-03 13:36:30 UTC
Unfortunately, setting MAKEOPTS="-j1" has no effect for me. It was the first thing I tried while troubleshooting. I just tried again with the same result.
Comment 4 Mike Auty (RETIRED) gentoo-dev 2014-01-04 23:17:22 UTC
This might be related to the way ilmbase was build.  I found the following oddity in ilmbase's pkgconfig file:

Libs: -L${libdir} -lImath -lHalf -lIex -lIexMath -lIlmThread -pthread

which when changed to:

Libs: -L${libdir} -lImath -lHalf -lIex -lIexMath -lIlmThread -lpthread

allowed openexr to compile without problem.  Note that the -pthread option was already present in the pkgconfig file in the cflags line:

Cflags: -pthread -I${OpenEXR_includedir}

The problem is, I can't determine how that -pthread at the end of that line is getting there.  It comes from ${PTHREAD_LIBS} in the configure script, but even when I regenerated the configure using eautoreconf, it still put the same value there...  Does anyone know autotools well enough to help me figure out where ${PTHREAD_LIBS} is populated from?
Comment 5 Mike Auty (RETIRED) gentoo-dev 2014-01-04 23:52:35 UTC
Created attachment 367024 [details, diff]
ilmbase-2.0.1-pthreads.patch

So, I tracked down the choice of -pthread over -lpthread to the m4/threads.m4 file (which is why autoreconf wasn't producing different results), so they package their own macros for figuring out what PTHREAD_LIBS should be.  This is the most trivial patch I could produce to push -lpthread higher in the priority list, which works, however I don't know enough about autoconf or pthreads to know why any of this is even a problem, so I've no idea whether this is the right fix or not.  Ideally, someone with more knowledge on the area could look further, if there were more than just ilmbase that this affected.

After applying the patch, eautoreconf has to be run as well...
Comment 6 Chris Slycord 2014-01-06 10:01:24 UTC
I get the same error with or without the above patch.
Comment 7 Mike Auty (RETIRED) gentoo-dev 2014-01-06 19:46:38 UTC
Chris, could you please check your /usr/lib{64,32}/pkgconfig/IlmBase.pc files to check whether they contain -lpthread, or just -pthread?  If they contained -pthread could you please check that you ran eautoreconf as well as applying the patch on ilmbase, and then after successfully compiling ilmbase, try recompiling openexr?
Comment 8 Chris Slycord 2014-01-07 09:34:25 UTC
Ok it worked. Thanks
Comment 9 Andrew Savchenko gentoo-dev 2014-01-07 20:13:38 UTC
Same problem here with ilmbase-2.0.1-r1 and openxr-2.0.1-r1.
Patch (with eautoreconf) works fine. Thanks. It'll be great to see this in tree.
Comment 10 Jeroen Roovers (RETIRED) gentoo-dev 2014-01-09 11:21:10 UTC
*** Bug 497612 has been marked as a duplicate of this bug. ***
Comment 11 Fernando (likewhoa) 2014-01-12 02:26:11 UTC
patch works for me on amd64 and x86, lets get this patch for media-libs/ilmbase in tree.
Comment 12 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-01-12 18:17:55 UTC
Comment on attachment 367024 [details, diff]
ilmbase-2.0.1-pthreads.patch

>diff --git a/m4/threads.m4 b/m4/threads.m4
>index 2213bb8..61ef252 100644
>--- a/m4/threads.m4
>+++ b/m4/threads.m4
>@@ -87,7 +87,7 @@ fi
> # which indicates that we try without any flags at all, and "pthread-config"
> # which is a program returning the flags for the Pth emulation library.
> 
>-acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
>+acx_pthread_flags="pthreads none -Kthread -kthread lthread pthread -pthread -pthreads -mthreads --thread-safe -mt pthread-config"

This is clearly wrong. This is a common autoconf macro, and the choices are in that order for a good reason (which I don't know but still).
Comment 13 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-01-12 18:34:04 UTC
Well, it's clearly a problem of ilmbase. libIlmThread should be linked to pthread but it doesn't get that linking for some reason. As a result, more strict linker refuses to link against incomplete libIlmThread.
Comment 14 Alex Turbov 2014-01-12 19:11:51 UTC
(In reply to Michał Górny from comment #13)
> Well, it's clearly a problem of ilmbase.
not quite ilmbase, but mostly libtool...
http://permalink.gmane.org/gmane.comp.gnu.libtool.patches/11704
Comment 15 Samuli Suominen (RETIRED) gentoo-dev 2014-01-14 09:02:41 UTC
CC base-system@ for Comment #14
Comment 16 Fernando (likewhoa) 2014-01-16 23:52:59 UTC
*** Bug 498296 has been marked as a duplicate of this bug. ***
Comment 17 David Kredba 2014-01-17 12:10:50 UTC
See please a list of maybe affected too packages:

find /usr/lib64/pkgconfig -type f -exec grep -H pthread {} \; |grep -v lpth| grep -v Cfla :

/usr/lib64/pkgconfig/fuse.pc:Libs: -L${libdir} -lfuse -pthread
/usr/lib64/pkgconfig/libxine.pc:Libs.private:  -lz -lresolv -lnsl  -pthread  -lrt
/usr/lib64/pkgconfig/gmodule-2.0.pc:Libs: -L${libdir} -Wl,--export-dynamic -lgmodule-2.0 -pthread
/usr/lib64/pkgconfig/gmodule-export-2.0.pc:Libs: -L${libdir} -Wl,--export-dynamic -lgmodule-2.0 -pthread
/usr/lib64/pkgconfig/plplotd-wxwidgets.pc:Libs: -L${libdir} -lplplotwxwidgetsd -lplplotd -lplplotcxxd -pthread -Wl,--as-needed -Wl,-O2 -Wl,-flto=4 -flto=4 -fuse-linker-plugin -O2 -ggdb -pipe -march=native -mtune=native -fno-lto -fno-use-linker-plugin -lwx_baseu-2.8 -lwx_gtk2u_core-2.8 -lagg -laggfontfreetype -lfreetype
/usr/lib64/pkgconfig/libwebpdecoder.pc:Libs.private: -lm -pthread
/usr/lib64/pkgconfig/libpcre.pc:Libs.private: -pthread
/usr/lib64/pkgconfig/libpcrecpp.pc:Libs.private: -pthread
/usr/lib64/pkgconfig/gmodule-no-export-2.0.pc:Libs: -L${libdir} -lgmodule-2.0 -pthread
/usr/lib64/pkgconfig/liblzma.pc:Libs.private: -pthread
/usr/lib64/pkgconfig/gthread-2.0.pc:Libs: -L${libdir} -lgthread-2.0 -pthread
/usr/lib64/pkgconfig/glib-2.0.pc:Libs.private: -pthread
/usr/lib64/pkgconfig/nice.pc:Libs: -L${libdir} -lnice -lgthread-2.0 -pthread -lgio-2.0 -lgobject-2.0 -lglib-2.0
/usr/lib64/pkgconfig/libusb-1.0.pc:Libs.private: -lrt -pthread
/usr/lib64/pkgconfig/libwebp.pc:Libs.private: -lm -pthread
/usr/lib64/pkgconfig/libpcreposix.pc:Libs.private: -pthread


That is probably why I can't link some application when I try them with LTO.
Comment 18 Samuli Suominen (RETIRED) gentoo-dev 2014-01-22 18:10:24 UTC
I have binutils-2.24 and gcc-4.8.x and I can't reproduce this bug. I first re-emerged ilmbase, just to be sure. It doesn't link against -pthread, which is expected as that information is coming from the pkg-config file which is enough:

$ pkg-config --cflags IlmBase
-pthread -I/usr/include/OpenEXR

Then I emerged openexr succesfully.
Comment 19 Samuli Suominen (RETIRED) gentoo-dev 2014-01-22 18:14:15 UTC

*** This bug has been marked as a duplicate of bug 462494 ***
Comment 20 Samuli Suominen (RETIRED) gentoo-dev 2014-01-23 11:21:31 UTC
bug 499028 was opened for libtool, yet I'm not sure it's the right thing to do :-/
why it works for some, and others not? what version of libtool are those people with failures using?
Comment 21 Samuli Suominen (RETIRED) gentoo-dev 2014-01-23 11:22:14 UTC
(In reply to Samuli Suominen from comment #20)
> bug 499028 was opened for libtool, yet I'm not sure it's the right thing to
> do :-/
> why it works for some, and others not? what version of libtool are those
> people with failures using?

Forgot to clarify. Working here with sys-devel/libtool-2.4.2 without adding any patch.
Comment 22 Samuli Suominen (RETIRED) gentoo-dev 2014-01-23 11:24:29 UTC
And are the people with failures using what `ld`? gold or not?

$ ld -v
GNU ld (GNU Binutils) 2.24
Comment 23 Alan McKinnon 2014-01-23 11:43:13 UTC
(In reply to Samuli Suominen from comment #22)
> And are the people with failures using what `ld`? gold or not?
> 
> $ ld -v
> GNU ld (GNU Binutils) 2.24

Mine is a new install on Jan 14. 
openexr now successfully builds after updating binutils from 2.24-r1 to 2.24-r2.
libtool has only ever been on 1 version on this machine - 2.4.2

USE has not changed.

[I] sys-devel/binutils
     Available versions:  (~)2.19.1-r1 2.20.1-r1 2.21.1-r1 2.22-r1 **2.22.52.0.4 (~)2.22.90 (~)2.23 2.23.1 2.23.2 **2.23.51.0.1 **2.23.51.0.2 **2.23.51.0.3 **2.23.51.0.5 **2.23.51.0.6 **2.23.51.0.7 **2.23.51.0.8 **2.23.51.0.9 **2.23.52.0.1 **2.23.52.0.2 (~)2.24-r2{tbz2} **2.24.51.0.1 **2.24.51.0.2 **9999 {cxx multislot multitarget nls static-libs test vanilla zlib}
     Installed versions:  2.24-r2{tbz2}(13:01:02 01/20/14)(cxx nls zlib -multislot -multitarget -static-libs -test -vanilla)
     Homepage:            http://sourceware.org/binutils/
     Description:         Tools necessary to build programs
Comment 24 Andrei Slavoiu 2014-01-23 11:46:25 UTC
This information is included in emerge --info, and it looks like the OP was using the same ld. I was probably using the same as well, not sure about the version but definatly not gold.

How about LDFLAGS="-Wl,-O1 -Wl,--as-needed"? This is what both the OP and I have in make.conf
Comment 25 Fernando (likewhoa) 2014-01-23 16:14:04 UTC
(In reply to Andrei Slavoiu from comment #24)
> This information is included in emerge --info, and it looks like the OP was
> using the same ld. I was probably using the same as well, not sure about the
> version but definatly not gold.
> 
> How about LDFLAGS="-Wl,-O1 -Wl,--as-needed"? This is what both the OP and I
> have in make.conf

'--as-needed' is default in Gentoo's LDFLAGS
Comment 26 Samuli Suominen (RETIRED) gentoo-dev 2014-01-23 16:47:50 UTC
http://permalink.gmane.org/gmane.comp.gnu.libtool.patches/11704 doesn't apply anymore to libtool 2.4+
i'm not convinced it's buggy at all yet, anyone hitting this, make sure to update sys-devel/libtool
Comment 27 Mike Auty (RETIRED) gentoo-dev 2014-01-23 23:44:00 UTC
I can no longer recreate this as of sys-devel/binutils-2.24-r2, libtool has not changed since the problem disappeared.
Comment 28 Jeroen Roovers (RETIRED) gentoo-dev 2014-01-27 17:20:08 UTC
*** Bug 499462 has been marked as a duplicate of this bug. ***
Comment 29 Samuli Suominen (RETIRED) gentoo-dev 2014-01-28 04:15:30 UTC
bug 499462, Comment #6 hints upgrading binutils to 2.24-r2 fixes things