This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: O.T. linux thread library question


Robert Schweikert <rjschwei@cox.net> writes:

> Sorry for being O.T., but I hope someone can help.

There're glibc mailing lists, check http://sources.redhat.com/glibc
where this kind of question is appropriate.  Please continue any
discussion there.

> There is a bug in the linuxthread library that comes with glibc-2.2.4,
> which is used for the SuSE 7.3 distribution. The problem is a race
> condition when one call pthread_key_delete(). The problem has been
> fixed in glibc-2.2.5. Thus I figured I can just compile the thread
> library from 2.2.5 and use it. But that didn't work as expected.
>
> Here is what I did.
>
> - build glibc-2.2.5 and ran make check; no complaints
> - renamed libpthread.so from the linuxthreads directory to libnew_pthread.so

The library has an internal name, the LIbrary soname, check readelf -d
libnewpthread.so, it will still be called libpthread.so.0

> - stored the new library somewhere and tried to link against it
> instead of the system pthread library, this fails

That will never work with glibc.  You need to have libpthread, ld.so
and libc.so from exactly the same build.  So, there's no chance that
this works for you.  Install the complete glibc - or leave it.


>
> I used g++ -D_REENTRANT ..... -L/pathToTheNewLibrary -lnew_pthread

>
> but when I use ldd on the resulting executable I still see linkage to
> the system pthread library instead of the new library. Also odd is
> that ldd on the new library produces an error.
>
> /usr/bin/ldd: ./libnew_pthread.so: No such file or directory
>
> while ldd on the system pthread library produces sensible output.
>
> -> ldd libpthread.so
>  libc.so.6 => /lib/libc.so.6 (0x40026000)
>  /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
>
> The new thread library is recognized as a library
>
> -> file libnew_pthread.so
> libnew_pthread.so: ELF 32-bit LSB shared object, Intel 80386, version 1,
> not stripped
>
> Since I cannot depend on every user installing the latest version of
> the thread library and I don't want my code to crash I would like to
> package the new library with my app and set the LD_LIBRARY_PATH such
> that at runtime the new library is found. However, since I cannot get
> the linkage to the new library working this is a moot point.
>
> Any help on how to get this working is much appreciated.

Extract the fix for this from glibc 2.2.5, apply the patch to glibc
2.2.4, build glibc 2.2.4 the same way glibc was build before and then
install the libpthread somewhere and link your app against it with
setting the runpath (-Wl,-rpath).  Or let the users install glibc
2.2.5 themselves,

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]