Date: Wed, 17 Apr 2013 00:12:09 -0700 From: Juli Mallett <jmallett@FreeBSD.org> To: Tim Kientzle <kientzle@freebsd.org> Cc: svn-src-head@freebsd.org, Tijl Coosemans <tijl@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r249484 - head/lib Message-ID: <CACVs6=_WGBkK=pUEn0Ea7ToChAq_FcRXQvL2h5N65CmPEgEc7Q@mail.gmail.com> In-Reply-To: <475555FA-DF6A-42FA-990D-4224ECAEAE52@FreeBSD.org> References: <201304141913.r3EJDqPI095965@svn.freebsd.org> <516D54F5.4010501@FreeBSD.org> <2A0FC59F-E043-4B4E-BABE-E16C6A1FBF5C@freebsd.org> <CACVs6=9QA_wiittSR2HGcOFaDj4VASgLHOimEGWyEcSt8UdBjA@mail.gmail.com> <475555FA-DF6A-42FA-990D-4224ECAEAE52@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Apr 16, 2013 at 11:26 PM, Tim Kientzle <kientzle@freebsd.org> wrote: > > On Apr 16, 2013, at 11:06 PM, Juli Mallett wrote: >> If you're doing a freestanding compile...shouldn't you also be >> specifying both include and library paths explicitly? > > Yes, of course. But the correct directories to use vary somewhat > across platforms, so we would like to have some reasonably > portable way to find the right directory to use for building on > a particular system. > > Both gcc and clang support a -print-file-name=include option which > is supposed to print out the directory containing headers used > for freestanding compiles. You can then take that path and > use it as the explicit include directory path for freestanding builds. Right... >> (Or even better, if you're doing a freestanding >> compile, but want the default include paths, get the compiler to dump >> the default include paths and process that.) > > That's precisely what this is for. I've been working with U-Boot > sources which compile on many systems and use > -print-file-name=include to identify the directory containing > the basic freestanding header files. > > The -print-file-name=include option works on Linux, works > on MacOS, and --- with this one symlink --- can work on > FreeBSD as well. I've been using it to cross-build U-Boot > using the FreeBSD xdev toolchain with both GCC and Clang. I'm confused as to how it wasn't working, and am not convinced that it shouldn't be fixed otherwise. It seems like for clang the user ought to get /usr/include/clang/{version}, except for the problem that we don't put some headers there that some software might expect; so maybe we should just install copies of things like stddef.h into the compiler-specific directory as well? I'm not sure I'm fully understanding your needs, or what you're seeing in practice. Certainly none of those systems have a /usr/lib/include AFAIK; this seems like we're just not deploying our compilers configured in the way that some software (perhaps rightly) expects. And -print-file-name=include doesn't give you the full search path; shouldn't it just give the compiler-specific include directory? You really want something like: % clang -E -Xpreprocessor -v -x c /dev/null For C, and -x c++ for C++. What are the headers you are expecting to find? stddef.h, stdbool.h, stdarg.h? I think I'd rather just see those installed in the compiler-specific dirs, and if we're not spitting those out with our stock-built compilers, we should fix that to match behaviour on other systems. Other systems' -print-file-name=include doesn't expose all of /usr/include, as far as I can tell. That seem excessive and wrong for a freestanding build.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACVs6=_WGBkK=pUEn0Ea7ToChAq_FcRXQvL2h5N65CmPEgEc7Q>