I tried to check my gentoo installation for indirect linked libraries and noticed that cmake forgot to link against pthread directly. It was tested with LDFLAGS="${LDFLAGS} -Wl,-O1 -Wl,--no-add-needed" Reproducible: Always Steps to Reproduce: 1. set LDFLAGS to -Wl,--no-add-needed 2. emerge cmake Actual Results: Linking CXX static library libCTestLib.a [ 91%] Built target CTestLib Scanning dependencies of target DumpDocumentation [ 91%] Building CXX object Source/CMakeFiles/DumpDocumentation.dir/cmDumpDocumentation.o Linking CXX executable ../bin/DumpDocumentation /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/bin/ld: �: invalid DSO for symbol `pthread_cancel@@GLIBC_2.2.5' definition /lib64/libpthread.so.0: could not read symbols: Bad value collect2: ld returned 1 exit status make[2]: *** [bin/DumpDocumentation] Error 1 make[1]: *** [Source/CMakeFiles/DumpDocumentation.dir/all] Error 2 make: *** [all] Error 2 [31;01m*[0m [31;01m*[0m ERROR: dev-util/cmake-2.6.2 failed. [31;01m*[0m Call stack: [31;01m*[0m ebuild.sh, line 49: Called src_compile [31;01m*[0m environment, line 2899: Called die [31;01m*[0m The specific snippet of code: [31;01m*[0m emake || die "emake failed."; [31;01m*[0m The die message: [31;01m*[0m emake failed. [31;01m*[0m [31;01m*[0m If you need support, post the topmost build error, and the call stack if relevant. [31;01m*[0m A complete build log is located at '/var/tmp/portage/dev-util/cmake-2.6.2/temp/build.log'. [31;01m*[0m The ebuild environment file is located at '/var/tmp/portage/dev-util/cmake-2.6.2/temp/environment'. [31;01m*[0m Portage 2.1.6 (default/linux/amd64/2008.0, gcc-4.3.2, glibc-2.9_p20081201-r0, 2.6.26-1-amd64 x86_64) ================================================================= System uname: Linux-2.6.26-1-amd64-x86_64-AMD_Athlon-tm-_64_X2_Dual_Core_Processor_4200+-with-gentoo-2.0.0 Timestamp of tree: Wed, 10 Dec 2008 10:06:01 +0000 app-shells/bash: 3.2_p48 dev-lang/python: 2.6-r5 dev-util/cmake: 2.6.2 sys-apps/baselayout: 2.0.0 sys-apps/openrc: 0.3.0-r1 sys-apps/sandbox: 1.2.18.1-r3 sys-devel/autoconf: 2.13, 2.63 sys-devel/automake: 1.5, 1.9.6-r2, 1.10.2 sys-devel/binutils: 2.19 sys-devel/gcc-config: 1.4.0-r4 sys-devel/libtool: 2.2.6a virtual/os-headers: 2.6.27-r2 ACCEPT_KEYWORDS="amd64 ~amd64" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d" CXXFLAGS="-O2 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch" GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo" LANG="en_US.UTF-8" LDFLAGS="-Wl,-O1 -Wl,-O1 -Wl,--no-add-needed" PKGDIR="/usr/portage/packages" 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/local/portage/layman/s3d" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="acl amd64 berkdb bzip2 cli cracklib crypt cups dri fortran gdbm gpm iconv ipv6 isdnlog midi minimal mmx mudflap multilib ncurses nls nptl nptlonly openmp pam pcre perl pppd python readline reflection session spl sse sse2 ssl sysfs tcpd unicode 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_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache 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" ELIBC="glibc" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, LINGUAS, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
hi sorry for the delay, but could you test it with 2.6.4? Compiles fine here with --as-needed :]
The parameter is --no-add-needed to test for missing direct linking of libraries. I will test it in some minutes
I get another error this time. Will check next week what goes wrong here: [ 89%] Building CXX object Source/CMakeFiles/CTestLib.dir/CTest/cmCTestSubmitHandler.o [ 89%] Building CXX object Source/CMakeFiles/CTestLib.dir/CTest/cmCTestTestCommand.o [ 90%] Building CXX object Source/CMakeFiles/CTestLib.dir/CTest/cmCTestTestHandler.o [ 90%] Building CXX object Source/CMakeFiles/CTestLib.dir/CTest/cmCTestUpdateCommand.o [ 91%] Building CXX object Source/CMakeFiles/CTestLib.dir/CTest/cmCTestUpdateHandler.o Linking CXX static library libCTestLib.a [ 91%] Built target CTestLib Scanning dependencies of target DumpDocumentation [ 91%] Building CXX object Source/CMakeFiles/DumpDocumentation.dir/cmDumpDocumentation.o Linking CXX executable ../bin/DumpDocumentation /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../x86_64-pc-linux-gnu/bin/ld: �: invalid DSO for symbol `pthread_cancel@@GLIBC_2.2.5' definition /lib64/libpthread.so.0: could not read symbols: Bad value collect2: ld returned 1 exit status make[2]: *** [bin/DumpDocumentation] Error 1 make[1]: *** [Source/CMakeFiles/DumpDocumentation.dir/all] Error 2 make: *** [all] Error 2
Sry, it seems that I was in a hurry. The error is the same and the problem is not fixed in 2.6.4
append-flags -pthread in src_configure() would workaround this, but there's multiple other LDFLAGS you can destroy your system with, where does it end? report this to upstream, thanks.
Why is there a gentoo bugtracker when I should report everything upstream? Why can't the maintainer of that package verify it as upstream bug and then forward it?
Why should we do your work. We fix bugs which are broken in OUR cmake implementation. Not the upstream bug. We might track it if it is important to us but otherwise the problem is troublesome for you so you should notify the autors of the issue. Do you expect cleaning company to call carpenters and replace your carpet when they find it damaged? Our work is to keep the carpet clean :]
Yeah, it's like -Wl,--no-undefined in a way, not something you'd enable in global scale but as an upstream, per package.