在Windows上运行cling

gri*_*sha 8 c++ windows llvm cling

是否可以在Windows上运行cling?

我使用Visual C++ 12.0 从源代码(构建指令)成功编译了cling ,但是当我尝试运行时,我遇到以下运行时错误:

F:\Dev\open-source\Cling\src\build\Debug\bin>cling.exe
ERROR in cling::CIFactory::createCI():
  resource directory F:\Dev\open-source\Cling\src\build\Debug\lib\clang\3.6.0 not found!
Assertion failed: !CurTokenLexer && "Cannot #include a file inside a macro!", file ..\..\..\..\..\tools\clang\lib\Lex\PPLexerChange.cpp, line 73
Run Code Online (Sandbox Code Playgroud)

我google了下一个链接:

顺便说一句,我有Clang(Clang版本3.6.0(主干)),一切正常.

当我运行时cling -x c,我仍然有相同的错误,但没有断言(-x意味着将后续输入文件视为类型<language>):

F:\Dev\open-source\Cling\src\build\Debug\bin>cling -x c
ERROR in cling::CIFactory::createCI():
  resource directory F:\Dev\open-source\Cling\src\build\Debug\lib\clang\3.6.0 not found!

****************** CLING ******************
* Type C++ code and press enter to run it *
*             Type .q to exit             *
*******************************************
[cling]$ #include <stdio.h>
[cling]$ printf("%s", "test");
test
[cling]$
Run Code Online (Sandbox Code Playgroud)

从这个链接:

对Windows的依赖限制来自clang不支持完全窗口修改方案的事实,即它不是二进制兼容的.例如,一个人不能调用用clang/gcc编译器以外编译的函数. - 最近在铿锵一侧朝着这个方向取得了很多进展.我们应该调查为什么要坚持下去.即在操作系统是Windows的情况下,在CIFactory中正确设置的所有内容. - 由于C在C模式下没有修复,因此必须在Windows上工作(即cling -xc)

...... 这是一个我们打算尽快解决的问题,非常欢迎补丁.

gri*_*sha 5

从这个链接

cling 在 Windows 上的限制来自于 clang 不完全支持 windows mangling 方案,即它不是二进制兼容的。例如,不能调用使用 clang/gcc 编译器以外的编译器编译的函数。

  • clang 最近在这个方向上取得了很多进展。我们应该调查为什么要坚持粉笔。即,在操作系统为 Windows 的情况下,CIFactory 中的所有内容均已正确设置。

  • 由于 C 没有损坏,C 模式下的 cling 必须在 Windows 上工作(即 cling -xc)

... 这是我们打算尽快解决的问题,非常欢迎提供补丁。