[cfe-dev] Libtool search path on MacOS
Jacob Carlborg via cfe-dev
cfe-dev at lists.llvm.org
Mon Jun 26 13:27:55 PDT 2017
On 2017-06-26 21:37, scott constable via cfe-dev wrote:
> Sorry, I should have clarified. The C/C++ headers are the ones which
> cannot be found. For clarity, here's the output of my tool with the -v
> flag (I've hidden some sensitive names with ***):
>
> clang version 4.0.0 (tags/RELEASE_400/final)
> ignoring nonexistent directory "/***/build-debug/bin/../include/c++/v1"
> ignoring nonexistent directory "/usr/include/c++/v1"
> ignoring nonexistent directory
> "***/build-debug/bin/../lib/clang/4.0.0/include"
> #include "..." search starts here:
> #include <...> search starts here:
> /usr/local/include
> /usr/include
> /System/Library/Frameworks (framework directory)
> /Library/Frameworks (framework directory)
> End of search list.
>
> Both my Xcode clang and my homebrew-installed clang find the headers
> through the relative path "../include/c++/v1". This won't be possible
> with my libtool unless (a) I move my libtool into the directory where
> clang is installed, or (b) I also distribute the C/C++ headers with my
> libtool. Both of these solutions is ugly, so I would prefer something nicer.
If only Xcode is installed the headers are available at:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.1.0/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
This can be verified by running "clang -E - -v < /dev/null". You'll see
the above two paths (or something similar depending on which version of
Xcode) are two of the paths Clang will search in.
If the command line tools are installed as well, the headers will be
available in "/usr/include" as well. As you can see with the above
command, "/usr/include" is one of the paths Clang will search in.
As can be seen in the output from your tool, the paths in
/Applications/Xcode.app are not searched in. Since it doesn't find the
headers I suspect you don't have the command line tools installed.
Note that even though you can invoke "clang" on the command line to
compile code, it doesn't necessarily mean that the command line tools
are installed. You can install the command line tools by running
"xcode-select --instal". If they're already installed, you'll get a message.
All this trouble with these paths are due to, I believe, Apple wants the
Xcode app bundle to be completely self contained and not install
anything outside of it unless the user explicitly asks for it. I'm
guessing this it to be compatible with the App Store.
--
/Jacob Carlborg
More information about the cfe-dev
mailing list