On Wed, May 20, 2015 at 11:28 AM, John Mudd <johnbmudd@gmail.com> wrote:


On Tue, May 19, 2015 at 5:51 PM, John Mudd <johnbmudd@gmail.com> wrote:
I'm trying to build a musl version of xclock. If I can build xclock then I hope to be able to build my app which is more complicated. I'm getting the following error.

/usr/bin/ld: h_errno: TLS definition in //lib/i386-linux-gnu/libc.so.6 section .tbss mismatches non-TLS definition in /home/mudd/musl/musl-1.1.8.install/lib/libc.so section .bss


Rich Felker wrote:
"Yes, you're linking to glibc, or to something that was linked with
glibc. You should look though the X11 .so files you've built using
readelf and see if any of them have dependencies on libc.so.6. It
looks like you're using the host system's gcc and passing the
musl-gcc.specs file to it manually rather than using the musl-gcc
script or a real musl-targetted compiler toolchain, so it might be
something to do with that too. Adding -v to the command line and
seeing what gets passed to the linker command could be helpful."



It doesn't look like any of my musl compiled libs point to libc.so.6.
$ readelf -a ./*.install/lib/lib*.so | grep libc.so.6
$

Here's what the X11 libs point to. I've built and referenced all of these dependencies using musl.
$ readelf -a ./*.install/lib/libX*.so | grep NEED | sort -u
 0x00000001 (NEEDED)                     Shared library: [libc.so]
 0x00000001 (NEEDED)                     Shared library: [libfontconfig.so.1]
 0x00000001 (NEEDED)                     Shared library: [libfreetype.so.6]
 0x00000001 (NEEDED)                     Shared library: [libICE.so.6]
 0x00000001 (NEEDED)                     Shared library: [libSM.so.6]
 0x00000001 (NEEDED)                     Shared library: [libX11.so.6]
 0x00000001 (NEEDED)                     Shared library: [libXau.so.6]
 0x00000001 (NEEDED)                     Shared library: [libxcb.so.1]
 0x00000001 (NEEDED)                     Shared library: [libXext.so.6]
 0x00000001 (NEEDED)                     Shared library: [libxml2.so.2]
 0x00000001 (NEEDED)                     Shared library: [libXmu.so.6]
 0x00000001 (NEEDED)                     Shared library: [libXpm.so.4]
 0x00000001 (NEEDED)                     Shared library: [libXrender.so.1]
 0x00000001 (NEEDED)                     Shared library: [libXt.so.6]
 0x00000001 (NEEDED)                     Shared library: [libz.so.1]
$



Yes, it's Ubuntu 14.04

 $ uname -a
Linux john-Precision-WorkStation-T3400 3.13.0-49-generic #83-Ubuntu SMP Fri Apr 10 20:14:51 UTC 2015 i686 i686 i686 GNU/Linux

I tried creating an empty ld-linux.so.2 in /usr/lib/gcc/i686-linux-gnu/4.8/ and also in /home/mudd/musl/musl-1.1.8.install/lib/. I'm not sure if either is what Szabolcs Nagy suggested but neither seemed to make a difference.