On Thu, Jan 24, 2019 at 01:09:52AM +0300, Dmitry V. Levin wrote: > On Wed, Jan 23, 2019 at 09:14:30PM +0000, Richard W.M. Jones wrote: > > On Thu, Jan 24, 2019 at 12:03:21AM +0300, Dmitry V. Levin wrote: > > > Hi, > > > > > > On Wed, Jan 23, 2019 at 08:45:06PM +0000, Richard W.M. Jones wrote: > > > > On Wed, Jan 23, 2019 at 09:01:19PM +0100, Bruno Haible wrote: > > > [...] > > > > I checked the history of the Fedora package which adds these flags, and > > > > it seems like --as-needed was added for: > > > > > > > > https://fedoraproject.org/wiki/Changes/RemoveExcessiveLinking > > > > > > > > Removing -Wl,--as-needed fixes the problem. However I'm still unclear > > > > about this. Is Fedora wrong? Is hivex using gnulib wrongly? Is > > > > gnulib wrong? > > > > > > We also build everything with --as-needed by default, but > > > gnulib does the right thing nowadays by using > > > -Wl,--push-state -Wl,--no-as-needed -lpthread -Wl,--pop-state > > > instead of plain -lpthread. > > > > hivex is using a very recent gnulib (34290cb926). > > > > The test is linked with: > > > > /bin/sh ../../libtool --tag=CC --preserve-dup-deps --mode=link gcc -O2 > > -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 > > -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong > > -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 > > -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic > > -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection > > -Wl,-z,relro -Wl,--as-needed -Wl,-z,now > > -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -o test-thread_create > > test-thread_create.o libtests.a ../../gnulib/lib/libgnu.la libtests.a > > -pthread -Wl,--push-state -Wl,--no-as-needed -lpthread -Wl,--pop-state > > > > As you can see from the last bit, the --push-state ... --pop-state > > seems correct. Yet the test still fails. > > I see libtool is involved, and libtool is known to reorder arguments > in a very unhelpful way. Could you show the actual link command invoked > by libtool, please? I expect to see something like > -Wl,--push-state -Wl,--no-as-needed -Wl,--pop-state ... -lpthread > which doesn't make sense.
I've posted the entire build/check with V=1 here: http://oirase.annexia.org/tmp/2019-01-gnulib-hivex.txt If you grep through that for "test-thread_create" you should find the appropriate lines. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v