From owner-freebsd-arch@FreeBSD.ORG Tue Oct 9 14:38:12 2012 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B9C372AF; Tue, 9 Oct 2012 14:38:12 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-oa0-f54.google.com (mail-oa0-f54.google.com [209.85.219.54]) by mx1.freebsd.org (Postfix) with ESMTP id 529E48FC14; Tue, 9 Oct 2012 14:38:11 +0000 (UTC) Received: by mail-oa0-f54.google.com with SMTP id n9so6854625oag.13 for ; Tue, 09 Oct 2012 07:38:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Anq1eGLNVV7qdSN+1q2f0hPxjyHHFKZUXyrhNTqwjFE=; b=PsKNpwxE7+VruKCaofiHuZ6mBeUq7A1bzeCBnZa6J3QvYFb+7rhKNWxSScJRfBsggM Gh3UubHmxuAYYVYyQk7yE9PQCAucJdm51AQPbADq2eO1BzhFhO7rvwATMh4/YefJAG7d W9t9OjwYCc1xl6KoEbG2Dd/4gXF48xN1xVoJ7Uhi722nAFpp8xAvsXs/OADGOP4Q81G6 Vgzg48TfvMtxTSlMUulX/Nvnht027zn0qS2MVA8qngpqihVoOzEEjUtwesG7aRvNCC4s nsp5T9DeIeW07YhouQ28/KEgJz4cc7Umw1SCKcoZgfaDTotCjyv9M1zMa3ZvT33+4oaN btGw== MIME-Version: 1.0 Received: by 10.182.54.103 with SMTP id i7mr3007722obp.62.1349793491299; Tue, 09 Oct 2012 07:38:11 -0700 (PDT) Received: by 10.76.167.202 with HTTP; Tue, 9 Oct 2012 07:38:11 -0700 (PDT) In-Reply-To: <5073F29D.6060505@FreeBSD.org> References: <50736C5A.1000604@delphij.net> <5073F29D.6060505@FreeBSD.org> Date: Tue, 9 Oct 2012 07:38:11 -0700 Message-ID: Subject: Re: Building environment using system headers instead of the in-tree headers From: Garrett Cooper To: Dimitry Andric Content-Type: text/plain; charset=ISO-8859-1 Cc: Xin Li , d@delphij.net, peter@freebsd.org, freebsd-arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2012 14:38:12 -0000 On Tue, Oct 9, 2012 at 2:47 AM, Dimitry Andric wrote: > On 2012-10-09 02:14, Xin Li wrote: >> >> Josh Paetzel recently discovered an interesting build issue with the >> current FreeBSD 'buildworld', where 'make buildworld' over a FreeBSD >> 9.0 tree on a FreeBSD 9.1 system will fail. FWIW I remember when I used to "meister" builds on build.ix there was something off about the machine's setup dealing with the headers. I didn't narrow down what exactly it was, but I had a hunch it was build environment (machine) related (and I think my explanation might make sense) as I never ran into the same issue with streetfighter.ix (which ran CURRENT) or bayonetta, my personal workstation (which has run 8-CURRENT and 9-CURRENT and 9/stable since then). Full logs with build errors along with repro steps would help too if they exist... >> As it turns out, this was caused by addition of xlocale functionality >> on FreeBSD 9.1, which uses macros and expects some new functions found >> in more recent FreeBSD releases. On the other hand, we do not pass >> e.g. -I${.CURDIR}/../../include so the header is preferred than system >> header. > > > During which stage does this fail? In the '4.2 building libraries' one? ... Doing a quick grep and given past experience in Linux embedded projects, isn't the real problem that we're not using gcc properly and it's picking up the wrong system root path (for the system directory #includes)? stable/6 (just for fun and to verify whether or not there was something lost in the gcc 4.2.1 merge): $ egrep --include Makefile\* --include \*.mk -r '(iwithprefix|iwithprefixbefore|isystem|isysroot|nostdinc)' .; egrep --include \*.h -r '(iwithprefix|iwithprefixbefore|isystem|isysroot|nostdinc)' contrib/ ./share/mk/bsd.dep.mk:MKDEP_CFLAGS= ${CFLAGS:M-nostdinc*} ${CFLAGS:M-[BID]*} ./share/mk/bsd.dep.mk:MKDEP_CXXFLAGS= ${CXXFLAGS:M-nostdinc*} ${CXXFLAGS:M-[BID]*} ./share/mk/bsd.dep.mk:MKDEP_OBJCFLAGS=${OBJCFLAGS:M-nostdinc*} ${OBJCFLAGS:M-[BID]*} ${OBJCFLAGS:M-Wno-import*} ./sys/conf/kmod.mk:NOSTDINC= -nostdinc ./sys/conf/kern.pre.mk:NOSTDINC= -nostdinc contrib/binutils/libiberty/cp-demangle.h: Written by Ian Lance Taylor . contrib/gcc/cp-demangle.h: Written by Ian Lance Taylor . contrib/gcc/config/sol2.h:%{compat-bsd:-iwithprefixbefore ucbinclude -I/usr/ucbinclude} \ contrib/gcc/config/i386/sco5.h: header files. Hence the -isystem /usr/gnu/include in the CPP_SPEC. contrib/gcc/config/i386/sco5.h: -isystem /usr/gnu/include \ contrib/gcc/config/i386/sco5.h: %{ansi:-isystem include/ansi%s -isystem /usr/include/ansi} \ contrib/gcc/config/i386/sco5.h: %{posix:-isystem include/posix%s -isystem /usr/include/posix \ contrib/gcc/config/i386/sco5.h: %{!posix:%{Xpg4:-isystem include/xpg4%s -isystem /usr/include/xpg4 \ contrib/gcc/config/i386/sco5.h: %{Xods30:-isystem include/ods_30_compat%s \ contrib/gcc/config/i386/sco5.h: -isystem /usr/include/ods_30_compat \ contrib/gcc/config/i386/cygwin.h: %{!nostdinc:%{!mno-win32|mno-cygwin:-idirafter ../include/w32api%s -idirafter ../../include/w32api%s}}\ contrib/gcc/config/i386/i386-interix.h:-isystem %$INTERIX_ROOT/usr/include" contrib/gcc/gcc.h: || !strcmp (STR, "iwithprefix") || !strcmp (STR, "iwithprefixbefore") \ contrib/gcc/gcc.h: || !strcmp (STR, "isystem") || !strcmp (STR, "-param") \ stable/9: $ egrep --include Makefile\* --include \*.mk -r '(iwithprefix|iwithprefixbefore|isystem|isysroot|nostdinc)' .; egrep --include \*.h -r '(iwithprefix|iwithprefixbefore|isystem|isysroot|nostdinc)' contrib/ ./sys/conf/kmod.mk:NOSTDINC= -nostdinc ./sys/conf/kern.pre.mk:NOSTDINC= -nostdinc ./share/mk/bsd.dep.mk:MKDEP_CFLAGS= ${CFLAGS:M-nostdinc*} ${CFLAGS:M-[BIDU]*} ${CFLAGS:M-std=*} \ ./share/mk/bsd.dep.mk:MKDEP_CXXFLAGS= ${CXXFLAGS:M-nostdinc*} ${CXXFLAGS:M-[BIDU]*} \ contrib/gcclibs/libiberty/cp-demangle.h: Written by Ian Lance Taylor . contrib/llvm/tools/clang/include/clang/Serialization/ASTReader.h: std::string isysroot; contrib/llvm/tools/clang/include/clang/Serialization/ASTReader.h: /// \param isysroot If non-NULL, the system include path specified by the contrib/llvm/tools/clang/include/clang/Serialization/ASTReader.h: ASTReader(Preprocessor &PP, ASTContext &Context, StringRef isysroot = "", contrib/llvm/tools/clang/include/clang/Serialization/ASTWriter.h: void WriteMetadata(ASTContext &Context, StringRef isysroot, contrib/llvm/tools/clang/include/clang/Serialization/ASTWriter.h: StringRef isysroot); contrib/llvm/tools/clang/include/clang/Serialization/ASTWriter.h: void WriteHeaderSearch(const HeaderSearch &HS, StringRef isysroot); contrib/llvm/tools/clang/include/clang/Serialization/ASTWriter.h: StringRef isysroot, const std::string &OutputFile, contrib/llvm/tools/clang/include/clang/Serialization/ASTWriter.h: /// \param isysroot if non-empty, write a relocatable file whose headers contrib/llvm/tools/clang/include/clang/Serialization/ASTWriter.h: Module *WritingModule, StringRef isysroot, contrib/llvm/tools/clang/include/clang/Serialization/ASTWriter.h: std::string isysroot; contrib/llvm/tools/clang/include/clang/Serialization/ASTWriter.h: StringRef isysroot, raw_ostream *Out); contrib/llvm/tools/clang/include/clang/Frontend/HeaderSearchOptions.h: /// it should be) because that is false for user provided '-iwithprefix' contrib/binutils/libiberty/cp-demangle.h: Written by Ian Lance Taylor . contrib/gcc/config/i386/i386-interix.h:-isystem %$INTERIX_ROOT/usr/include" contrib/gcc/config/i386/sco5.h: header files. Hence the -isystem /usr/gnu/include in the CPP_SPEC. contrib/gcc/config/i386/sco5.h: -isystem /usr/gnu/include \ contrib/gcc/config/i386/sco5.h: %{ansi:-isystem include/ansi%s -isystem /usr/include/ansi} \ contrib/gcc/config/i386/sco5.h: %{posix:-isystem include/posix%s -isystem /usr/include/posix \ contrib/gcc/config/i386/sco5.h: %{!posix:%{Xpg4:-isystem include/xpg4%s -isystem /usr/include/xpg4 \ contrib/gcc/config/i386/sco5.h: %{Xods30:-isystem include/ods_30_compat%s \ contrib/gcc/config/i386/sco5.h: -isystem /usr/include/ods_30_compat \ contrib/gcc/config/i386/cygwin.h: %{!nostdinc:%{!mno-win32|mno-cygwin:-idirafter ../include/w32api%s -idirafter ../../include/w32api%s}}\ contrib/gcc/config/vxworksae.h: %{!nostdinc:%{isystem*}} \ contrib/gcc/config/vxworksae.h: %{!nostdinc:-isystem " VXWORKSAE_TARGET_DIR "/vThreads/h}} \ contrib/gcc/config/vxworksae.h: %{!nostdinc:-isystem " VXWORKSAE_TARGET_DIR "/h}} \ contrib/gcc/config/vxworksae.h: %{!nostdinc:-isystem " VXWORKSAE_TARGET_DIR "/val/h}" contrib/gcc/config/sol2.h:%{compat-bsd:-iwithprefixbefore ucbinclude -I/usr/ucbinclude} \ contrib/gcc/config/darwin.h: "%{isysroot*:-syslibroot %*;:-syslibroot " TARGET_SYSTEM_ROOT "}" contrib/gcc/config/darwin.h:#define LINK_SYSROOT_SPEC "%{isysroot*:-syslibroot %*}" contrib/gcc/config/vxworks.h:/* Since we provide a default -isystem, expand -isystem on the command contrib/gcc/config/vxworks.h: %{!nostdinc:%{isystem*}} \ contrib/gcc/config/vxworks.h: %{!nostdinc:-isystem " VXWORKS_TARGET_DIR "/usr/h}} \ contrib/gcc/config/vxworks.h: %{!nostdinc:-isystem " VXWORKS_TARGET_DIR "/h}}" contrib/gcc/config/sol2-6.h:%{compat-bsd:-iwithprefixbefore ucbinclude -I/usr/ucbinclude} \ contrib/gcc/gcc.h: || !strcmp (STR, "iwithprefix") || !strcmp (STR, "iwithprefixbefore") \ contrib/gcc/gcc.h: || !strcmp (STR, "iquote") || !strcmp (STR, "isystem") \ contrib/gcc/gcc.h: || !strcmp (STR, "isysroot") \ contrib/gcc/c-incpath.h: /* Do extra includes processing. STDINC is false iff -nostdinc was given. */ $ If so, Makefile.inc1 needs to do the right thing by passing through a combination of those CFLAGS/CXXFLAGS to clang/gcc/etc. As Dimitry said, building from the subdirectory without going through the build system should not necessarily work if the headers are not "API" (function declaration, #include pollution, macro declaration, etc) compatible unless you install the headers to the system directory (/usr/include) first. Thanks! -Garrett