symbol lookup error: ./libproxychains4.so: undefined symbol: pthread_once
Hello. I am having issues with wget & proxychains4 on Ubuntu:
$ proxychains4 -f /var/storage/random.conf wget -qO- http://ipecho.net/plain ; echo [proxychains] config file found: /var/storage/random.conf [proxychains] preloading ./libproxychains4.so wget: symbol lookup error: ./libproxychains4.so: undefined symbol: pthread_once
Ping works just fine:
$ proxychains4 -f /var/storage/random.conf ping google.com [proxychains] config file found: /var/storage/configs/random-mixed-pool.conf [proxychains] preloading ./libproxychains4.so PING google.com (173.194.67.101) 56(84) bytes of data. 64 bytes from wi-in-f101.1e100.net (173.194.67.101): icmp_seq=1 ttl=49 time=22.0 ms 64 bytes from wi-in-f101.1e100.net (173.194.67.101): icmp_seq=2 ttl=49 time=22.0 ms 64 bytes from wi-in-f101.1e100.net (173.194.67.101): icmp_seq=3 ttl=49 time=21.8 ms 64 bytes from wi-in-f101.1e100.net (173.194.67.101): icmp_seq=4 ttl=49 time=23.0 ms 64 bytes from wi-in-f101.1e100.net (173.194.67.101): icmp_seq=5 ttl=49 time=24.8 ms 64 bytes from wi-in-f101.1e100.net (173.194.67.101): icmp_seq=6 ttl=49 time=22.0 ms ^C --- google.com ping statistics --- 6 packets transmitted, 6 received, 0% packet loss, time 5006ms rtt min/avg/max/mdev = 21.891/22.659/24.826/1.063 ms
To install, I cloned this git repo, and ran the following as advised:
sudo ./configure --prefix=/usr --sysconfdir=/etc sudo make sudo make install sudo make install-config
There were no errors returned.
uname -a Linux lemon 2.6.32-042stab094.7 #1 SMP Wed Oct 22 12:43:21 MSK 2014 x86_64 x86_64 x86_64 GNU/Linux
$ nm /lib/libpthread_.so | grep pthread_once nm: '/lib/libpthread_.so': No such file
$ for i in /lib /lib32 /lib64 ; do
find $i -name 'libpthread_.so_' find /usr/$i -name 'libpthread_.so_' done /lib/x86_64-linux-gnu/libpthread-2.19.so /lib/x86_64-linux-gnu/libpthread.so.0 /usr//lib/x86_64-linux-gnu/libpthread.so find:
/lib32': No such file or directory find:/usr//lib32': No such file or directory find: `/usr//lib64': No such file or directory
$ objdump -T /lib/x86_64-linux-gnu/libpthread-2.19.so | grep pthread_once 000000000000da40 g DF .text 0000000000000070 GLIBC_2.2.5 pthread_once 000000000000da40 g DF .text 0000000000000070 GLIBC_2.2.5 __pthread_once $ objdump -T /lib/x86_64-linux-gnu/libpthread.so.0 | grep pthread_once 000000000000da40 g DF .text 0000000000000070 GLIBC_2.2.5 pthread_once 000000000000da40 g DF .text 0000000000000070 GLIBC_2.2.5 __pthread_once $ objdump -T /usr//lib/x86_64-linux-gnu/libpthread.so | grep pthread_once objdump: /usr//lib/x86_64-linux-gnu/libpthread.so: File format not recognized
$ ldd which wget
linux-vdso.so.1 => (0x00007fff789fe000)
libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007f537b571000)
libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007f537b196000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f537af7c000)
libidn.so.11 => /usr/lib/x86_64-linux-gnu/libidn.so.11 (0x00007f537ad49000)
libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f537ab44000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f537a77e000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f537a57a000)
/lib64/ld-linux-x86-64.so.2 (0x00007f537b7d8000)
Any ideas what's wrong? Do I have to change something in the Makefile for it to work on my system?
Same problem here
When compiled in CentOS 7, everything is OK and proxychains4 runs fine
but in Ubuntu 14.10, compilation is OK, but when I ran any program, all results as: symbol lookup error: ./libproxychains4.so: undefined symbol: pthread_once
If I change the lpthread to pthread, then results like this: symbol lookup error: ./libproxychains4.so: undefined symbol: dlsym
have no idea how to change the compile option
in Makefile line 85
change to:
$(CC) -shared $(LDFLAGS) $(LD_SET_SONAME)$(LDSO_PATHNAME) -lpthread $(LIBDL) -o $@ $(LOBJS)
@jackyzy823 THX so much!
Now everything works as the original proxychains3 does
Thank you @jackyzy823 !
This has solved the issue for me too.
You may google gcc link order for more detail and further understanding. :-)
@jackyzy823 care to create a pull request with your fix ?
This just breaks the linking on archlinux using gcc5. $(CC) -shared -lpthread $(LIBDL) $(LDFLAGS) $(LD_SET_SONAME)$(LDSO_PATHNAME) -o $@ $(LOBJS) works fine.
@proudzhu how weird. are you using the latest commit? and please paste output of the make invocation including the error.
I'm using release 4.9.
the output of running proxychains ls
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/libproxychains4.so
ls: symbol lookup error: /usr/lib/libproxychains4.so: undefined symbol: pthread_once
but running proxychains curl *** is fine.
revert this commit https://github.com/rofl0r/proxychains-ng/commit/377b474b40bb34fde018301294e02850dac928fe, everything works.
I think it is related with gcc versions, maybe they change some default behaviours during gcc updates.
@Kieters @jryaonj Can you provides your gcc versions?
And the PKGBUILD is here proxychains-ng
@proudzhu try to revert e79e05a228558e95ee2d3e7cfffd9bbe1e4a368e as well. does that work ? this commit seems to be the original cause of the regression
@rofl0r
Finally I found that I have "--as-needed" in my local LDFLAGS, it is set in the default makepkg.conf which will be loaded when building a package in archlinux.
Then I found this wiki, in section "Fixing problems with --as-needed", it says "libraries don't create problems, because they are allowed to have undefined symbols".
So in my system, $(CC) -shared -lpthread $(LIBDL) $(LDFLAGS) $(LD_SET_SONAME)$(LDSO_PATHNAME) -o $@ $(LOBJS) works, but $(CC) -shared $(LDFLAGS) $(LD_SET_SONAME)$(LDSO_PATHNAME) -lpthread $(LIBDL) -o $@ $(LOBJS) fails.
Maybe we should move "-lpthread $(LIBDL)" before $(LDFLAGS).
But I cannot figure out why the other users in the post failed to link against libpthread.
If it is a gcc link order issue as @jackyzy823 says ( but I'm confused as there is not other library in the argument), maybe we could change to
$(CC) -shared $(LD_SET_SONAME)$(LDSO_PATHNAME) -lpthread $(LIBDL) $(LDFLAGS) -o $@ $(LOBJS)?
The package proxychains-ng 4.9-1 I installed from the Arch Linux repository also throws out the error below when I run proxychains firefox
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/libproxychains4.so
sh: symbol lookup error: /usr/lib/libproxychains4.so undefined symbol: pthread_once
But the version proxychains-ng 4.8.1-1 works fine.
rather than putting more ducttape (#65) on the broken linker command line, i reverted the original commit that introduced the breakage by shuffling the ld arguments around, and the following fixup by @jackyzy823, and introduced a clean way to deal with user-supplied LDFLAGS. please check if that fixes your issues.
@rofl0r it works now, thanks.