From owner-freebsd-bugs@freebsd.org Wed Oct 5 01:33:13 2016 Return-Path: Delivered-To: freebsd-bugs@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 323C5AF6F8D for ; Wed, 5 Oct 2016 01:33:13 +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 177AC76C for ; Wed, 5 Oct 2016 01:33:13 +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 u951XCZh049269 for ; Wed, 5 Oct 2016 01:33:12 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 213217] Passing -isystem /usr/include to clang breaks C++ compilation Date: Wed, 05 Oct 2016 01:33:13 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: gonzo@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: 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-bugs@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Oct 2016 01:33:13 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D213217 Bug ID: 213217 Summary: Passing -isystem /usr/include to clang breaks C++ compilation Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Many People Priority: --- Component: bin Assignee: freebsd-bugs@FreeBSD.org Reporter: gonzo@FreeBSD.org Created attachment 175436 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D175436&action= =3Dedit test case To reproduce this bug run following command: % clang++ -isystem /usr/include test.cpp In file included from test.cpp:1: /usr/include/c++/v1/cstddef:43:15: fatal error: 'stddef.h' file not found #include_next ^ 1 error generated. File compiles fine without -isystem flag: % clang++ test.cpp % The problem is that stddef.h is clang's internal header and supposed to be = in /usr/bin/../lib/clang/3.8.0/include. But since it conflicts with freebsd's stddef.h we do not install it and append /usr/include to the list of include dirs: % clang++ -v test.cpp FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on LLVM 3.8.0) .. skipped ... #include "..." search starts here: #include <...> search starts here: /usr/include/c++/v1 /usr/bin/../lib/clang/3.8.0/include /usr/include End of search list. But when we pass -isystem /usr/include, clang removes appended dir as a duplicate and search path looks like this: % clang++ -v -isystem /usr/include test.cpp FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on LLVM 3.8.0) .. skipped .. ignoring duplicate directory "/usr/include" #include "..." search starts here: #include <...> search starts here: /usr/include /usr/include/c++/v1 /usr/bin/../lib/clang/3.8.0/include End of search list. #include_next does not go through whole list, only from the directory where= its parent file is located Some third-party software passes -isystem for cross-compilation cases alogn with --sysroot, namely Qt does it like this: c++ ... --sysroot=3D/src/FreeBSD/tftproot/rpi/ ... -isystem /src/FreeBSD/tftproot/rpi/usr/include ... and this bug breaks cross-compilation --=20 You are receiving this mail because: You are the assignee for the bug.=