summaryrefslogtreecommitdiff
path: root/open_issues/libpthread_dlopen.mdwn
blob: 0d3628ec8786f2338f5b1dbbfaa0505bf54b183e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
[[!meta copyright="Copyright © 2011 Free Software Foundation, Inc."]]

[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable
id="license" text="Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no Invariant
Sections, no Front-Cover Texts, and no Back-Cover Texts.  A copy of the license
is included in the section entitled [[GNU Free Documentation
License|/fdl]]."]]"""]]

[[!tag open_issue_libpthread]]

IRC, OFTC, #debian-hurd, 2011-07-21.

    <youpi> there's one known issue with pthreads
    <youpi> you can't dlopen() it

... if the main application is not already linked against it.

    <youpi> which also means you can't dlopen() a module which depends on it if
      the main application hasn't used -lpthread already
    <youpi> (so as to get libpthread initialized early, not at the dlopen()
      call)
    <lucas> I get this while building simgrid:
    <lucas> cd /home/lucas/simgrid-3.6.1/obj-i486-gnu/examples/gras/console &&
      /usr/bin/cmake -E create_symlink
      /home/lucas/simgrid-3.6.1/obj-i486-gnu/lib/libsimgrid.so
      /home/lucas/simgrid-3.6.1/obj-i486-gnu/examples/gras/console/simgrid.so
    <lucas> cd /home/lucas/simgrid-3.6.1/obj-i486-gnu/examples/gras/console &&
      lua /home/lucas/simgrid-3.6.1/examples/gras/console/ping_generator.lua
    <lucas> lua:
      /home/buildd/build/chroot-sid/home/buildd/byhand/hurd/./libpthread/sysdeps/generic/pt-mutex-timedlock.c:68:
      __pthread_mutex_timedlock_internal: Assertion `__pthread_threads' failed.
    <lucas> Aborted (core dumped)
    <youpi> that's it, yes
    <youpi> (or at least it has the same symptoms)
    <lucas> it would need fixing in lua, not in SG, then, right?
    <youpi> yes
    <lucas> ok, thanks

The fix thus being: link the main application with -lpthread.

The same symptom appears in an odd case, for instance:


    buildd@hurd:~$ ldd /usr/bin/openjade
            libthreads.so.0.3 => /lib/libthreads.so.0.3 (0x0103d000)
            libosp.so.5 => /usr/lib/libosp.so.5 (0x01044000)
            libpthread.so.0.3 => /lib/libpthread.so.0.3 (0x01221000)
            libnsl.so.1 => /lib/i386-gnu/libnsl.so.1 (0x01232000)
    [...]

openjade links against *both* libthreads and libpthread. The result is that libc
early-initializes libthreads only, and thus libpthread is not early-initialized,
and later on raises assertions. The solution is to just get rid of libthreads,
to have only one threading library.