[Libguestfs] Ocaml and pthread_atfork()

Tony Breeds tony at bakeyournoodle.com
Thu May 3 10:39:23 UTC 2012


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 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20120503/a44fd0ca/attachment.sig>


More information about the Libguestfs mailing list