下了官网Pre-built Binaries:Clang for Windows llvm.org/releases/3.5.0/LLVM-3.5.0-win32.exe 03 Sep 2014 3.5.0

The LLVM Compiler Infrastructure(llvm.org) download LLVMllvm.org/releases/

由于刚刚安装了 TDM GCC 4.9.2 tdm64-gcc-4.9.2-3.exe 2014 December 12th(tdm-gcc.tdragon.net)

mklinkC:\mingw指向tdm64-gcc-4.9.2-3安装目录。

  1. /* hello.c */  
  2. #include   
  3.   
  4. int main() {  
  5.   printf("hello world\n");  
  6.   return 0;  
  7. }  

>clang hello.c

hello.c:2:10:fatal error: 'stdio.h' file not found

#include

         ^

1 error generated.


难道又要下载 LLVM + Clang 源代码,修改 llvm-3.5.0.src\tools\clang\lib\Frontend\下的 InitHeaderSearch.cpp,添加tdm64-gcc-4.9.2-3 C/C++ include search path头文件搜索路径,重新编译一次(具体参看旧文Clang+llvm在windows下面怎么配置运行)。看了3.5.0源码,官网Pre-builtBinaries支持到MiniGW 4.8.2难道每次使用新版 MinGW,都要重复这恼人的编译。


现在,告诉你,只要添加几个环境变量即可。

PATH添加 编译器和LLVM+Clang Command Line Path 命令行运行路径。

至于C/C++ include search path 头文件搜索路径:

使用 MinGW 的,要设置:

C_INCLUDE_PATH

CPLUS_INCLUDE_PATH

使用 Visual C++ 的,要设置:

INCLUDE


当然,如果有附加的链接库

MinGW 设置LIBRARY_PATH

VisualC++ 设置LIB


下面以使用 tdm64-gcc-4.9.2 为例:

Run-Clang.bat

[plain] view plain copy
  1. @remset run llvm+clang with mingw path env  
  2. @echooff  
  3. setMINGW_HOME=c:\mingw  
  4. setMINGW_VERSION=4.9.2  
  5. set"PATH=%MINGW_HOME%\bin;%PATH%"  
  6. set"C_INCLUDE_PATH=%MINGW_HOME%\include;%MINGW_HOME%\x86_64-w64-mingw32\include"  
  7. set"CPLUS_INCLUDE_PATH=%C_INCLUDE_PATH%;%MINGW_HOME%\lib\gcc\x86_64-w64-mingw32\%MINGW_VERSION%\include;%MINGW_HOME%\lib\gcc\x86_64-w64-mingw32\%MINGW_VERSION%\include\c++;%MINGW_HOME%\lib\gcc\x86_64-w64-mingw32\%MINGW_VERSION%\include\c++\x86_64-w64-mingw32;%MINGW_HOME%\lib\gcc\x86_64-w64-mingw32\%MINGW_VERSION%\include\c++\backward"  
  8. setLLVM_HOME=c:\llvm  
  9. set"PATH=%LLVM_HOME%\bin;%PATH%"  
  10. %comspec%  


转载请注明引用地址 :http://blog.csdn.net/gocad/article/details/42297829 谢谢

如果使用 tdm32-gcc-4.9.2 则

[plain] view plain copy
  1. C_INCLUDE_PATH=%MINGW_HOME%\include  
  2. CPLUS_INCLUDE_PATH=%MINGW_HOME%\include;%MINGW_HOME%\lib\gcc\mingw32\%MINGW_VERSION%\include;%MINGW_HOME%\lib\gcc\mingw32\%MINGW_VERSION%\include\c++;%MINGW_HOME%\lib\gcc\mingw32\%MINGW_VERSION%\include\c++\mingw32;%MINGW_HOME%\lib\gcc\mingw32\%MINGW_VERSION%\include\c++\backward  
使用其它版本 MinGW 的,请根据各版本实际路径设置。当然也可以自己编辑成像vcvars32.bat带参数调用。


VisualC++ 用户调用现成的Visual Studio Native Tools Command Prompt,或自己调用 vcvars32.bat 设置 Visual C++ 命令行编译环境。 或Installing MSVC integration


下面是有些需要注意的地方

关于 m32/-m64, clang, clang++,clang-cl

默认 ( Target: i686-pc-windows-gnu/i686-pc-windows-msvc,Thread model: posix )

m32( Target:i386-pc-windows-gnu/i386-pc-windows-msvc,Thread model: posix )

