Date: Sun, 09 Jan 2011 12:38:31 +0100 From: Dimitry Andric <dim@FreeBSD.org> To: Alexander Best <arundel@freebsd.org> Cc: freebsd-toolchain@freebsd.org Subject: Re: searchpath for clang Message-ID: <4D299E37.7080103@FreeBSD.org> In-Reply-To: <20110109005017.GA8384@freebsd.org> References: <20110109005017.GA8384@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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++.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D299E37.7080103>