From owner-freebsd-current@freebsd.org Fri Aug 16 08:47:46 2019 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5FA7FC500C for ; Fri, 16 Aug 2019 08:47:46 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 468xm21p24z3yCm for ; Fri, 16 Aug 2019 08:47:46 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from smtp.theravensnest.org (smtp.theravensnest.org [46.226.110.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: theraven) by smtp.freebsd.org (Postfix) with ESMTPSA id 05B3BBD7C for ; Fri, 16 Aug 2019 08:47:46 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from [10.164.186.150] (unknown [167.220.197.150]) by smtp.theravensnest.org (Postfix) with ESMTPSA id D3D842CC for ; Fri, 16 Aug 2019 08:47:19 +0000 (UTC) Subject: Re: Stop installing /usr/bin/clang To: freebsd-current@freebsd.org References: <20190815164815.GK2738@kib.kiev.ua> From: David Chisnall Message-ID: <03b695ff-afdb-85db-d1d3-b62111c346a9@FreeBSD.org> Date: Fri, 16 Aug 2019 09:47:41 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190815164815.GK2738@kib.kiev.ua> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 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: Fri, 16 Aug 2019 08:47:46 -0000 On 15/08/2019 17:48, Konstantin Belousov wrote: > Please look at https://reviews.freebsd.org/D21060 > I propose to stop installing /usr/bin/clang, clang++, clang-cpp. > > It probably does not matter when all your software comes from ports or > packages, but is actually very annoying when developing on FreeBSD. > In particular, you never know which `clang' is called in the user > environment, because it depends on the $PATH elements ordering. What is the confusion here? The binary that is invoked as clang is from the base system. The binary that is invoked as clang{version number} is from ports. If the user has built clang from source and has set up their path to put that first, then they will get a different clang, but there's no way we can stop that kind of behaviour. For reference, on my machine, I have: clang <- this one is from the base system clang60 <- this one if from ports clang70 <- this one if from ports clang80 <- this one if from ports clang-devel <- this one if from ports Nothing in my PATH order affects this. The only source of confusion that I regularly encounter comes from the fact that FreeBSD packages install clang80, when every other system installs clang-8, so I end up having to have a special case in CMake logic for finding specific versions of tools like clang-format on FreeBSD. That said, I don't know what the impact would be on configure scripts if we didn't have a clang binary. CMake seems to run ${CC} -v and parse the output, so it's quite happy finding that cc is clang (and the specific version). How do most autoconf things handle this? Apple shipped a gcc symlink to clang for years because, in the absence of a gcc binary, a load of programs detected /usr/bin/cc and decided not to enable any GNU extensions. We've managed to avoid having to do that, but how many things look for clang, gcc, and cc in the path and enable features based on which one they find? David