[LLVMdev] include's are not being located

Joseph Morgan its.jojo.77 at gmail.com
Tue Jun 17 07:08:28 PDT 2014


> It will help with debugging this to see the output of all of these:
> 
> $ echo $PATH
> $ pwd
> $ find . -name clang++
> $ find . -name llvm-config
> $ which llvm-config
> $ which clang++
> $ llvm-config --*cppflags* --ldflags --libs core -v
> $ clang++ -g -O3 toy.cpp `llvm-config --cxxflags --ldflags --libs core` -o toy -v
> 
> My suspicion is that this is picking the just-built llvm-config and the clang++ is the system provided one. I think you need to use full paths to make sure you're getting *both* of the just-built ones instead.

Hi Jon,

Using the following: clang++ -g -O3 toy.cpp `llvm-config --cxxflags --ldflags --libs core --system-libs` -o toy 

I was able to compile the tutorial successfully.

Although I have been able to successfully compile the tutorial as I noted in another response to this thread earlier this morning, I wanted to post the output of the commands you suggest. I’m hoping to find out why I have to use apparently “special” options when compiling the tutorial. Here’s the output:

echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

pwd
/Users/josephmorgan

find . -name clang++
./build/Debug+Asserts/bin/clang++

find . -name llvm-config
./build/Debug+Asserts/bin/clang++
find: ./Library/Saved Application State/com.bitrock.installbuilder.savedState: Permission denied

which llvm-config
/usr/local/bin/llvm-config

which clang++
/usr/bin/clang++

llvm-config --cppflags 
-I/usr/local/include  -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS

llvm-config --ldflags
-L/usr/local/lib 

llvm-config --libs core 
-lLLVMCore -lLLVMSupport

clang++ -g -O3 toy.cpp `llvm-config --cxxflags --ldflags --libs core` -o toy -v
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.2.0
Thread model: posix
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.9.0 -emit-obj -disable-free -disable-llvm-verifier -main-file-name toy.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 224.1 -v -g -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -D _DEBUG -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -I /usr/local/include -stdlib=libc++ -O3 -Woverloaded-virtual -Wcast-qual -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /Users/josephmorgan -ferror-limit 19 -fmessage-length 80 -fvisibility-inlines-hidden -stack-protector 1 -mstackrealign -fblocks -fno-rtti -fobjc-runtime=macosx-10.9.0 -fobjc-dispatch-method=mixed -fobjc-default-synthesize-properties -fencode-extended-block-signature -fno-common -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/tb/0bmsh_9179z57k1_hg4m36jr0000gn/T/toy-AtHsw2.o -x c++ toy.cpp
clang -cc1 version 5.0 based upon LLVM 3.3svn default target x86_64-apple-darwin13.2.0
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/v1"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.0/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks (framework directory)
End of search list.
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.9.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -o toy -L/usr/local/lib /var/folders/tb/0bmsh_9179z57k1_hg4m36jr0000gn/T/toy-AtHsw2.o -lLLVMCore -lLLVMSupport -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.0/lib/darwin/libclang_rt.osx.a


Thank you,

Joseph Morgan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140617/7a5d588f/attachment.html>


More information about the llvm-dev mailing list