Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 802252

Summary: net-libs/libasyncns - undefined reference to pthread_join
Product: Gentoo Linux Reporter: Einstok Fair <einfair>
Component: Current packagesAssignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it <maintainer-needed>
Status: RESOLVED INVALID    
Severity: normal CC: ionen, mscardovi, sam
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://gist.githubusercontent.com/EinstokFair/0579c6e307fbd53332978e54733922ab/raw/aad9a738d7d4c40c3d68fc442573403364146992/vartmpportagenet-libslibasyncns-0.8-r4tempbuild.log
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: build.log
emerge --info
config.log

Description Einstok Fair 2021-07-15 09:05:05 UTC
/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: .libs/asyncns.o: in function `asyncns_free':
asyncns.c:(.text+0xb38): undefined reference to `pthread_join'
/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: .libs/asyncns.o: in function `asyncns_new':
asyncns.c:(.text+0xd57): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:447: libasyncns.la] Error 1
make[2]: Leaving directory '/var/tmp/portage/net-libs/libasyncns-0.8-r4/work/libasyncns-0.8-abi_x86_64.amd64/libasyncns'
Comment 3 Einstok Fair 2021-07-15 09:18:22 UTC
Created attachment 723985 [details]
build.log
Comment 4 Einstok Fair 2021-07-15 09:19:20 UTC
Created attachment 723988 [details]
emerge --info
Comment 6 Ionen Wolkens gentoo-dev 2021-07-16 16:37:36 UTC
>checking whether pthreads work without any flags... yes
I can't reproduce, but comparing with my own configure output this is where it diverges. Mine fails this test, and later appropriately adds -pthread flag.

Your config.log may have a hint as to what happened, i.e.
/var/tmp/portage/net-libs/libasyncns-0.8-r4/work/libasyncns-0.8-abi_x86_64.amd64/config.log or so
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-07-16 19:02:45 UTC
(In reply to Ionen Wolkens from comment #6)
> >checking whether pthreads work without any flags... yes
> I can't reproduce, but comparing with my own configure output this is where
> it diverges. Mine fails this test, and later appropriately adds -pthread
> flag.
> 
> Your config.log may have a hint as to what happened, i.e.
> /var/tmp/portage/net-libs/libasyncns-0.8-r4/work/libasyncns-0.8-abi_x86_64.
> amd64/config.log or so

Right, I did ask about this on IRC. Could you please try without your set LDFLAGS too? And depclean/select newer binutils?
Comment 9 Ionen Wolkens gentoo-dev 2021-07-16 22:07:32 UTC
Seem to be two things needed to reproduce this.

1. have libnsl installed (checks for it but discarded by --as-needed)
2. LDFLAGS="-Wl,--copy-dt-needed-entries"

I guess #2 copies libnsl's needed and misleads configure into thinking it doesn't need -pthread.

(In reply to Sam James from comment #7)
> [...] Could you please try without your set LDFLAGS too? [...]
Comment 10 Einstok Fair 2021-07-16 22:18:20 UTC
I removed previous and other versions of binutils:

# eselect binutils list
 [1] x86_64-pc-linux-gnu-2.36.1 *
#

but the error is still here after source /etc/profile and remerge.

I don't understood the sentence about LDFLAGS, trying to figure out it.
Comment 11 Ionen Wolkens gentoo-dev 2021-07-16 22:25:19 UTC
(In reply to Einstok Fair from comment #10)
> I don't understood the sentence about LDFLAGS, trying to figure out it.
You appear to be setting LDFLAGS="-Wl,--copy-dt-needed-entries" somewhere, likely in your /etc/portage/make.conf or similar.

Is it your intention to set this? The idea would be to remove this and use defaults.
Comment 12 Einstok Fair 2021-07-16 22:39:32 UTC
Without LDFLAGS it compiles,
but i don't remember why I did added that flag globally (probably removing it will break something else).
Comment 13 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-07-16 22:41:20 UTC
(In reply to Einstok Fair from comment #12)
> Without LDFLAGS it compiles,
> but i don't remember why I did added that flag globally (probably removing
> it will break something else).

You shouldn't need it at all but *if* you do:
1. let's investigate it together
2. let's set it per-package via package.env (https://wiki.gentoo.org/wiki//etc/portage/package.env#Example_1:_Enable_debug_information_for_a_specific_package)