m64(Target: x86_64-pc-windows-gnu/x86_64-pc-windows-msvc,Thread model: posix )

这与tdm64-gcc-4.9.2默认-m64不同所以要编译 x64 执行代码请显式调用-m64


还有 tdm64-gcc-4.9.2 默认 m64支持 __int128 is supported on thishost. ( 见c++config.h )

如果同时使用 STL algorithm 与 m32,请将 CPLUS_INCLUDE_PATH 中的%MINGW_HOME%\lib\gcc\x86_64-w64-mingw32\%MINGW_VERSION%\include\c++\x86_64-w64-mingw32更改为%MINGW_HOME%\lib\gcc\x86_64-w64-mingw32\%MINGW_VERSION%\include\c++\x86_64-w64-mingw32\32以免编译错误

如果要用Clang+llvm+MinGW编译 32位执行代码,最好还是使用 MinGW(32),避免因使用 MinGW-w64 设置不恰当,而生成的编译错误。

 

Clang具体调用模式与使用的命令参数,请用v命令选项进行追踪

-v    Show commands to run and use verbose output

例如:

[plain] view plain copy
  1. D:\>clang++ -v hello.c  
  2. clang version 3.5.0 (217039)  
  3. Target: i686-pc-windows-gnu  
  4. Thread model: posix  
  5. clang++.exe: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated  
  6.  "c:\llvm\bin\clang++.exe" -cc1 -triple i686-pc-windows-gnu -emit-obj -mrelax-al  
  7. l -disable-free -main-file-name hello.c -mrelocation-model static -mdisable-fp-e  
  8. lim -fmath-errno -masm-verbose -mconstructor-aliases -target-cpu pentium4 -v -dw  
  9. arf-column-info -resource-dir "c:\\llvm\\bin\\..\\lib\\clang\\3.5.0" -c-isystem  
  10. "c:\\mingw\\include" -c-isystem "c:\\mingw\\x86_64-w64-mingw32\\include" -cxx-is  
  11. ystem "c:\\mingw\\include" -cxx-isystem "c:\\mingw\\x86_64-w64-mingw32\\include"  
  12.  -cxx-isystem "c:\\mingw\\lib\\gcc\\x86_64-w64-mingw32\\4.9.2\\include" -cxx-isy  
  13. stem "c:\\mingw\\lib\\gcc\\x86_64-w64-mingw32\\4.9.2\\include\\c++" -cxx-isystem  
  14.  "c:\\mingw\\lib\\gcc\\x86_64-w64-mingw32\\4.9.2\\include\\c++\\x86_64-w64-mingw  
  15. 32" -cxx-isystem "c:\\mingw\\lib\\gcc\\x86_64-w64-mingw32\\4.9.2\\include\\c++\\  
  16. backward" -fdeprecated-macro -fdebug-compilation-dir "D:\\" -ferror-limit 19 -fm  
  17. essage-length 80 -mstackrealign -fno-use-cxa-atexit -fobjc-runtime=gcc -fcxx-exc  
  18. eptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o "C:\\Temp\  
  19. \hello-0a5974.o" -x c++ hello.c  
  20. clang -cc1 version 3.5.0 based upon LLVM 3.5.0 default target i686-pc-windows-gnu  
  21. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  22. c++/4.7.0"  
  23. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  24. c++/4.7.0/x86_64-w64-mingw32"  
  25. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  26. c++/4.7.0/i686-w64-mingw32"  
  27. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  28. c++/4.7.0/backward"  
  29. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  30. c++/4.7.1"  
  31. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  32. c++/4.7.1/x86_64-w64-mingw32"  
  33. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  34. c++/4.7.1/i686-w64-mingw32"  
  35. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  36. c++/4.7.1/backward"  
  37. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  38. c++/4.7.2"  
  39. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  40. c++/4.7.2/x86_64-w64-mingw32"  
  41. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  42. c++/4.7.2/i686-w64-mingw32"  
  43. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  44. c++/4.7.2/backward"  
  45. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  46. c++/4.7.3"  
  47. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  48. c++/4.7.3/x86_64-w64-mingw32"  
  49. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  50. c++/4.7.3/i686-w64-mingw32"  
  51. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  52. c++/4.7.3/backward"  
  53. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  54. c++/4.8.0"  
  55. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  56. c++/4.8.0/x86_64-w64-mingw32"  
  57. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  58. c++/4.8.0/i686-w64-mingw32"  
  59. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  60. c++/4.8.0/backward"  
  61. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  62. c++/4.8.1"  
  63. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  64. c++/4.8.1/x86_64-w64-mingw32"  
  65. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  66. c++/4.8.1/i686-w64-mingw32"  
  67. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  68. c++/4.8.1/backward"  
  69. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  70. c++/4.8.2"  
  71. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  72. c++/4.8.2/x86_64-w64-mingw32"  
  73. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  74. c++/4.8.2/i686-w64-mingw32"  
  75. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0/../../../include/  
  76. c++/4.8.2/backward"  
  77. ignoring nonexistent directory "c:/MinGW/lib/gcc/mingw32/4.7.0/include/c++"  
  78. ignoring nonexistent directory "c:/MinGW/lib/gcc/mingw32/4.7.0/include/c++/mingw32"  
  79. ignoring nonexistent directory "c:/MinGW/lib/gcc/mingw32/4.7.0/include/c++/backward"  
  80. ignoring nonexistent directory "c:/MinGW/lib/gcc/mingw32/4.7.1/include/c++"  
  81. ignoring nonexistent directory "c:/MinGW/lib/gcc/mingw32/4.7.1/include/c++/mingw32"  
  82. ignoring nonexistent directory "c:/MinGW/lib/gcc/mingw32/4.7.1/include/c++/backward"  
  83. ignoring nonexistent directory "c:/MinGW/lib/gcc/mingw32/4.7.2/include/c++"  
  84. ignoring nonexistent directory "c:/MinGW/lib/gcc/mingw32/4.7.2/include/c++/mingw32"  
  85. ignoring nonexistent directory "c:/MinGW/lib/gcc/mingw32/4.7.2/include/c++/backward"  
  86. ignoring nonexistent directory "c:/MinGW/lib/gcc/mingw32/4.7.3/include/c++"  
  87. ignoring nonexistent directory "c:/MinGW/lib/gcc/mingw32/4.7.3/include/c++/mingw32"  
  88. ignoring nonexistent directory "c:/MinGW/lib/gcc/mingw32/4.7.3/include/c++/backward"  
  89. ignoring nonexistent directory "c:/MinGW/lib/gcc/mingw32/4.8.0/include/c++"  
  90. ignoring nonexistent directory "c:/MinGW/lib/gcc/mingw32/4.8.0/include/c++/mingw32"  
  91. ignoring nonexistent directory "c:/MinGW/lib/gcc/mingw32/4.8.0/include/c++/backward"  
  92. ignoring nonexistent directory "c:/MinGW/lib/gcc/mingw32/4.8.1/include/c++"  
  93. ignoring nonexistent directory "c:/MinGW/lib/gcc/mingw32/4.8.1/include/c++/mingw32"  
  94. ignoring nonexistent directory "c:/MinGW/lib/gcc/mingw32/4.8.1/include/c++/backward"  
  95. ignoring nonexistent directory "c:/MinGW/lib/gcc/mingw32/4.8.2/include/c++"  
  96. ignoring nonexistent directory "c:/MinGW/lib/gcc/mingw32/4.8.2/include/c++/mingw32"  
  97. ignoring nonexistent directory "c:/MinGW/lib/gcc/mingw32/4.8.2/include/c++/backward"  
  98. ignoring nonexistent directory "/usr/include/c++/4.4"  
  99. ignoring nonexistent directory "/usr/local/include"  
  100. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0\../../../i686-w64  
  101. -mingw32/include"  
  102. ignoring nonexistent directory "c:\llvm\bin\..\lib\clang\3.5.0\../../../x86_64-w  
  103. 64-mingw32/include"  
  104. ignoring nonexistent directory "/mingw/include"  
  105. ignoring nonexistent directory "/usr/include"  
  106. ignoring duplicate directory "c:\mingw\include"  
  107. #include "..." search starts here:  
  108. #include  search starts here:  
  109.  c:\mingw\include  
  110.  c:\mingw\x86_64-w64-mingw32\include  
  111.  c:\mingw\lib\gcc\x86_64-w64-mingw32\4.9.2\include  
  112.  c:\mingw\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++  
  113.  c:\mingw\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\x86_64-w64-mingw32  
  114.  c:\mingw\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\backward  
  115.  c:\llvm\bin\..\lib\clang\3.5.0\include  
  116.  c:\llvm\bin\..\lib\clang\3.5.0\../../../include  
  117. End of search list.  
  118.  "c:\mingw\bin\g++.exe" -v -m32 -o a.out "C:\\Temp\\hello-0a5974.o"  
  119. Using built-in specs.  
  120. COLLECT_GCC=c:\mingw\bin\g++.exe  
  121. COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/x86_64-w64-mingw32/4.9.2/lto-wra  
  122. pper.exe  
  123. Target: x86_64-w64-mingw32  
  124. Configured with: ../../../src/gcc-4.9.2/configure --build=x86_64-w64-mingw32 --e  
  125. nable-targets=all --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable  
  126. -libgomp --enable-lto --enable-graphite --enable-cxx-flags=-DWINPTHREAD_STATIC -  
  127. -disable-build-with-cxx --disable-build-poststage1-with-cxx --enable-libstdcxx-d  
  128. ebug --enable-threads=posix --enable-version-specific-runtime-libs --enable-full  
  129. y-dynamic-string --enable-libstdcxx-threads --enable-libstdcxx-time --with-gnu-l  
  130. d --disable-werror --disable-nls --disable-win32-registry --prefix=/mingw64tdm -  
  131. -with-local-prefix=/mingw64tdm --with-pkgversion=tdm64-1 --with-bugurl=http://td  
  132. m-gcc.tdragon.net/bugs  
  133. Thread model: posix  
  134. gcc version 4.9.2 (tdm64-1)  
  135. COMPILER_PATH=c:/mingw/bin/../libexec/gcc/x86_64-w64-mingw32/4.9.2/;c:/mingw/bin  
  136. /../libexec/gcc/;c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x8  
  137. 6_64-w64-mingw32/bin/  
  138. LIBRARY_PATH=c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/32/;c:/mingw/bin/.  
  139. ./lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/lib/../lib32/;  
  140. c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/;c:/mingw/bin/../lib/gcc/;C:/Mi  
  141. nGW/lib/;D:/dev/msys64/usr/lib/;c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2  
  142. /../../../../x86_64-w64-mingw32/lib/;c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/  
  143. 4.9.2/../../../  
  144. COLLECT_GCC_OPTIONS='-v' '-m32' '-o' 'a.out' '-mtune=generic' '-march=x86-64'  
  145.  c:/mingw/bin/../libexec/gcc/x86_64-w64-mingw32/4.9.2/collect2.exe -plugin c:/mi  
  146. ngw/bin/../libexec/gcc/x86_64-w64-mingw32/4.9.2/liblto_plugin-0.dll -plugin-opt=  
  147. c:/mingw/bin/../libexec/gcc/x86_64-w64-mingw32/4.9.2/lto-wrapper.exe -plugin-opt  
  148. =-fresolution=C:\Temp\cc83PMcQ.res -plugin-opt=-pass-through=-lmingw32 -plugin-o  
  149. pt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-th  
  150. rough=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-lp  
  151. thread -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32  
  152. -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-  
  153. opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-th  
  154. rough=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-  
  155. lmsvcrt -m i386pe --exclude-libs=libpthread.a -Bdynamic -o a.out c:/mingw/bin/..  
  156. /lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/lib/../lib32/cr  
  157. t2.o c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-min  
  158. gw32/lib/../lib32/crtbegin.o -Lc:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/  
  159. 32 -Lc:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-min  
  160. gw32/lib/../lib32 -Lc:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2 -Lc:/mingw/  
  161. bin/../lib/gcc -LC:/MinGW/lib -LD:/dev/msys64/usr/lib -Lc:/mingw/bin/../lib/gcc/  
  162. x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/lib -Lc:/mingw/bin/../li  
  163. b/gcc/x86_64-w64-mingw32/4.9.2/../../.. C:\Temp\hello-0a5974.o -Bstatic -lstdc++  
  164.  -Bdynamic -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -l  
  165. shell32 -luser32 -lkernel32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt c:/min  
  166. gw/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/lib/..  
  167. /lib32/crtend.o  
  168.   
  169. D:\>  


