question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Compilation failure due to missing symbol pthread_atfork

See original GitHub issue

#10614 introduced usage of pthread_atfork if the pthread header was found. However this requires adding -lpthread or -pthread to the compiler flags so the symbols can be found.

This kinda works on x86 platforms because Python is usually build with pthreads already and the dynamic library contains all the symbols. However on e.g. Power9 libpthread is a linker script contained a static part which contains e.g. pthread_atfork which does now not get linked and hence usage fails with

File "/tmp/easybuild-tmp/eb-QqGzOJ/tmp81X11X/lib/python3.7/site-packages/scipy/__init__.py", line 156, in <module>
  from . import fft
File "/tmp/easybuild-tmp/eb-QqGzOJ/tmp81X11X/lib/python3.7/site-packages/scipy/fft/__init__.py", line 81, in <module>
  from ._helper import next_fast_len
File "/tmp/easybuild-tmp/eb-QqGzOJ/tmp81X11X/lib/python3.7/site-packages/scipy/fft/_helper.py", line 4, in <module>
  from . import _pocketfft
File "/tmp/easybuild-tmp/eb-QqGzOJ/tmp81X11X/lib/python3.7/site-packages/scipy/fft/_pocketfft/__init__.py", line 3, in <module>
  from .basic import *
File "/tmp/easybuild-tmp/eb-QqGzOJ/tmp81X11X/lib/python3.7/site-packages/scipy/fft/_pocketfft/basic.py", line 8, in <module>
  from . import pypocketfft as pfft
ImportError: /tmp/easybuild-tmp/eb-QqGzOJ/tmp81X11X/lib/python3.7/site-packages/scipy/fft/_pocketfft/pypocketfft.cpython-37m-powerpc64le-linux-gnu.so: undefined symbol: pthread_atfork
(at easybuild/tools/run.py:529 in parse_cmd_output)

Proposed solution: Add -pthread or -lpthread to the link flags.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
peterbell10commented, Jan 13, 2020

That’s find @Flamefire. I think we’ve adequately diagnosed the problem without the log.

0reactions
Flamefirecommented, Jan 13, 2020

@peterbell10 As the logs are gone and recreating them takes a couple hours: Do you still need the logs? IMO my analysis above is complete and #11324 fixes the problem so I don’t know of what help the logs would be.

Read more comments on GitHub >

github_iconTop Results From Across the Web

undefined symbol: pthread_atfork #2987 - xianyi/OpenBLAS
Hello, I'm using dlib library and when added to dlib support for openblas I'm getting when import dlib: Python 3.5.3 (default, Nov 10...
Read more >
pthread_atfork fails to compile when declaring -nostartfiles
Your problem is that the outer wrapper function pthread_atfork seems to have been moved to libpthread_nonshared.a so that it can identify ...
Read more >
Library symbol mismatch for pthread_atfork | Ars OpenForum
When we compile against the shared libraries for IPP using 4.8.2 and when certain IPP functions are invoked, we get an undefined reference ......
Read more >
Solved: undefined reference to `pthread_atfork
I compile a program and the compiler shows me this error: ... I open the libpthread.log file and search the 'pthread_atfork' symbol.
Read more >
[yocto] Python cryptography failing due to undefined symbol
undefined symbol : pthread_atfork. Have tried both the recipe that comes with Rocko and master of meta-openembedded.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found