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
Created attachment 366798 [details] build.log Attached build.log
Seems to be a parallel-make problem. Restricting MAKEOPTS to -j1 works for me.
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.
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?
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...
I get the same error with or without the above patch.
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?
Ok it worked. Thanks
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.
*** Bug 497612 has been marked as a duplicate of this bug. ***
patch works for me on amd64 and x86, lets get this patch for media-libs/ilmbase in tree.
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).
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.
(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
CC base-system@ for Comment #14
*** Bug 498296 has been marked as a duplicate of this bug. ***
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.
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.
*** This bug has been marked as a duplicate of bug 462494 ***
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?
(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.
And are the people with failures using what `ld`? gold or not? $ ld -v GNU ld (GNU Binutils) 2.24
(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
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
(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
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
I can no longer recreate this as of sys-devel/binutils-2.24-r2, libtool has not changed since the problem disappeared.
*** Bug 499462 has been marked as a duplicate of this bug. ***
bug 499462, Comment #6 hints upgrading binutils to 2.24-r2 fixes things