From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/1684 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: build musl with clang Date: Thu, 23 Aug 2012 11:23:26 +0200 Message-ID: <20120823092325.GC10731@port70.net> References: <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=us-ascii X-Trace: ger.gmane.org 1345713824 32279 80.91.229.3 (23 Aug 2012 09:23:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 23 Aug 2012 09:23:44 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-1685-gllmg-musl=m.gmane.org@lists.openwall.com Thu Aug 23 11:23:42 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 1T4Tdb-0004M7-Ov for gllmg-musl@plane.gmane.org; Thu, 23 Aug 2012 11:23:39 +0200 Original-Received: (qmail 21785 invoked by uid 550); 23 Aug 2012 09:23:38 -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 21777 invoked from network); 23 Aug 2012 09:23:37 -0000 Content-Disposition: inline In-Reply-To: <5035E16E.50004@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:1684 Archived-At: * agent [2012-08-23 13:53:18 +0600]: > 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 i've never tried to build musl with clang but others did so it should work in config.mak setup LIBCC properly (it defaults to -lgcc in the Makefile, this is needed for udiv* symbols provided by the compiler on 32bit archs for 64bit int division) i recommend using -g in the cflags and ldflags so you have debug symbols don't use the system ld.so > 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 > you need the LIBCC here as well, otherwise it looks ok maybe try to link separately with ld (clang might invoke ld in hideous ways) # if there is no crtbegin.o,crtend.o then remove them START="$MUSL/lib/crti.o $MUSL/lib/crt1.o $CLANG/lib/crtbegin.o" END="$CLANG/lib/crtend.o $MUSL/lib/crtn.o -L$MUSL/lib -lc -L$CLANG/lib -lclang" # compile: clang -c t.c -nostdinc -isystem $MUSL/include # link: either one of the following should work clang -nostdlib -Wl,-dynamic-linker,/lib/ld-musl-i386.so.1 $START t.o $END ld -X -d -e _start -dynamic-linker /lib/ld-musl-i386.so.1 $START t.o $END