Date: Thu, 11 Sep 2008 20:13:25 -0400 From: "Barry Andrews" <titanandrews@gmail.com> To: "Brooks Davis" <brooks@freebsd.org> Cc: freebsd-hackers@freebsd.org Subject: Re: loading multi threaded library into executable enabled for single thread Message-ID: <eda4c18b0809111713g98d4032i283321180d9525d0@mail.gmail.com> In-Reply-To: <20080911195653.GA53111@lor.one-eyed-alien.net> References: <eda4c18b0809111206t6438f87dmb8fab0db939c9980@mail.gmail.com> <20080911195653.GA53111@lor.one-eyed-alien.net>
next in thread | previous in thread | raw e-mail | index | archive | help
FreeBSD version 5.5 output of ldd for my lib is: libbase.so: libutils.so => ./libutils.so (0x287e0000) libACE.so.5.5.6 => ./libACE.so.5.5.6 (0x2882d000) libxerces-c.so.27 => ./libxerces-c.so.27 (0x28976000) libsqlite3.so.8 => ./libsqlite3.so.8 (0x28d23000) libboost_regex-gcc40-mt-d-1_34.so.1.34.0 => ./libboost_regex-gcc40-mt-d-1_34.so.1.34.0 (0x28d76000) libstdc++.so.6 => ./libstdc++.so.6 (0x28e82000) libm.so.3 => /lib/libm.so.3 (0x28f53000) libgcc_s.so.1 => ./libgcc_s.so.1 (0x28f6e000) libpthread.so.1 => /usr/lib/libpthread.so.1 (0x28f78000) libc.so.5 => /lib/libc.so.5 (0x28079000) output of ldd for tclsh is: libtcl84.so.1 => /usr/local/lib/libtcl84.so.1 (0x28076000) libm.so.3 => /lib/libm.so.3 (0x28114000) libc.so.5 => /lib/libc.so.5 (0x2812f000) On Thu, Sep 11, 2008 at 3:56 PM, Brooks Davis <brooks@freebsd.org> wrote: > On Thu, Sep 11, 2008 at 03:06:35PM -0400, Barry Andrews wrote: > > Hi All, > > > > I have a multi-threaded library that is linked against libpthread. When I > > load this lib into a tclsh process on FreeBSD, I get this error, "Recurse > on > > private mutex". and crash. I understand that I can have this issue when > the > > executable is not linked against libpthread but one of the loaded libs > is. > > Basically, it thinks it's in single threaded mode. > > > > I can get around this issue, by doing export LD_PRELOAD=libpthread.so.1, > > however this is a hack at best. Is there any other way to get around this > > issue other than linking tclsh with libpthread ( because that's not an > > option) > > > > I thought of re-building libpthread with the offending code commented > out, > > and that did work, however I ran into other issues, so I think it's not a > > very "safe" option. > > > > My feeling is that this is a FreeBSD issue because it's not happening on > > other platforms, Linux, Solaris. > > > > Any suggestions are welcome. Many thanks! > > It would be helpful if you could provide: > - your FreeBSD version > - the output of "ldd libyourlib.so" > - the output of "ldd yourprogram" > > I wouldn't be supprised to find that the program and library are linked > against > different threading libraries. If so, one of them will need to be relinked > or > you will need to use libmap.conf to cause it to use the other one. > > -- Brooks >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?eda4c18b0809111713g98d4032i283321180d9525d0>