另外就是,关于 --driver-mode 参数:

clang++等效于 clang--driver-mode=g++

clang-cl等效于 clang--driver-mode=cl

--driver-mode可以覆盖内置或默认值:clang-cl --driver-mode=g++ 等效于 clang++

目前,clang-cl 编译 VC x64/amd64 STL algorithm 时,有时会编译不通过,如:

  1. error LNK2019: unresolved external  
  2.  symbol __cxa_call_unexpected referenced in function "public: __int64 __cdecl std::_Temp_iterator::_Maxlen(void)" (?_Maxlen@?$_Temp_iterator@J@std@@QEAA_JXZ)  
  3. error LNK2001: unresolved external  
  4.  symbol __gxx_personality_v0  


参考LLVM/Clang On Windows 2013_09my.oschina.net/GIIoOS/blog/165542

下面引自(c.tieba.baidu.com/p/3290080396


  1. 关于 LLVM Clang。目前 Clang 在 Windows 下都是基于 MingW 的库,所以编译/链接的时候需要把相应的路径设置好。在我的绿色便携版中都已经设置好了。  
llvm-3.5.0.src\tools\clang\tools\driver\driver.cpp


  1. Clang在Windows上呈现有三种实现,一种是使用VisualStudio,一种是Mingw,还有一种是Cygwin,clang用一个参数是驱动模式--driver-mode  
  2. driver.cpp  
  3. staticconst struct {  
  4. const char*Suffix;  
  5. const char*ModeFlag;  
  6. } suffixes[] = {  
  7. {"clang", nullptr },  
  8. {"clang++""--driver-mode=g++" },  
  9. {"clang-c++""--driver-mode=g++" },  
  10. {"clang-cc", nullptr },  
  11. {"clang-cpp""--driver-mode=cpp" },  
  12. {"clang-g++""--driver-mode=g++" },  
  13. {"clang-gcc", nullptr },  
  14. {"clang-cl""--driver-mode=cl" },  
  15. {"cc", nullptr },  
  16. {"cpp""--driver-mode=cpp" },  
  17. {"cl" , "--driver-mode=cl" },  
  18. {"++""--driver-mode=g++" },  
  19. };  
 

下面引自Clang Compiler User’s Manual(clang.llvm.org/docs/UsersManual.html)

X86

The support for X86 (both 32-bit and 64-bit) is considered stable onDarwin (Mac OS X), Linux, FreeBSD, and Dragonfly BSD: it has been tested tocorrectly compile many large C, C++, Objective-C, and Objective-C++ codebases.

On x86_64-mingw32, passing i128(by value)is incompatible with the Microsoft x64 calling convention. You might need totweak WinX86_64ABIInfo::classify() in lib/CodeGen/TargetInfo.cpp.

For the X86 target, clang supports the -m16 command line argument which enables16-bit code output. This is broadly similar to using asm(".code16gcc") with the GNU toolchain.The generated code and the ABI remains 32-bit but the assembler emitsinstructions appropriate for a CPU running in 16-bit mode, with address-sizeand operand-size prefixes to enable 32-bit addressing and operations.

 

MinGW32

Clang works on some mingw32 distributions. Clang assumes directories asbelow;

  • C:/mingw/include
  • C:/mingw/lib
  • C:/mingw/lib/gcc/mingw32/4.[3-5].0/include/c++

On MSYS, a few tests might fail.

MinGW-w64

For 32-bit (i686-w64-mingw32), and 64-bit (x86_64-w64-mingw32), Clangassumes as below;

  • GCC versions 4.5.0 to 4.5.3, 4.6.0 to 4.6.2, or 4.7.0 (for the C++ header search path)
  • some_directory/bin/gcc.exe
  • some_directory/bin/clang.exe
  • some_directory/bin/clang++.exe
  • some_directory/bin/../include/c++/GCC_version
  • some_directory/bin/../include/c++/GCC_version/x86_64-w64-mingw32
  • some_directory/bin/../include/c++/GCC_version/i686-w64-mingw32
  • some_directory/bin/../include/c++/GCC_version/backward
  • some_directory/bin/../x86_64-w64-mingw32/include
  • some_directory/bin/../i686-w64-mingw32/include
  • some_directory/bin/../include

This directory layout is standard for any toolchain you will find on theofficial MinGW-w64 website.

Clang expects the GCC executable “gcc.exe” compiled for i686-w64-mingw32 (or x86_64-w64-mingw32) to be present on PATH.

Some tests might fail on x86_64-w64-mingw32.

clang-cl is an alternative command-line interface to Clang driver,designed for compatibility with the Visual C++ compiler, cl.exe.

To enable clang-cl to find system headers, libraries, and the linker whenrun from the command-line, it should be executed inside a Visual Studio NativeTools Command Prompt or a regular Command Prompt where the environment has beenset up using e.g. vcvars32.bat.

clang-cl can also be used from inside Visual Studio by using an LLVMPlatform Toolset.

转载请注明引用地址 :http://blog.csdn.net/gocad/article/details/42297829 谢谢


10-03 14:33