简体   繁体   中英

Including libc directory for multiple platforms/versions

These directories on my platform (Ubuntu) is required to be passed to clang so it can parse code that includes libc headers properly:

/usr/include/x86_64-linux-gnu

/usr/lib/gcc/x86_64-linux-gnu/4.6/include

/usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed

What is the simplest way to find the location of this directory on other platforms and versions of gnu libc? I need this to make a portable build script.

Please tell me this is standardized in some way or form. Pkg-config?

llvm/tools/clang/lib/Driver/ToolChains.cpp searches for GCC installations, with various hard-coded paths for different platforms.

On Gentoo, Debian, and Ubuntu, the distribution-provided clang source patches this file to look in distribution-specific locations (eg gentoo/sys-devel/clang/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch , debian/clang_3.1-8/debian/patches/21-searchPathHeaders.diff , etc.).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM