libc NPTL/TLS & Wine


Forum: DSL Ideas and Suggestions
Topic: libc NPTL/TLS & Wine
started by: stupid_idiot

Posted by stupid_idiot on Oct. 08 2007,02:29
Re:
Code Sample
wine: glibc >= 2.3 without NPTL/TLS is not a supported combination. It will most likely crash. Please upgrade to a glibc with NPTL support.

In a previous thread, I suggested fixing this by building glibc with TLS enabled. However, someone pointed out that TLS needs kernel 2.6. So we assumed that Wine cannot work properly with kernel 2.4.
But: In Debian Sarge, the 'libc6' package was built with TLS support, even though the default kernel is 2.4.27 (no TLS support). Perhaps glibc [with TLS] lets TLS programs be backward-compatible with kernel 2.4 [linuxthreads].
Note: Literally running '/lib/libc.so.6' in Linux will show glibc's configuration.
On Debian Sarge:
Code Sample
GNU C Library stable release version 2.3.2, by Roland McGrath et al.
Compiled by GNU CC version 3.3.5 (Debian 1:3.3.5-13).
Compiled on a Linux 2.6.0-test7 system on 2007-03-05.
Available extensions:
       GNU libio by Per Bothner
       crypt add-on version 2.1 by Michael Glad and others
       linuxthreads-0.10 by Xavier Leroy
       BIND-8.2.3-T5B
       libthread_db work sponsored by Alpha Processor Inc
       NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
Thread-local storage support included.

On DSL:
Code Sample
GNU C Library stable release version 2.3.2, by Roland McGrath et al.
Compiled by GNU CC version 3.3.2 20030831 (Debian prerelease).
Compiled on a Linux 2.4.19 system on 2003-09-12.
Available extensions:
       GNU libio by Per Bothner
       crypt add-on version 2.1 by Michael Glad and others
       linuxthreads-0.10 by Xavier Leroy
       BIND-8.2.3-T5B
       libthread_db work sponsored by Alpha Processor Inc
       NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk

If so, we could fix Wine by enabling TLS support in glibc. I guess we will need to recompile the 'libc6' .deb package and then reintegrate it into DSL. I would love to do this, but I still don't know how to build .deb packages. In the meantime, maybe someone with the relevant experience could test this?
Thanks!

Posted by mikshaw on Oct. 08 2007,13:21
...or fix Wine by compiling it to be compatible with DSL's glibc.

Seems to me (just an opinion) that DSL development shouldn't cater to the desires of extension development, but the developers of extensions should instead work to be compatible with DSL.

It's a fairly common practice -- window managers, for example, that include code to handle oddities of specific external applications -- but one that I can't agree with personally. If it's an app that DSL depends on I could see putting in the effort to change DSL, but if it's an app that depends on DSL I don't think it's Robert's responsibility.

Posted by stupid_idiot on Oct. 08 2007,14:06
Okay, I see your point, especially with regard to backward-compatibility with previous versions of DSL.
Sadly, it seems that nothing can be done for Wine itself.
Tentative idea: Perhaps a glibc-nptl extension is possible?

Posted by curaga on Oct. 08 2007,14:10
To me it seems TLS and NPTL are two different things, but you speak of them as synonymes.

If the debian guys have succeeded with enabling TLS, it still might only work when running a 2.6 kernel, and it was also compiled on one..

In short, there is no guarantee. Care to test wine on that libc?

Posted by stupid_idiot on Oct. 08 2007,14:17
Okay, I will build glibc and test it as soon as I can.
Posted by stupid_idiot on Oct. 12 2007,03:24
Error when building:
Code Sample
nptl/sysdeps/i386/tls.h:58:3: #error "TLS support is required."

Since kernel 2.4 does not support TLS, NPTL also will not work.

Posted by curaga on Oct. 12 2007,14:25
...so it only works when running a 2.6 kernel...
Posted by Juanito on Oct. 14 2007,09:56
I managed to compile it, but got this:
Code Sample
$ /opt/build/lib/libc.so.6
GNU C Library stable release version 2.3.2, by Roland McGrath et al.
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 3.3.5 (Debian 1:3.3.5-13).
Compiled on a Linux 2.6.0-test7 system on 2007-10-10.
Available extensions:
       GNU libio by Per Bothner
       crypt add-on version 2.1 by Michael Glad and others
       linuxthreads-0.10 by Xavier Leroy
       BIND-8.2.3-T5B
       libthread_db work sponsored by Alpha Processor Inc
       NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
