Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 20 May 2015 12:05:02 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: Re: musl xclock?

On Wed, May 20, 2015 at 11:28:50AM -0400, John Mudd wrote:
> On Tue, May 19, 2015 at 5:51 PM, John Mudd <johnbmudd@...il.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

You're only checking the X libs (libX*). Can you re-run that command
as:

readelf -a ./*.install/lib/*.so | grep NEED | sort -u

That might find a library that was built incorrectly. I would also
check musl libc.so itself just to be sure; it's conceivable that
something went wrong in the build and _it_ has a dependency on glibc
encoded in it (which it would ignore at runtime, but ld won't ignore
it when linking).

>  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]
> $
> 
> I'm using musl-gcc. What I listed in original email is what that script
> executed. After I cleaned it up to make it easier to read.
> 
> Here's the output of the gcc command with "-v". It's referencing the native
> libc. But where does that come from?

I don't see any references to it on the command line it passes to the
linker, only in the output during linking that was the same without
-v. So I'm confused where it's coming from too. 

>  /usr/lib/gcc/i686-linux-gnu/4.8/collect2 -dynamic-linker

This is the interesting command...

> /usr/rx30/musl/lib/ld-musl-i386.so.1 -nostdlib -z relro -o xclock
> /home/mudd/musl/musl-1.1.8.install/lib/crt1.o
> /home/mudd/musl/musl-1.1.8.install/lib/crti.o
> /usr/lib/gcc/i686-linux-gnu/4.8/crtbegin.o
> -L/home/mudd/musl/autoconf-2.69.install/lib
> -L/home/mudd/musl/automake-1.15.install/lib
> -L/home/mudd/musl/bzip2-1.0.6.install/lib
> -L/home/mudd/musl/curl-master.install/lib
> -L/home/mudd/musl/fontconfig-2.11.93.install/lib
> -L/home/mudd/musl/freetype-2.5.5.install/lib
> -L/home/mudd/musl/inputproto-2.3.install/lib
> -L/home/mudd/musl/kbproto-1.0.6.install/lib
> -L/home/mudd/musl/krb5-1.13.1.install/lib
> -L/home/mudd/musl/libICE-1.0.9.install/lib
> -L/home/mudd/musl/libpthread-stubs-0.1.install/lib
> -L/home/mudd/musl/libSM-1.2.2.install/lib
> -L/home/mudd/musl/libtool-2.4.install/lib
> -L/home/mudd/musl/libX11-1.6.3.install/lib
> -L/home/mudd/musl/libXau-1.0.8.install/lib
> -L/home/mudd/musl/libXaw-1.0.12.install/lib
> -L/home/mudd/musl/libxcb-1.11.install/lib
> -L/home/mudd/musl/libXext-1.3.3.install/lib
> -L/home/mudd/musl/libXft-2.3.2.install/lib
> -L/home/mudd/musl/libxkbfile-1.0.8.install/lib
> -L/home/mudd/musl/libxml2-2.9.2.install/lib
> -L/home/mudd/musl/libXmu-1.1.2.install/lib
> -L/home/mudd/musl/libXpm-3.5.11.install/lib
> -L/home/mudd/musl/libXrender-0.9.8.install/lib
> -L/home/mudd/musl/libxslt-1.1.28.install/lib
> -L/home/mudd/musl/libXt-1.1.4.install/lib
> -L/home/mudd/musl/musl-1.1.8.install/lib
> -L/home/mudd/musl/ncurses-5.9.install/lib
> -L/home/mudd/musl/openssl-1.0.2a.install/lib
> -L/home/mudd/musl/postgresql-9.4.1.install/lib
> -L/home/mudd/musl/Python-2.7.9.install/lib
> -L/home/mudd/musl/readline-6.3.install/lib
> -L/home/mudd/musl/renderproto-0.11.install/lib
> -L/home/mudd/musl/sqlite-autoconf-3080803.install/lib
> -L/home/mudd/musl/util-macros-1.19.0.install/lib
> -L/home/mudd/musl/xcb-proto-1.11.install/lib
> -L/home/mudd/musl/xextproto-7.3.0.install/lib
> -L/home/mudd/musl/xproto-7.0.27.install/lib
> -L/home/mudd/musl/xtrans-1.3.5.install/lib
> -L/home/mudd/musl/zlib-1.2.8.install/lib
> -L/home/mudd/musl/musl-1.1.8.install/lib -L
> /usr/lib/gcc/i686-linux-gnu/4.8/. Clock.o xclock.o -lX11 -lXaw7 -lXft

...and the only mildly suspicious thing is this last -L. Is it
possible that your distro has glibc libc.so in the same directory as
the gcc libs dir, /usr/lib/gcc/i686-linux-gnu/4.8/?

> -lxkbfile -lXmu -lXrender -lXt /usr/lib/gcc/i686-linux-gnu/4.8/libgcc.a
> /usr/lib/gcc/i686-linux-gnu/4.8/libgcc_eh.a -lc
> /usr/lib/gcc/i686-linux-gnu/4.8/libgcc.a
> /usr/lib/gcc/i686-linux-gnu/4.8/libgcc_eh.a
> /usr/lib/gcc/i686-linux-gnu/4.8/crtend.o
> /home/mudd/musl/musl-1.1.8.install/lib/crtn.o
> /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
> //lib/i386-linux-gnu/libc.so.6: error adding symbols: Bad value
> collect2: error: ld returned 1 exit status

It's odd that //lib appears in the above output since that has nothing
to do with the -L pathnames above and it has a gratuitous double slash
at the beginning.

What distro are you using?

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.