Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run cling on Windows

Is it possible to run cling on Windows?

I successfully compiled cling from sources (build instructions) with Visual C++ 12.0, but when I try to run I have the following runtime error:

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

I googled next link:

  • Building Cling (the C++ interpreter) on Windows - I don't want to use Cygwin and the article is two years old.

BTW, I have Clang (Clang version 3.6.0 (trunk)) and everything works fine.

When I run with cling -x c, I still have the same error, but without assertion (-x means treat subsequent input files as having type <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]$

From this link:

The limitation of cling on Windows comes from the fact that clang doesn't support fully windows mangling scheme, i.e it is not binary compatible. For example, one cannot call a function compiled with other than clang/gcc compiler. - There is a lot of progress in that direction recently on the clang side. We should investigate why cling chalks up. I.e is everything set up correctly in the CIFactory in the case where the OS is windows. - Since C doesn't have mangling cling in C mode must be working on Windows (i.e cling -x c)

... This is an issue which we intend to work on soon and patches are very welcome.

like image 490
grisha Avatar asked Sep 11 '14 14:09

grisha


People also ask

What is cling C++?

Cling is an interactive C++ interpreter, built on top of the Clang and LLVM compiler infrastructure. The interpreter enables interactive exploration and makes the C++ language more welcoming for research.

What is cling 2015?

What is Cling. Cling is an interactive C++ interpreter, built on the top of LLVM and Clang libraries. Its advantages over the standard interpreters are that it has command line prompt and uses just-in-time (JIT) compiler for compilation.


1 Answers

From this link:

The limitation of cling on Windows comes from the fact that clang doesn't support fully windows mangling scheme, i.e it is not binary compatible. For example, one cannot call a function compiled with other than clang/gcc compiler.

  • There is a lot of progress in that direction recently on the clang side. We should investigate why cling chalks up. I.e is everything set up correctly in the CIFactory in the case where the OS is windows.

  • Since C doesn't have mangling cling in C mode must be working on Windows (i.e cling -x c)

... This is an issue which we intend to work on soon and patches are very welcome.

like image 139
grisha Avatar answered Oct 11 '22 05:10

grisha