You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 5636 Reporter: Richard Jones Status: closed (set by @xavierleroy on 2015-12-11T18:04:52Z) Resolution: fixed Priority: normal Severity: minor OS: Linux Version: 3.12.1 Fixed in version: 4.00.0+dev Category: configure and build/install Monitored by: "Richard Jones"
Bug description
On ppc/ppc64, when you link any bytecode threaded program, you'll get an error:
$ cat test.ml
let _ = Thread.create
$ ocamlc -thread unix.cma threads.cma test.ml -o test
File "test.ml", line 1, characters 0-1:
Error: Error on dynamically loaded library: /usr/lib64/ocaml/stublibs/dllthreads.so: /usr/lib64/ocaml/stublibs/dllthreads.so: undefined symbol: pthread_atfork
In glibc, the pthread_atfork symbol is handled specially -- it is statically linked into programs, unlike other pthread_* symbols which are dynamically linked. To see how this works, examine /usr/lib*/libpthread.so on a glibc system. Notice that it's a linker script which links the program with both libpthread.so.0 (the dynamic library) and libpthread_nonshared.a which is a static library containing just the pthread_atfork symbol.
dllthreads.so (the bytecode standard threads library in otherlibs/systhreads) is currently created like this:
$(MKLIB) -o threads $(BYTECODE_C_OBJS)
which means that it creates an external undefined reference to pthread_atfork:
$ nm dllthreads.so | grep pthread_atfork
U pthread_atfork
Including the static symbol in dllthreads.so (using explicit -lpthread to invoke the linker script) makes the problem go away:
$(MKLIB) -o threads $(BYTECODE_C_OBJS) -lpthread
$ nm dllthreads.so | grep pthread_atfork
0000000000003520 t __pthread_atfork
0000000000003520 t pthread_atfork
(Note that you only see this error on ppc. The x86-64 version of glibc contains a dynamic version of pthread_atfork, which is a bug in glibc!)
Original bug ID: 5636
Reporter: Richard Jones
Status: closed (set by @xavierleroy on 2015-12-11T18:04:52Z)
Resolution: fixed
Priority: normal
Severity: minor
OS: Linux
Version: 3.12.1
Fixed in version: 4.00.0+dev
Category: configure and build/install
Monitored by: "Richard Jones"
Bug description
On ppc/ppc64, when you link any bytecode threaded program, you'll get an error:
$ cat test.ml
let _ = Thread.create
$ ocamlc -thread unix.cma threads.cma test.ml -o test
File "test.ml", line 1, characters 0-1:
Error: Error on dynamically loaded library: /usr/lib64/ocaml/stublibs/dllthreads.so: /usr/lib64/ocaml/stublibs/dllthreads.so: undefined symbol: pthread_atfork
In glibc, the pthread_atfork symbol is handled specially -- it is statically linked into programs, unlike other pthread_* symbols which are dynamically linked. To see how this works, examine /usr/lib*/libpthread.so on a glibc system. Notice that it's a linker script which links the program with both libpthread.so.0 (the dynamic library) and libpthread_nonshared.a which is a static library containing just the pthread_atfork symbol.
dllthreads.so (the bytecode standard threads library in otherlibs/systhreads) is currently created like this:
which means that it creates an external undefined reference to pthread_atfork:
$ nm dllthreads.so | grep pthread_atfork
U pthread_atfork
Including the static symbol in dllthreads.so (using explicit -lpthread to invoke the linker script) makes the problem go away:
$ nm dllthreads.so | grep pthread_atfork
0000000000003520 t __pthread_atfork
0000000000003520 t pthread_atfork
(Note that you only see this error on ppc. The x86-64 version of glibc contains a dynamic version of pthread_atfork, which is a bug in glibc!)
For in-depth information, see this thread:
http://ryanarn.blogspot.co.uk/2011/07/curious-case-of-pthreadatfork-on.html
and "pthread_atfork on ppc64" here:
https://lists.fedoraproject.org/pipermail/ppc/2012-June/thread.html#1655
Steps to reproduce
See description.
Additional information
http://ryanarn.blogspot.co.uk/2011/07/curious-case-of-pthreadatfork-on.html
https://lists.fedoraproject.org/pipermail/ppc/2012-June/thread.html#1655
The text was updated successfully, but these errors were encountered: