From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7721 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Re: musl xclock? Date: Wed, 20 May 2015 12:05:02 -0400 Message-ID: <20150520160502.GY17573@brightrain.aerifal.cx> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1432137929 22552 80.91.229.3 (20 May 2015 16:05:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 20 May 2015 16:05:29 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-7733-gllmg-musl=m.gmane.org@lists.openwall.com Wed May 20 18:05:28 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Yv6Um-00033C-5E for gllmg-musl@m.gmane.org; Wed, 20 May 2015 18:05:24 +0200 Original-Received: (qmail 10102 invoked by uid 550); 20 May 2015 16:05:17 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 10078 invoked from network); 20 May 2015 16:05:16 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:7721 Archived-At: On Wed, May 20, 2015 at 11:28:50AM -0400, John Mudd wrote: > On Tue, May 19, 2015 at 5:51 PM, John Mudd 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