From owner-freebsd-toolchain@freebsd.org Wed Oct 5 10:43:11 2016 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 273F4AF686E for ; Wed, 5 Oct 2016 10:43:11 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F204D37A for ; Wed, 5 Oct 2016 10:43:10 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id u95AhAcR022605 for ; Wed, 5 Oct 2016 10:43:10 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-toolchain@FreeBSD.org Subject: [Bug 213217] [patch] Passing -isystem /usr/include to clang breaks C++ compilation Date: Wed, 05 Oct 2016 10:43:11 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: patch X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: dim@FreeBSD.org X-Bugzilla-Status: Closed X-Bugzilla-Resolution: Rejected X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-toolchain@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc bug_status resolution Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Oct 2016 10:43:11 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D213217 Dimitry Andric changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dim@FreeBSD.org Status|New |Closed Resolution|--- |Rejected --- Comment #2 from Dimitry Andric --- Short answer: Don't use -isystem /usr/include. If you do so for C++ programs, you mess up the include search path order. = If you must do it for some reason, you must also add -isystem entries for the = C++ include directories, and at the front of the list. For example, a C++ program will use the following search path by default (w= here x.y.z is the clang version): #include "..." search starts here: #include <...> search starts here: /usr/include/c++/v1 /usr/bin/../lib/clang/x.y.z/include /usr/include End of search list. >From libc++ 3.8.0 onwards, if you include a C standard header, such as , you will get libc++'s wrapper header first. This header sets up= a few things, then does #include_next, and with the above search pa= th, this finds /usr/include/stddef.h. (We don't install clang's internal stdde= f.h, since it is not compatible with our system headers yet.) However, if you add -isystem /usr/include, you force /usr/include to be the first in the list, e.g. the search path will become: ignoring duplicate directory "/usr/include" #include "..." search starts here: #include <...> search starts here: /usr/include /usr/include/c++/v1 /usr/bin/../lib/clang/x.y.z/include End of search list. If you now include , and it eventually does #include_next, it will attempt to search the paths *after* /usr/include/c++/v1, and will n= ot be able to find the header. Summary: If for some reason you must completely rebuild the header search p= ath from scratch, you need to add -isystem /usr/include/c++/v1 *before* -isyst= em /usr/include. But it is better not to do this at all. :) --=20 You are receiving this mail because: You are the assignee for the bug.=