> On Jan. 23, 2015, 10:42 p.m., Timothy St. Clair wrote: > > configure.ac, line 260 > > <https://reviews.apache.org/r/29595/diff/3/?file=819045#file819045line260> > > > > Do you have system details? > > > > Could you provide ldd and version of the system in question. > > Kapil Arya wrote: > BTW, I should have noticed it earlier, but it failed while making > benchmark executable. So, may be we don't need the flag for src/Makefile. > > ``` CXX benchmarks-benchmarks.o > CXXLD benchmarks > > /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: > skipping incompatible /usr/lib/librt.so when searching for -lrt > > /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: > skipping incompatible /usr/lib/libm.so when searching for -lm > > /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: > skipping incompatible /usr/lib/libc.so when searching for -lc > > /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: > ./.libs/libprocess.a(libprocess_la-io.o): undefined reference to symbol > 'pthread_sigmask@@GLIBC_2.2.5' > /lib64/libpthread.so.0: error adding symbols: DSO missing from command > line > collect2: error: ld returned 1 exit status > Makefile:614: recipe for target 'benchmarks' failed > make[5]: *** [benchmarks] Error 1 > make[5]: *** Waiting for unfinished jobs.... > make[5]: Leaving directory > '/home/kapil/mesos/modules/build/3rdparty/libprocess' > Makefile:1374: recipe for target 'check-am' failed > make[4]: *** [check-am] Error 2 > make[4]: Leaving directory > '/home/kapil/mesos/modules/build/3rdparty/libprocess' > Makefile:1086: recipe for target 'check-recursive' failed > make[3]: *** [check-recursive] Error 1 > make[3]: Leaving directory > '/home/kapil/mesos/modules/build/3rdparty/libprocess' > Makefile:475: recipe for target 'check-recursive' failed > make[2]: *** [check-recursive] Error 1 > make[2]: Leaving directory '/home/kapil/mesos/modules/build/3rdparty' > Makefile:624: recipe for target 'check' failed > make[1]: *** [check] Error 2 > make[1]: Leaving directory '/home/kapil/mesos/modules/build/3rdparty' > Makefile:663: recipe for target 'check-recursive' failed > make: *** [check-recursive] Error 1 > make took 35.2078492 seconds > ``` > > It's OpenSuse tumbleweed (13.2) with: > ``` > > > :~> uname -a > Linux Kapil-MBP.localdomain 3.17.2-1-desktop #1 SMP PREEMPT Fri Nov 7 > 15:18:21 UTC 2014 (bf63174) x86_64 x86_64 x86_64 GNU/Linux > $:~> gcc --version > gcc (SUSE Linux) 4.8.3 20140627 [gcc-4_8-branch revision 212064] > Copyright (C) 2013 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR > PURPOSE. > > $:~> /lib64/libc-2.20.so > GNU C Library (GNU libc) stable release version 2.20 (git b8079dd0d360), > by Roland McGrath et al. > Copyright (C) 2014 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. > There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A > PARTICULAR PURPOSE. > Configured for x86_64-suse-linux. > Compiled by GNU CC version 4.8.3 20140627 [gcc-4_8-branch revision > 212064]. > Available extensions: > crypt add-on version 2.1 by Michael Glad and others > GNU Libidn by Simon Josefsson > Native POSIX Threads Library by Ulrich Drepper et al > BIND-8.2.3-T5B > libc ABIs: UNIQUE IFUNC > For bug reporting instructions, please see: > <http://bugs.opensuse.org>. > ``` > > Timothy St. Clair wrote: > Maybe it's me, but it seems weird that you would want to link it for > everyone when it's pretty clearly a opensuse issue? > > Kapil Arya wrote: > Apparently, libpthread is needed for mesos. However, on some systems, the > compiler automatically links against it even though it was never explicitly > mentioned in LD_FLAGS. The correct behavior is to explicitely mention all > required libs on LD_FLAGS. I came across this proposal for Fedora > https://fedoraproject.org/wiki/UnderstandingDSOLinkChange . Looks like Fedora > is also moving in this direction to do explicit linkage and avoid indirect > linkage.
C++11 code which uses <thread> among other things is implicitly linked against pthreads. This works through a special weak linking. This implicit linking is broken when '--as-needed' is passed to the linker. Even if you force compile with -pthread with '--as-needed' sent to the linker (hard patched into it by default on some distros such as ubuntu[1]), in practice I've found it to make it unreliable whether or not the software ends up linked against pthreads (although that is another question). The --as-needed flag is broken w.r.t. this "soft" linking of pthreads, and exacerbated by a lot of platforms implicitly adding it as an option via compiler patches... Manually linking against pthreads fixes this on many platforms. At least one instance of the bug I know of: https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1228201 [1] https://wiki.ubuntu.com/ToolChain/CompilerFlags#A-Wl.2C--as-needed - Cody ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/29595/#review69495 ----------------------------------------------------------- On Jan. 13, 2015, 6:47 p.m., Kapil Arya wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/29595/ > ----------------------------------------------------------- > > (Updated Jan. 13, 2015, 6:47 p.m.) > > > Review request for mesos, Cody Maloney, Niklas Nielsen, Till Toenshoff, > Timothy Chen, and Timothy St. Clair. > > > Repository: mesos > > > Description > ------- > > When using system glog, linking fails with undefined > reference for pthread_* functions. > > > Diffs > ----- > > configure.ac acc685caa47717f0fb61a7c18572d7b763ec707b > > Diff: https://reviews.apache.org/r/29595/diff/ > > > Testing > ------- > > Ran ../configure --with-glog=/usr && make && make check > > > Thanks, > > Kapil Arya > >
