Re: RH8.0 Statically linked application gives error in 9.0 (cannot h andle file 'libc.so.6' with TLS data)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Muthu_T@xxxxxxxx wrote:

All,

I wrote and compiled the following test program in RH8.0 as statically
linked executable.
The executable works fine in 8.0 but fails in 9.0 with following error:

cannot handle file 'libc.so.6' with TLS data



This is the same problem that you had before -- the libraries that the executable are linked with are incompatible with the libraries that libz is linked with. In this case the incompatability is between two different versions of libc which causes problems. "TLS data" is "thread-local storage" data and that's where the problem lies -- one of the big changes for NPTL is the way that thread-local storage is handled.


You can't work around this. Well, you can -- you can install the RH8 libz and libc, but that'll break *everything*.

A possibly better approach is to link the program "semi-static". I've done this in the past to get around various problems. There's a "-shared-libgcc" flag for gcc which might do the trick. I forget the flags, but you can fine-control which libraries are static and which are dynamic. I know it's a very long time since I tried to use a static libc (or glibc) because stuff breaks when you go from one version to another. Except on HP/UX ... that elevates binary compatability to high art.

Please don't start GPL/LGPL issues. I don't want to go for dynamic
linking for some reasons.


Wouldn't dream of it :-)

Any ideas or workarounds?

Thanks.

--T. Muthu Mohan

-----[ mystatic.cpp ]----------------

#include <iostream.h>
#include <dlfcn.h>

#define LIBNAME "libz.so" // you can use any shared library instead of
'libz.so'


int main()
{
       void *pHandle = dlopen(LIBNAME, RTLD_NOW);
       cout << "After Loading " << LIBNAME << endl << dlerror() <<
endl;
       if (pHandle) {
               cout << "Loaded Successfully!" << endl;
               dlclose(pHandle);
               cout << "Unloaded Successfully!" << endl;
       }
       return 0;
}

-----[ output in RH8.0 ] --------------------

# g++ -static mystatic.cpp  -ldl
# ./a.out
After Loading libz.so
(null)
Loaded Successfully!
Unloaded Successfully!

----[ output in RH 9.0 ] --------------------------
# ./a.out
After Loading libz.so
cannot handle file 'libc.so.6' with TLS data







-- Shrike-list mailing list Shrike-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/shrike-list

[Index of Archives]     [Fedora Users]     [Centos Users]     [Kernel Development]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat Phoebe Beta]     [Yosemite Forum]     [Fedora Discussion]     [Gimp]     [Stuff]     [Yosemite News]

  Powered by Linux