From owner-freebsd-toolchain@FreeBSD.ORG Sun Jan 9 00:50:17 2011 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 5FA13106566B; Sun, 9 Jan 2011 00:50:17 +0000 (UTC) Date: Sun, 9 Jan 2011 00:50:17 +0000 From: Alexander Best To: freebsd-toolchain@freebsd.org Message-ID: <20110109005017.GA8384@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: searchpath for clang X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jan 2011 00:50:17 -0000 i just noticed that when CC is set to clang, target buildworld will honour $PATH, whereas target buildkernel doesn't. shouldn't target buildworld also discarg $PATH? i have a clang 2.9 svn snapshot installed under /usr/local/bin and target buildworld failed, because this version was picked up instead of the one under /usr/bin. cheers. alex -- a13x From owner-freebsd-toolchain@FreeBSD.ORG Sun Jan 9 11:38:29 2011 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D472106564A; Sun, 9 Jan 2011 11:38:29 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id E3FA48FC08; Sun, 9 Jan 2011 11:38:28 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:7c79:31ca:edb:edcd] (unknown [IPv6:2001:7b8:3a7:0:7c79:31ca:edb:edcd]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 692625C5A; Sun, 9 Jan 2011 12:38:26 +0100 (CET) Message-ID: <4D299E37.7080103@FreeBSD.org> Date: Sun, 09 Jan 2011 12:38:31 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.14pre) Gecko/20110104 Lanikai/3.1.8pre MIME-Version: 1.0 To: Alexander Best References: <20110109005017.GA8384@freebsd.org> In-Reply-To: <20110109005017.GA8384@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-toolchain@freebsd.org Subject: Re: searchpath for clang X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jan 2011 11:38:29 -0000 On 2011-01-09 01:50, Alexander Best wrote: > i just noticed that when CC is set to clang, target buildworld will honour > $PATH, whereas target buildkernel doesn't. shouldn't target buildworld also > discarg $PATH? It does discard PATH. See the top Makefile, one of the first things it does is: PATH= /sbin:/bin:/usr/sbin:/usr/bin And for subsequent stages, PATH is set to various other values. > i have a clang 2.9 svn snapshot installed under /usr/local/bin > and target buildworld failed, because this version was picked up instead of the > one under /usr/bin. Are you building world with CC=/usr/local/bin/clang? If so, that is most likely your problem. Specifying a full path for CC (or CXX) always overrides the command used during the world stage. Normally, CC is set to "cc" or "clang", so without any absolute path. During the various build stages, PATH is set to different values, causing *different* compiler and binutils executables to be used during those stages, e.g.: - /usr/bin/cc, /usr/bin/ld and so on, during the legacy, bootstrap-tools, build-tools and cross-tools stages. - ${WORLDTMP}/usr/bin/cc, ${WORLDTMP}/usr/bin/ld and so on, during the world and install stages. In your case, if you want to compile the bootstrap stages with clang trunk, but the world with the version of clang that is in the source tree, you must modify the top Makefile to have: PATH= /usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin and then use CC=clang, CXX=clang++. From owner-freebsd-toolchain@FreeBSD.ORG Sun Jan 9 14:31:47 2011 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 843671065674; Sun, 9 Jan 2011 14:31:47 +0000 (UTC) Date: Sun, 9 Jan 2011 14:31:47 +0000 From: Alexander Best To: Dimitry Andric Message-ID: <20110109143147.GA19023@freebsd.org> References: <20110109005017.GA8384@freebsd.org> <4D299E37.7080103@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4D299E37.7080103@FreeBSD.org> Cc: freebsd-toolchain@freebsd.org Subject: Re: searchpath for clang X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jan 2011 14:31:47 -0000 On Sun Jan 9 11, Dimitry Andric wrote: > On 2011-01-09 01:50, Alexander Best wrote: > >i just noticed that when CC is set to clang, target buildworld will honour > >$PATH, whereas target buildkernel doesn't. shouldn't target buildworld also > >discarg $PATH? > > It does discard PATH. See the top Makefile, one of the first things it > does is: > > PATH= /sbin:/bin:/usr/sbin:/usr/bin > > And for subsequent stages, PATH is set to various other values. > > > >i have a clang 2.9 svn snapshot installed under /usr/local/bin > >and target buildworld failed, because this version was picked up instead > >of the > >one under /usr/bin. > > Are you building world with CC=/usr/local/bin/clang? If so, that is > most likely your problem. Specifying a full path for CC (or CXX) always > overrides the command used during the world stage. > > Normally, CC is set to "cc" or "clang", so without any absolute path. > During the various build stages, PATH is set to different values, > causing *different* compiler and binutils executables to be used during > those stages, e.g.: > > - /usr/bin/cc, /usr/bin/ld and so on, during the legacy, > bootstrap-tools, build-tools and cross-tools stages. > - ${WORLDTMP}/usr/bin/cc, ${WORLDTMP}/usr/bin/ld and so on, during the > world and install stages. > > In your case, if you want to compile the bootstrap stages with clang > trunk, but the world with the version of clang that is in the source > tree, you must modify the top Makefile to have: > > PATH= /usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin > > and then use CC=clang, CXX=clang++. i really cannot spot the problem on my system. :( otaku% /usr/bin/clang -v FreeBSD clang version 2.8 (tags/RELEASE_28 115870) 20101007 Target: x86_64-undermydesk-freebsd9.0 Thread model: posix otaku% /usr/local/bin/clang -v clang version 2.9 (trunk 122855) Target: x86_64-unknown-freebsd9.0 Thread model: posix otaku% grep -v '^#' /etc/src.conf .if !defined(CC) || ${CC} == "cc" CC=clang -v .endif .if !defined(CXX) || ${CXX} == "c++" CXX=clang++ -v .endif NO_WERROR= WERROR= DEBUG_FLAGS = -g otaku% make buildworld ... clang -v -O2 -pipe -I/usr/subversion-src/usr.bin/make -DMAKE_VERSION=\"5200408120\" -DDEFSHELLNAME=\"sh\" -g -std=gnu99 -fstack-protector -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -c /usr/subversion-src/usr.bin/make/parse.c clang version 2.9 (trunk 122855) Target: x86_64-unknown-freebsd9.0 Thread model: posix "/usr/local/bin/clang" -cc1 -triple x86_64-unknown-freebsd9.0 -emit-obj -disable-free -main-file-name parse.c -mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version 2.21 -v -g -resource-dir /usr/local/bin/../lib/clang/2.9 -D MAKE_VERSION="5200408120" -D DEFSHELLNAME="sh" -I /usr/subversion-src/usr.bin/make -O2 -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -std=gnu99 -ferror-limit 19 -fmessage-length 275 -stack-protector 1 -fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o parse.o -x c /usr/subversion-src/usr.bin/make/parse.c clang -cc1 version 2.9 based upon llvm 2.9svn hosted on x86_64-unknown-freebsd9.0 #include "..." search starts here: #include <...> search starts here: /usr/subversion-src/usr.bin/make /usr/local/include /usr/local/bin/../lib/clang/2.9/include /usr/include End of search list. In file included from /usr/subversion-src/usr.bin/make/parse.c:75: /usr/local/bin/../lib/clang/2.9/include/stdarg.h:47:9: warning: '__GNUC_VA_LIST' macro redefined #define __GNUC_VA_LIST 1 ^ In file included from /usr/subversion-src/usr.bin/make/parse.c:74: In file included from /usr/include/ctype.h:45: In file included from /usr/include/sys/_types.h:33: /usr/include/machine/_types.h:113:9: note: previous definition is here #define __GNUC_VA_LIST ^ In file included from /usr/subversion-src/usr.bin/make/parse.c:75: /usr/local/bin/../lib/clang/2.9/include/stdarg.h:48:27: error: redefinition of typedef '__gnuc_va_list' is invalid in C [-Wtypedef-redefinition] typedef __builtin_va_list __gnuc_va_list; ^ In file included from /usr/subversion-src/usr.bin/make/parse.c:74: In file included from /usr/include/ctype.h:45: In file included from /usr/include/sys/_types.h:33: /usr/include/machine/_types.h:114:20: note: previous definition is here typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/ ^ In file included from /usr/subversion-src/usr.bin/make/parse.c:80: In file included from /usr/subversion-src/usr.bin/make/arch.h:44: In file included from /usr/subversion-src/usr.bin/make/util.h:45: /usr/include/stdio.h:63:19: error: redefinition of typedef 'va_list' is invalid in C [-Wtypedef-redefinition] typedef __va_list va_list; ^ In file included from /usr/subversion-src/usr.bin/make/parse.c:75: /usr/local/bin/../lib/clang/2.9/include/stdarg.h:30:27: note: previous definition is here typedef __builtin_va_list va_list; ^ 1 warning and 2 errors generated. *** Error code 1 Stop in /usr/subversion-src/usr.bin/make. *** Error code 1 Stop in /usr/subversion-src. *** Error code 1 Stop in /usr/subversion-src. cheers. alex -- a13x From owner-freebsd-toolchain@FreeBSD.ORG Sun Jan 9 14:39:24 2011 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E2240106564A; Sun, 9 Jan 2011 14:39:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id A44DD8FC18; Sun, 9 Jan 2011 14:39:24 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:7c79:31ca:edb:edcd] (unknown [IPv6:2001:7b8:3a7:0:7c79:31ca:edb:edcd]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 751D45C5A; Sun, 9 Jan 2011 15:39:23 +0100 (CET) Message-ID: <4D29C8A2.8080800@FreeBSD.org> Date: Sun, 09 Jan 2011 15:39:30 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.14pre) Gecko/20110104 Lanikai/3.1.8pre MIME-Version: 1.0 To: Alexander Best References: <20110109005017.GA8384@freebsd.org> <4D299E37.7080103@FreeBSD.org> <20110109143147.GA19023@freebsd.org> In-Reply-To: <20110109143147.GA19023@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-toolchain@freebsd.org Subject: Re: searchpath for clang X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jan 2011 14:39:25 -0000 On 2011-01-09 15:31, Alexander Best wrote: ... > i really cannot spot the problem on my system. :( ... > In file included from /usr/subversion-src/usr.bin/make/parse.c:75: > /usr/local/bin/../lib/clang/2.9/include/stdarg.h:47:9: warning: '__GNUC_VA_LIST' macro redefined > #define __GNUC_VA_LIST 1 > ^ From /usr/local/lib/clang/2.9/include, you must remove (or move out of the way) all .h files that already exist in /usr/include, because they clash with our standard includes. Normally the files to be moved are: float.h iso646.h limits.h stdarg.h stdbool.h stddef.h stdint.h tgmath.h varargs.h It would be better if the port already did this, though... From owner-freebsd-toolchain@FreeBSD.ORG Sun Jan 9 14:58:58 2011 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id F297B1065672; Sun, 9 Jan 2011 14:58:58 +0000 (UTC) Date: Sun, 9 Jan 2011 14:58:58 +0000 From: Alexander Best To: Dimitry Andric Message-ID: <20110109145858.GA21455@freebsd.org> References: <20110109005017.GA8384@freebsd.org> <4D299E37.7080103@FreeBSD.org> <20110109143147.GA19023@freebsd.org> <4D29C8A2.8080800@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4D29C8A2.8080800@FreeBSD.org> Cc: freebsd-toolchain@freebsd.org Subject: Re: searchpath for clang X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jan 2011 14:58:59 -0000 On Sun Jan 9 11, Dimitry Andric wrote: > On 2011-01-09 15:31, Alexander Best wrote: > ... > >i really cannot spot the problem on my system. :( > ... > >In file included from /usr/subversion-src/usr.bin/make/parse.c:75: > >/usr/local/bin/../lib/clang/2.9/include/stdarg.h:47:9: warning: > >'__GNUC_VA_LIST' macro redefined > >#define __GNUC_VA_LIST 1 > > ^ > > From /usr/local/lib/clang/2.9/include, you must remove (or move out of > the way) all .h files that already exist in /usr/include, because they > clash with our standard includes. Normally the files to be moved are: > > float.h > iso646.h > limits.h > stdarg.h > stdbool.h > stddef.h > stdint.h > tgmath.h > varargs.h i renamed /usr/local/lib/clang/2.9/include to something else and re-ran target buildworld. what's interesting is that /usr/local/bin/clang only gets picked up in this section: >>> Building an up-to-date make(1) after the following message: >>> World build started on Sun Jan 9 15:49:53 CET 2011 /usr/bin/clang gets chosen i suspect $PATH doesn't get discarded when building make(1). cheers. alex > > It would be better if the port already did this, though... -- a13x