Report bugs using the `glibcbug' script to <bugs@gnu.org>.

Posted by stupid_idiot on Oct. 14 2007,12:00
This is the configuration I used:
Code Sample
From a separate build directory:
../glibc-2.3.6/configure --prefix=/glibc-nptl --disable-profile --enable-omitfp --enable-add-ons --enable-kernel=2.4.0 --disable-force-install --without-tls
Explanation:
Code Sample
'--prefix=/glibc-nptl' - To avoid installing into '/lib', which will overwrite your system glibc
'--disable-profile' - Disabled profiling since we are optimizing for size ('-Os')
'--enable-omitfp' - Actually not needed since I already have '-fomit-frame-pointer' in $CFLAGS ('-Os -march=i486 -fomit-frame-pointer -pipe')
'--enable-add-ons' - ** This will enable the NPTL addon; linuxthreads is disabled in favour of NPTL. **
'--enable-kernel=2.4.0' - Support for kernel version 2.4.0 and later
'--disable-force-install' - Disables forced installation
'--without-tls' - Build without TLS support
'--enable-addons' conflicts with '--without-tls' because NPTL cannot build without TLS.
I used glibc 2.3.6 because I had the following problem with 2.3.2 during 'configure', and I don't know how to solve it:
Code Sample
running configure fragment for nptl/sysdeps/pthread
configure: error: CFI directive support in assembler is required
I was using a 'debootstrap' chroot of Debian Sarge with binutils 2.15-6. I wiped it and replaced it with a 'debootstrap' of Debian Etch. Etch has binutils 2.17; but I get the same error.

Posted by Juanito on Oct. 14 2007,15:00
OK, mine was:
Code Sample
../glibc-2.3.2/configure --prefix=/opt/build --enable-shared --enable-add-ons --enable-kernel=2.4.26

...using debian sarge debs to make a compile environment with dsl. Note that the glibc sources were patched with glibc-2.3.2-sscanf-1.patch first. Did you add TLS to the base glibc binary from somewhere - i.e. in the same way as adding from glibc-linuxthreads-2.3.2.tar.bz2?

Posted by stupid_idiot on Oct. 14 2007,17:16
Quote (Juanito @ Oct. 14 2007,19:00)
Did you add TLS to the base glibc binary from somewhere - i.e. in the same way as adding from glibc-linuxthreads-2.3.2.tar.bz2?

< glibc-linuxthreads-2.3.6 > had to be manually added, but NPTL/TLS is already included in < glibc-2.3.6 >.

Posted by Juanito on Oct. 17 2007,11:59
I had another go at this:
Code Sample
$ patch -p1 -d /usr/src/glibc-2.3.2 < /mnt/sdb1/source/build/glibc-2.3.2-sscanf-1.patch
patching file libio/swprintf.c
patching file libio/swscanf.c
patching file stdio-common/sscanf.c
$ ../glibc-2.3.2/configure --prefix=/opt/build --enable-shared --enable-add-ons --enable-kernel=2.4.26 --with-tls
...
$ /opt/build/lib/libc.so.6
GNU C Library stable release version 2.3.2, by Roland McGrath et al.
...
Compiled by GNU CC version 3.3.5 (Debian 1:3.3.5-13).
Compiled on a Linux 2.6.0-test7 system on 2007-10-17.
Available extensions:
       GNU libio by Per Bothner
       crypt add-on version 2.1 by Michael Glad and others
       linuxthreads-0.10 by Xavier Leroy
       BIND-8.2.3-T5B
       libthread_db work sponsored by Alpha Processor Inc
       NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
Thread-local storage support included.

Seems to have worked, no? [BTW this was built on dsl-3.4.4, I don't know why it says 2.6.0-test7]

Posted by curaga on Oct. 17 2007,12:23
:0 Why your gcc is 3.3.5? DSL has 3.3.4...
Posted by Juanito on Oct. 17 2007,12:44
I guess dsl doesn't have gcc at all and, from the 2.4.26 docs, gcc-2.95 is recommended - but good point.

I used a compile environment from debian sarge in order to be closest to libc6-2.3.2 and so gcc_3.3.5-3_i386.deb (sarge) seemed to be the path of least resistance (and I seem to recall reading somewhere that gcc >3 had to be used for libc6-2.3.2 but I could be mistaken).

I could try again with a different version of gcc or maybe somebody could try libc6_2.3.2.ds1-22sarge5_i386.deb or the version I compiled with wine and see if it works?

Posted by curaga on Oct. 17 2007,13:25
Why not try on DSL?

By "DSL has" I meant the gcc extensions have 3.3.4 ('cept for 2.95 extension of course)

Posted by Juanito on Oct. 17 2007,14:11
I tried out the "--with-tls" version to compile patch-2.5.9:
Code Sample
$ ./configure --prefix=/opt/compile
checking for gcc... gcc
checking for C compiler default output... configure: error: C compiler cannot create executables
See `config.log' for more details.
$ cat config.log
...
configure:1655: gcc -I/opt/build/include  -L/opt/build/lib conftest.c  >&5
/opt/build/i686-pc-linux-gnu/bin/as: error while loading shared libraries: libc.so.6: cannot handle TLS data

If I delete the "--with-tls" libc.so.6 and create a symlink to the base dsl libc.so.6 the compile works.

It's interesting that the deb version does not have this error...

Posted by Juanito on Jan. 06 2008,15:04
Did anyone manage to make any progress with the TLS thing?

I just tried to run acrobat reader v8 on dsl but got:
Code Sample
$ /opt/acrobat_reader-8.1.1/Adobe/Reader8/bin/acroread
: error while loading shared libraries: libstdc++.so.6: cannot handle TLS data

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.