From owner-freebsd-current@FreeBSD.ORG Tue Sep 11 02:31:10 2012 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B65E106564A; Tue, 11 Sep 2012 02:31:10 +0000 (UTC) (envelope-from sendtomatt@gmail.com) Received: from mail-oa0-f54.google.com (mail-oa0-f54.google.com [209.85.219.54]) by mx1.freebsd.org (Postfix) with ESMTP id 21A558FC1A; Tue, 11 Sep 2012 02:31:09 +0000 (UTC) Received: by oagm1 with SMTP id m1so7695oag.13 for ; Mon, 10 Sep 2012 19:31:09 -0700 (PDT) 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:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=BjDNhKJ0szsLmL8arlC/7aQM+8WmV0Un/WYqK0JQVPI=; b=JUfyNJexkFSbYPAZnxQ7qwFQotfE9f8kaYCLM1G8E1AzuNoDBByzwz8cafo71f0Dhu ZJS18BVHRozduBcJBprdcbAoTBeHGpfbq71Aw+KxATYw4b/PGKPdXBbg8n+X5GC+VZbl JVMHH9YF2sM7La4sbvve/S9YwJeEIU3LZEYspbZQmUAyl17ETHboskKhWPClcjPR/HBT czjJmMurtgkvZ9vyRUluFhPO8PJx8MqnZYRIVz5rijNsrvRWqzA3qvmtEYc1pdnly2Rj PEXNwQAhcHrT6FNffK860an5l+Cyg4ZPJ18ewyZbQzLFeRtiTi5KpkMoN8pe+UX65XrV YJig== Received: by 10.182.212.98 with SMTP id nj2mr16230252obc.18.1347330669288; Mon, 10 Sep 2012 19:31:09 -0700 (PDT) Received: from flatline.local (70-36-223-239.dsl.dynamic.sonic.net. [70.36.223.239]) by mx.google.com with ESMTPS id n8sm11829911oec.5.2012.09.10.19.31.06 (version=SSLv3 cipher=OTHER); Mon, 10 Sep 2012 19:31:08 -0700 (PDT) Message-ID: <504EA266.4060602@gmail.com> Date: Mon, 10 Sep 2012 19:31:02 -0700 From: matt User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:15.0) Gecko/20120902 Thunderbird/15.0 MIME-Version: 1.0 To: Daniel Eischen References: <20120910211207.GC64920@lor.one-eyed-alien.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: ports@freebsd.org, toolchain@freebsd.org, current@freebsd.org Subject: Re: Clang as default compiler November 4th X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Sep 2012 02:31:10 -0000 On 09/10/12 14:22, Daniel Eischen wrote: > On Mon, 10 Sep 2012, Brooks Davis wrote: > >> [Please confine your replies to toolchain@freebsd.org to keep the thread >> on the most relevant list.] >> >> For the past several years we've been working towards migrating from >> GCC to Clang/LLVM as our default compiler. We intend to ship FreeBSD >> 10.0 with Clang as the default compiler on i386 and amd64 platforms. To >> this end, we will make WITH_CLANG_IS_CC the default on i386 and amd64 >> platforms on November 4th. >> >> What does the mean to you? >> >> * When you build world after the default is changed /usr/bin/cc, cpp, >> and >> c++ will be links to clang. >> >> * This means the initial phase of buildworld and "old style" kernel >> compilation will use clang instead of gcc. This is known to work. >> >> * It also means that ports will build with clang by default. A major >> of ports work, but a significant number are broken or blocked by >> broken ports. For more information see: >> http://wiki.freebsd.org/PortsAndClang >> >> What issues remain? >> >> * The gcc->clang transition currently requires setting CC, CXX, and CPP >> in addition to WITH_CLANG_IS_CC. I will post a patch to toolchain@ >> to address this shortly. > > I assume this will be done, tested and committed before 2012-11-04 > (or whenever the switchover date is). > >> >> * Ports compiler selection infrastructure is still under development. > > This should be a prerequisite before making the switch, given > that ports will be broken without a work-around for building > them with gcc. > I've been using a somewhat dirty method of doing this by checking the presence of a file in the port's main directory, e.g. if "basegcc" is present, build with that, if "clang" is present use it, otherwise default to gcc47. Obviously that configuration is system specific, but the fundamental idea is look for a file in the ports directory that dictates the compiler. Perhaps even add a make ccconfig. It works quite nicely because you can resume a portmaster spree without having to suspend and change CC manually, or build all clang ports first etc. Further csup doesn't touch files it doesn't no about, so updating the tree (without wiping it out) preserves the fact you'd prefer or need to build a given port with something else. There are definitely some ports that have been ignoring libmap.conf, which tends to require me to build some of their dependencies with base gcc, but otherwise I've been running this system for a few months and it works quite well...portmaster can upgrade without user intervention, and it's quite easy to add cflags logic. Granted this works for me and is probably not the ideal solution...also hacked on it to post, so probably typos :) Something like this in make.conf (with fstack-protector-all for all ports which works great) .if !empty(.CURDIR:M/usr/ports/*) CFLAGS+= -fstack-protector-all .endif .if empty(.CURDIR:M/usr/ports/*) && exists(/usr/local/bin/gcc47) && !exists(basegcc) && !exists(clang) # this was occasionally necessary #LDFLAGS+=-lintl # custom cflags if desired #CFLAGS+=-custom cflags for gcc47 #custom cputype if desired CPUTYPE=amdfam10 CC=gcc47 CPP=cpp47 CXX=g++47 .endif .if empty(.CURDIR:M/usr/ports/*) && exists(/usr/bin/clang) && exists(clang) .if !defined(CC) || ${CC} == "cc" CC=clang .endif .if !defined(CXX) || ${CXX} == "c++" CXX=clang++ .endif .if !defined(CPP) || ${CPP} == "cpp" CPP=clang-cpp .endif NO_WERROR= WERROR= .endif Usage is as simple as "touch basegcc" in the port dir or "touch clang" etc. to select appropriate compiler Matt