From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/1682 Path: news.gmane.org!not-for-mail From: agent Newsgroups: gmane.linux.lib.musl.general Subject: build musl with clang Date: Thu, 23 Aug 2012 13:53:18 +0600 Message-ID: <5035E16E.50004@gmail.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1345708480 21018 80.91.229.3 (23 Aug 2012 07:54:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 23 Aug 2012 07:54:40 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-1683-gllmg-musl=m.gmane.org@lists.openwall.com Thu Aug 23 09:54:40 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1T4SFT-0000ow-8j for gllmg-musl@plane.gmane.org; Thu, 23 Aug 2012 09:54:39 +0200 Original-Received: (qmail 23692 invoked by uid 550); 23 Aug 2012 07:54:36 -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 23684 invoked from network); 23 Aug 2012 07:54:35 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=bHLXbSSmMv0GIOp8qLF/KLVrCTM+5RAXs088bIgOEYI=; b=vYI6wH2rR5aV3sVoAMDkqnUOgPd2IgqzzzeyK8TjaeP8e1KYDUWjQNVaOLAYkNK5QZ I1Blz7AgvEFUlgFfiWUcTi6aByaMaHiQ1b7rRijAhwKSGjxyD2HX3zlxUGi1XLyZ+Fz3 If23f4uk9MIZy+xFPTNARTs5g9MwyX0889dItQqxDzABmRToObRtj3VwublvYPMG5JBk R3y0nRSP/zczowDS0/OaicrSjVJQu9S2B9uk/0WR45RT5zj3gQc6REVAAI6rJ3PYb+r8 0Z7rLsKejXYO/C90cjZWrhW4s0yhZ09HAeCJz0WAkHszjQvqsQ7zWATx24SXIpd3JCba 0kug== User-Agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120714 Thunderbird/14.0 Xref: news.gmane.org gmane.linux.lib.musl.general:1682 Archived-At: i am trying to build musl with clang 3.0 from ubuntu 12.04. musl itself builds fairly fine with some notes on unused command line parameters and coding style. but i have some issues compiling a simple hello world program against this musl. the code is: #include int main(int argc, char **argv) { printf("Hello, World!\n"); return 0; } i have tried to link against musl both dynamically and statically. if i compile a program with the default ld-linux.so dynamic linker the program runs but fails at the end: Hello, World! Inconsistency detected by ld.so: dl-fini.c: 207: _dl_fini: Assertion `ns != 0 || i == nloaded' failed! if i use musl's ld-musl (as far as i can notice it is just symlink to libc.so) i get a segfault. gdb says: (gdb) r Starting program: /home/agent/dev/musl/musl-0.9.4_clang/lib/t.out Program received signal SIGSEGV, Segmentation fault. 0xb7f9d73a in find_sym () from /lib/ld-musl-i386.so.1 (gdb) where #0 0xb7f9d73a in find_sym () from /lib/ld-musl-i386.so.1 btw, exactly the same things happen when i try it with gcc (4.6.3 from ubuntu). if i compile statically with gcc the program works fine, but with clang it even does not compile (i mean link): /opt/musl-clang/lib/libc.a(vfprintf.o): In function `printf_core': src/stdio/vfprintf.c:(.text+0x1088): undefined reference to `__udivdi3' src/stdio/vfprintf.c:(.text+0x10a6): undefined reference to `__umoddi3' /opt/musl-clang/lib/libc.a(vfprintf.o): In function `fmt_u': src/stdio/vfprintf.c:(.text+0x1a11): undefined reference to `__udivdi3' src/stdio/vfprintf.c:(.text+0x1a33): undefined reference to `__umoddi3' clang: error: linker command failed with exit code 1 (use -v to see invocation) i suppose those functions do not get into libc.a for some reason, but they are in libc.so according to readelf. my clang command lines: dynamic link: clang -Wall -nostdlib -nostdinc -Wl,-dynamic-linker /lib/ld-musl-i386.so.1 -L/opt/musl-clang/lib -isystem /opt/musl-clang/include/ /opt/musl-clang/lib/crt1.o /opt/musl-clang/lib/crti.o t.c /opt/musl-clang/lib/crtn.o -o t.out -lc static link: clang -Wall -nostdlib -nostdinc -L/opt/musl-clang/lib -isystem /opt/musl-clang/include/ /opt/musl-clang/lib/crt1.o /opt/musl-clang/lib/crti.o t.c /opt/musl-clang/lib/crtn.o -o t.out -static -lc as far as i can see, musl do not provide crtbegin.o and crtend.o, clang do not have it's own and if i add gcc's ones situation does not change. maybe i am wrong with clang parameters (i based them on gcc spec provided), maybe it is impossible to compile a working musl with clang at this stage, maybe a quick fix can be applied (: PS: sorry for so long message -- i'd like to be maximum verbose PPS: and sorry for duplicates if any -- i didn't find any search on mainling list archive