Re: [Libguestfs] Ocaml and pthread_atfork()
On Thu, May 03, 2012 at 02:00:27PM +1000, Tony Breeds wrote:
Hi All, Firstly I apologize if this is noise. I elected to not file a bugzilla as the problem seems to be powerpc specific and with the limited resources for Fedora developers it would seem unfair.
I was recently trying to build a "current" libguestfs from the f16 branch[1]. During the build I hit:
(extracted from rpmbuild)
[tony@sneetch ~]$ bash -x tmp/ocaml-test.sh + cd rpmbuild/BUILD/libguestfs-1.16.9/ocaml/ + LD_LIBRARY_PATH=../src/.libs + ocamlfind ocamlc -g -warn-error CDEFLMPSUVYZX -I . -package unix,threads -thread -linkpkg mlguestfs.cma t/guestfs_070_threads.cmo -o t/guestfs_070_threads.bc File "_none_", 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
I did a quick bit of googling and found: http://ryanarn.blogspot.com.au/2011/07/curious-case-of-pthreadatfork-on.html
which seems to explain what's going on to my naive eye anyway.
I've tried a few different CFLAGS/patches to otherlibs/systhreads/Makefile to try and induce pthreads_atfork() to be resolved and linked during the ocaml build. Nothing I try works.
Does anyone have any ideas on how to solve this?
I'm happy to do the heavy lifting I just don't have the background in ocaml to solve this by myself.
Yours Tony
[1] I suspects that as a result of the demotion to secondary and things languishing there we skipped a few builds.
It looks like the PPC64 OCaml package is buggy. Can you compile any threaded program at all, eg: echo 'print_endline "hello"' > test.ml ocamlfind c -package threads -thread test.ml -linkpkg -o test ./test Unfortunately I don't have access to ppc64, so there's no way I can even look at bugs in this area, let alone fix them. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/
On Thu, May 03, 2012 at 08:52:25AM +0100, Richard W.M. Jones wrote:
On Thu, May 03, 2012 at 02:00:27PM +1000, Tony Breeds wrote:
Hi All, Firstly I apologize if this is noise. I elected to not file a bugzilla as the problem seems to be powerpc specific and with the limited resources for Fedora developers it would seem unfair.
I was recently trying to build a "current" libguestfs from the f16 branch[1]. During the build I hit:
(extracted from rpmbuild)
[tony@sneetch ~]$ bash -x tmp/ocaml-test.sh + cd rpmbuild/BUILD/libguestfs-1.16.9/ocaml/ + LD_LIBRARY_PATH=../src/.libs + ocamlfind ocamlc -g -warn-error CDEFLMPSUVYZX -I . -package unix,threads -thread -linkpkg mlguestfs.cma t/guestfs_070_threads.cmo -o t/guestfs_070_threads.bc File "_none_", 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
I did a quick bit of googling and found: http://ryanarn.blogspot.com.au/2011/07/curious-case-of-pthreadatfork-on.html
which seems to explain what's going on to my naive eye anyway.
I've tried a few different CFLAGS/patches to otherlibs/systhreads/Makefile to try and induce pthreads_atfork() to be resolved and linked during the ocaml build. Nothing I try works.
Does anyone have any ideas on how to solve this?
I'm happy to do the heavy lifting I just don't have the background in ocaml to solve this by myself.
Yours Tony
[1] I suspects that as a result of the demotion to secondary and things languishing there we skipped a few builds.
It looks like the PPC64 OCaml package is buggy. Can you compile any threaded program at all, eg:
echo 'print_endline "hello"' > test.ml ocamlfind c -package threads -thread test.ml -linkpkg -o test ./test
No no OCaml threaded apps compile.
Unfortunately I don't have access to ppc64, so there's no way I can even look at bugs in this area, let alone fix them.
Firstly thank you for the reply. Yes the PPC package is Buggy, The breakage isn't limited to Fedora it (IMO) is an upstream bug as the link stage in otherlibs/systhreads isn't being done against /usr/lib64/libpthreads.so.0 but rather /lib64/libpthreads This results in the pthreads_atfork() symbol never being resolved. I'm not asking you to fix it, as I stated in my message I'm happy to do that. I was just hoping that someone more familier with the Ocaml build process would be able to suggext some ideas or alternate lines of thought. I'm happy to talk to the OCaml upstream to get this fixed there if you can't suggest anything. For instance can you see at what stage pthread_atfork() is resuloved in an intel build? Yours Tony
On Thu, May 03, 2012 at 08:39:23PM +1000, Tony Breeds wrote:
Yes the PPC package is Buggy, The breakage isn't limited to Fedora it (IMO) is an upstream bug as the link stage in otherlibs/systhreads isn't being done against /usr/lib64/libpthreads.so.0 but rather /lib64/libpthreads This results in the pthreads_atfork() symbol never being resolved.
I don't understand why this would make a difference. Anyhow, there are several OCaml threads tests, but they are not required in order for libguestfs to build or work successfully, so you could just comment those out of the build. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
I just hit this bug too. Seems to be a problem (or weirdness) in glibc. See: http://ryanarn.blogspot.co.uk/2011/07/curious-case-of-pthreadatfork-on.html https://lists.fedoraproject.org/pipermail/ppc/2012-June/001655.html Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
On Sat, Jun 02, 2012 at 12:41:28PM +0100, Richard W.M. Jones wrote:
I just hit this bug too. Seems to be a problem (or weirdness) in glibc. See:
http://ryanarn.blogspot.co.uk/2011/07/curious-case-of-pthreadatfork-on.html
Yes I included that URL in my original message.
https://lists.fedoraproject.org/pipermail/ppc/2012-June/001655.html
Thanks for following it up. Yours Tony
participants (2)
-
Richard W.M. Jones -
Tony Breeds