Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 630578 - =dev-python/cryptography-2.0.3 is underlinking against pthread on powerpc64 : cryptography-2.0.3-python2_7/lib/cryptography/hazmat/bindings/_openssl.so: undefined symbol: pthread_atfork
Summary: =dev-python/cryptography-2.0.3 is underlinking against pthread on powerpc64 :...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 628670
  Show dependency tree
 
Reported: 2017-09-10 11:07 UTC by Sergei Trofimovich (RETIRED)
Modified: 2017-10-10 22:55 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,85.69 KB, text/x-log)
2017-09-10 11:07 UTC, Sergei Trofimovich (RETIRED)
Details
emerge --info (emerge--info.txt,5.16 KB, text/plain)
2017-09-10 11:07 UTC, Sergei Trofimovich (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sergei Trofimovich (RETIRED) gentoo-dev 2017-09-10 11:07:00 UTC
Created attachment 493704 [details]
build.log

...
powerpc64-unknown-linux-gnu-gcc -shared -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu -O2 -pipe -fdiagnostics-show-option -frecord-gcc-switches /dev/shm/portage/dev-python/cryptography-2.0.3/w
ork/cryptography-2.0.3-python3_4/temp.linux-ppc64-3.4/dev/shm/portage/dev-python/cryptography-2.0.3/work/cryptography-2.0.3-python3_4/temp.linux-ppc64-3.4/_openssl.o -L/usr/lib64 -lssl -lcryp
to -lpython3.4m -o /dev/shm/portage/dev-python/cryptography-2.0.3/work/cryptography-2.0.3-python3_4/lib/cryptography/hazmat/bindings/_openssl.abi3.so
...
>>> Source compiled.
>>> Test phase: dev-python/cryptography-2.0.3
 * python2_7: running distutils-r1_run_phase python_test
python-exec: Invalid impl in /etc/python-exec/python-exec.conf: python3.2
 * Unable to trace static ELF: /sbin/ldconfig: /sbin/ldconfig -p 
 * Unable to trace static ELF: /sbin/ldconfig: /sbin/ldconfig -p 
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/_pytest/config.py", line 373, in _importconftest
    mod = conftestpath.pyimport()
  File "/usr/lib64/python2.7/site-packages/py/_path/local.py", line 662, in pyimport
    __import__(modname)
  File "/usr/lib64/python2.7/site-packages/_pytest/assertion/rewrite.py", line 215, in load_module
    py.builtin.exec_(co, mod.__dict__)
  File "/usr/lib64/python2.7/site-packages/py/_builtin.py", line 221, in exec_
    exec2(obj, globals, locals)
  File "<string>", line 7, in exec2
  File "/dev/shm/portage/dev-python/cryptography-2.0.3/work/cryptography-2.0.3/tests/conftest.py", line 9, in <module>
    from cryptography.hazmat.backends.openssl import backend as openssl_backend
  File "/dev/shm/portage/dev-python/cryptography-2.0.3/work/cryptography-2.0.3-python2_7/lib/cryptography/hazmat/backends/openssl/__init__.py", line 7, in <module>
    from cryptography.hazmat.backends.openssl.backend import backend
  File "/dev/shm/portage/dev-python/cryptography-2.0.3/work/cryptography-2.0.3-python2_7/lib/cryptography/hazmat/backends/openssl/backend.py", line 53, in <module>
    from cryptography.hazmat.bindings.openssl import binding
  File "/dev/shm/portage/dev-python/cryptography-2.0.3/work/cryptography-2.0.3-python2_7/lib/cryptography/hazmat/bindings/openssl/binding.py", line 13, in <module>
    from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: /dev/shm/portage/dev-python/cryptography-2.0.3/work/cryptography-2.0.3-python2_7/lib/cryptography/hazmat/bindings/_openssl.so: undefined symbol: pthread_atfork
ERROR: could not load /dev/shm/portage/dev-python/cryptography-2.0.3/work/cryptography-2.0.3/tests/conftest.py
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2017-09-10 11:07:24 UTC
Created attachment 493706 [details]
emerge --info
Comment 2 Dan Kasak 2017-09-20 23:55:05 UTC
I have exactly the same issue on arm.
Comment 3 Kete Tefid 2017-09-29 13:00:47 UTC
Any solutions or workarounds?
I have the same problem on ARM64.
Comment 4 Mike Gilbert gentoo-dev 2017-09-30 00:02:42 UTC
On AMD64, libpthread gets pulled in by libpython. Is this somehow not the case on ARM64?
Comment 5 Stefan Umbreit 2017-10-09 04:42:09 UTC
Not sure if it helps, but this is the situation on my ARM system (armv7a-hardfloat-linux-gnueabi):

glibc-2.23-r4:

ls -l /lib/libpthread.so.0
/lib/libpthread.so.0 -> libpthread-2.23.so

nm /lib/libpthread-2.23.so |grep atfork
(nothing returned)

nm /usr/lib/libpthread_nonshared.a
pthread_atfork.oS:
         w __dso_handle
         U _GLOBAL_OFFSET_TABLE_
00000000 T __pthread_atfork
00000000 T pthread_atfork
         U __register_atfork

python-2.7.12:

ldd /usr/bin/python2.7
	libpython2.7.so.1.0 => /usr/lib/libpython2.7.so.1.0 (0xb6dcd000)
	libpthread.so.0 => /lib/libpthread.so.0 (0xb6dad000)
	libc.so.6 => /lib/libc.so.6 (0xb6c82000)
	libdl.so.2 => /lib/libdl.so.2 (0xb6c77000)
	libutil.so.1 => /lib/libutil.so.1 (0xb6c6b000)
	libm.so.6 => /lib/libm.so.6 (0xb6bf6000)
	/lib/ld-linux-armhf.so.3 (0xb6f57000)

So, libpthread.so.0 is pulled in by python but for some reason this shared library does not contain pthread_atfork.

On AMD64 I have:

nm /lib/libpthread-2.23.so |grep atfork
000000000000e6b0 t __dyn_pthread_atfork
000000000000e6b0 T pthread_atfork@GLIBC_2.2.5
                 U __register_atfork@@GLIBC_2.3.2

pthread_atfork is also present in /usr/lib/libpthread_nonshared.a .

(In reply to Mike Gilbert from comment #4)
> On AMD64, libpthread gets pulled in by libpython. Is this somehow not the
> case on ARM64?
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2017-10-09 06:35:51 UTC
Yes, I think it's precisely the issue. CFLAGS should contain -pthread to pull non-shared part explicitly.
Comment 7 Sergei Trofimovich (RETIRED) gentoo-dev 2017-10-09 15:34:51 UTC
(In reply to Sergei Trofimovich from comment #6)
> Yes, I think it's precisely the issue. CFLAGS should contain -pthread to
> pull non-shared part explicitly.

s/CFLAGS/LDFLAGS/
Comment 8 Mike Gilbert gentoo-dev 2017-10-09 20:08:30 UTC
Strangely, when I build this manually (outside of an ebuild), -pthread gets added automatically.

We'll need to figure out why that is getting lost in the ebuild environment.
Comment 9 Mike Gilbert gentoo-dev 2017-10-09 21:18:56 UTC
It looks like this is happening because we export the CC variable in the ebuild environment. This overrides the default python CC config var, which contains "-pthread".
Comment 10 Larry the Git Cow gentoo-dev 2017-10-09 21:33:13 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c824d1c44fcf4556de21d2c8b8ae3732b0fc0c5b

commit c824d1c44fcf4556de21d2c8b8ae3732b0fc0c5b
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2017-10-09 21:32:32 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2017-10-09 21:33:06 +0000

    dev-python/cryptography: append -pthread to CFLAGS
    
    This works around some weird distutils behavior when CC is set in the
    environment.
    
    Bug: https://bugs.gentoo.org/630578
    Package-Manager: Portage-2.3.11_p4, Repoman-2.3.3_p62

 dev-python/cryptography/cryptography-2.0.3.ebuild | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)}
Comment 11 Mike Gilbert gentoo-dev 2017-10-09 21:33:48 UTC
Please test and close the bug if all is well.
Comment 12 Stefan Langenmaier 2017-10-10 09:03:47 UTC
I'm not the reporter, but it solved the problem for me on arm.
Comment 13 Jan Beinersdorf 2017-10-10 17:46:43 UTC
Adding -pthread to my CFLAGS works for me, too, on -march=armv6j.
Comment 14 Sergei Trofimovich (RETIRED) gentoo-dev 2017-10-10 22:55:05 UTC
Pases tests on ppc/ppc64 now. Thank you!