Advertisement
JetForMe

Untitled

Dec 26th, 2012
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. I think this is down to some differences in how clang is invoked for compilation and linking. The example I'm basing my usage off is is the Kaleidoscope Tutorial part 3. Note the build invocation, a single call to clang++ (this works fine):
  2.  
  3. http://llvm.org/docs/tutorial/LangImpl3.html#full-code-listing
  4.  
  5. This ends up calling
  6.  
  7. clang++
  8. -g -O3 toy.cpp
  9. -I/usr/local/llvm/include
  10. -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS
  11. -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
  12. -L/usr/local/llvm/lib -lpthread -lm
  13. -lLLVMCore -lLLVMSupport
  14. -o toy
  15.  
  16. But Xcode gives me lots of STL link errors. Xcode does this in two steps (with a lot of other cruft). I added the -D equivalents and the search paths and libraries to link to the Xcode project. The first step calls (I tried to bring in only the relevant options; there are many more):
  17.  
  18. clang
  19. -x c++ -g
  20. -O0
  21. -std=gnu++11
  22. -stdlib=libc++
  23. -D_DEBUG
  24. -D_GNU_SOURCE
  25. -D__STDC_CONSTANT_MACROS
  26. -D__STDC_FORMAT_MACROS
  27. -D__STDC_LIMIT_MACROS
  28. -c <path>/libLLVM.cp
  29. -o <path>/libLLVM.o
  30.  
  31. clang++
  32. -L/usr/local/llvm/lib
  33. -filelist <a file that contains path to libLLVM.o>
  34. -stdlib=libc++
  35. -lLLVMCore
  36. -lLLVMSupport
  37. -single_module
  38. -o <path>libLLVM.dylib
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement