Axel Naumann on
Hi,
We, the cling team, have announced cling, our C++ interpreter prototype! (note: its SVN repository has changed compared with the announcement email; see the build instructions)
To a large extend thanks to Vassil's impressive commitment, cling now behaves like a good C++ interpreter: it runs C++ code that's entered, and prints the results.
[cling]$ #include <cmath>
[cling]$ double x = std::sin(3.1)
(double) 4.158066e-02
[cling]$ .L libz
[cling]$ #include "zlib.h"
[cling]$ zlibVersion()
(const char * const) "1.2.3.4"
$ echo 'extern "C" const char* zlibVersion();
zlibVersion()' | cling -lz
(const char * const) "1.2.3.4"
We have of course already added a few features that we liked from CINT - but cling is a completely new development, based on clang and llvm, a set of compiler libraries (to simplify the matter a bit :-) Vassil will present the innards of cling probably in October; I will post the slides here.
So what's special about cling? It's based on a production-grade compiler and it's designed taking decades of experience with CINT into account. And it doesn't need dictionaries! (Disclaimer: that does not mean that ROOT can do without, automatically. But that's our goal, of course.)
The next steps will be the ones most relevant for High Energy Physics: integration into ROOT (Paul is already working on that) and reloading of changed code (.x myCode.C, edit, .x myCode.C). That latter part is horrible for a compiler.
If you want to check cling out you can simply compile it yourself - it's really easy. I'd love to have an interactive, web-based interface once, but an online C++ interpreter is an invitation for script kiddies to hack the server :-( If you have an idea how to do it please let me know!
Cheers,
Comments
Submitted by Anonymous (not verified) on Mon, 01/12/2015 - 09:50 Permalink
cross build cling for windows 32bit, try to load dll file
I use the cross build toolchian built a cling for windows 32 bits, and modify some source code in CIFactory.cpp (find the include path). the cling.exe can do "printf("test!\n");", but it cannot load the dll file, dose it have any plan to support in windows system?? Thanks, ChuYuan Chiang
Submitted by Anonymous (not verified) on Thu, 11/22/2012 - 22:47 Permalink
Hi ChuYuan Chiang,
Hi ChuYuan Chiang,
Thanks for your question! There are two parts. For not being able to load a DLL, that's a bug that you can now follow up in our bug tracker. We might not be able to reproduce the issue; it would be good if you could provide us with more information of how exactly it fails, e.g. by sending the error message to cling-dev@cern.ch
Windows support is still severely limited: we currently cannot use the newest clang which has much improved "native" Windows C++ ABI support. OTOH, C on Windows should just work. We are planning on getting cling to work with the head of clang's trunk again during the first half of this year.
Cheers, Axel
Submitted by Anonymous (not verified) on Tue, 01/13/2015 - 10:42 Permalink
Hi Axel, Is planned cling to
Hi Axel, Is planned cling to work with Visual Studio 2013 64 bit after the first half of this year ? As far as I understand the current cling version C language should work with Visual Studio 2013 ? Thanks, Vladimir
Submitted by Anonymous (not verified) on Tue, 03/17/2015 - 20:50 Permalink
Re: cling on MSVC 2013 64bit
Hi Vladimir,
Good question! My colleague Bertrand is making lots of progress with Windows support: cling now works with the newest MSVC in C++ mode (with exceptions off)! We currently plan to get ROOT 6 to work with 32bit first and deal with 64bit later.
Cheers, Axel.
Submitted by Anonymous (not verified) on Fri, 03/20/2015 - 20:53 Permalink
How does one build with MSVC
How does one build with MSVC ? Any chance you could tell us some of the steps you/Bertrand did to build the latest cling with MSVC?
Submitted by Anonymous (not verified) on Tue, 03/31/2015 - 14:28 Permalink
Re: How does one build with MSVC
Hi!
Bertrand has added to the cling build instrucions page to explain how to build cling on Windows.
Cheers, Axel.
Submitted by Vladimir (not verified) on Wed, 01/06/2016 - 14:51 Permalink
Any progress to support MSVC
Any progress to support MSVC 2013+ Windows 64bit during 2015 ?
Submitted by Axel Naumann on Sat, 04/16/2016 - 15:32 Permalink
Re: Any progress to support MSVC
Hi Vladimir,
2016 is the year for cling on MSVC! ;-) I am currently updating cling to work with the current master of llvm + clang. Once that's done we will revisit cling on MSVC. We know that clang's support has become much more complete.
Cheers, Axel.
Submitted by Anonymous (not verified) on Wed, 04/08/2015 - 15:33 Permalink
cling vs alternatives
Hi, How you would briefly compare cling with alternative projects: Ceemple, Julia, chaiscript ? Thanks, Vladimir
Submitted by Anonymous (not verified) on Sat, 08/30/2014 - 17:36 Permalink
Re: cling vs alternatives
Hi Vladimir,
Well, cling for for C++, to begin with :-) You're welcome to do a proper comparison and post the link here!
Cheers, Axel
Submitted by Anonymous (not verified) on Tue, 09/09/2014 - 10:39 Permalink
Is it possible to redefine
Is it possible to redefine (unload or clean) functions, variables and classes in cling interpretator?
Submitted by Anonymous (not verified) on Fri, 04/11/2014 - 13:14 Permalink
Re: unloading
Hi Andrey,
Thanks for your question! Yes, since recently you can undo declarations; ".undo 2" reverts the two previous declarations.
Cheers, Axel.
Submitted by Anonymous (not verified) on Wed, 04/16/2014 - 09:19 Permalink
Windows support
Is there any progress to support Windows ?
Submitted by Anonymous (not verified) on Wed, 07/17/2013 - 20:26 Permalink
Re: Windows support
Hi Vladimir,
Some progress on the clang side, but fundamental things still didn't work last time we tried. I will definitely post once Windows support is there!
Cheers, Axel.
Submitted by Anonymous (not verified) on Thu, 07/18/2013 - 15:41 Permalink
C scripting for Windows until C++ scripting will be available
Is it possible to have fully working C only version for Windows until Clang will properly support Windows C++ ? I mean C scripting from VS C++ ...
Submitted by Anonymous (not verified) on Thu, 09/26/2013 - 11:42 Permalink
Re: C scripting for Windows
Hi Vladimir,
Brilliant idea! Like that it's not useful for ROOT and we cannot run the cling test suite - but at least we can build it! Watch the commit logs for updates - but I suspect that this will not arrive for another month... we are approaching an integration deadline for ROOT and a conference is coming up.
Thanks again for your suggestion!
Cheers, Axel.
Submitted by Anonymous (not verified) on Mon, 10/07/2013 - 09:08 Permalink
Safety idea
There is a similar project called geordi-prime, it's a haskell-based c++ eval irc bot. The only difference is that it cannot keep state. Anyway, it's publicly available on freenode irc (and countless copies are available elsewhere) and it seems its safety measures are more than enough for irc wannabe hackers. The web-based cling could use the same idea to make sure its safe.
The webpage of geordi-prime: http://www.eelis.net/geordi/
Submitted by Anonymous (not verified) on Tue, 01/15/2013 - 23:16 Permalink
Cling is really great !!!
Cling is really great !!!
I was able to integrate it in my System on Windows and not I can use C++11 interactively.
Unfortunately there are still some problems with it.
If I try to do following:
#include "my_header.h"
and header includes some other headers that Cling can not find then it will
CRASH in ASTNodeEraser.cpp .
Submitted by Anonymous (not verified) on Mon, 10/15/2012 - 15:04 Permalink
Re: cling on Windows
Hi Devid,
Thanks for trying it out! As we said quite a few times already: cling is not supported on Windows yet. I'm surprised it even starts up. Sorry. This is only going to change next year. We do welcome patches even before, though!
Cheers, Axel
Submitted by Anonymous (not verified) on Tue, 10/16/2012 - 03:01 Permalink
Problem interpreting a function
Hello, I've successfully compiled Cling on Mac OSX and seems to work for simple C++ expressions. However when I try to create a C++ function I have a strange error:
This is expected behaviour or am I doing something wrong ?
Submitted by Anonymous (not verified) on Mon, 08/13/2012 - 20:06 Permalink
Use .rawInput
Hi,
The preparseing doesn't work yet and defining a function should happen with the meta command:
Vassil
Submitted by Anonymous (not verified) on Mon, 08/06/2012 - 19:56 Permalink
build time of cling
Hello, The statement "If you want to check cling out you can simply compile it yourself - it's really easy." sounds interesting ... but the time to build cling is extremely high. It takes round about 12h on dual core machine (2.2 Ghz) ! Is there a way to get a binary version for i386 LINUX ? --Armin
Submitted by Anonymous (not verified) on Wed, 08/29/2012 - 16:24 Permalink
Re: Build time
Hi Armin,
No way does it take 12h, something must be terribly wrong with your setup. It should take < 30 minutes even on a laptop. Nevertheless you can pick up a binary version of cling here: https://ecsft.cern.ch/dist/cling Don't be scared by the invalid SSL certificate: it's the best CERN can give to us...
Cheers, Axel
Submitted by Anonymous (not verified) on Wed, 05/09/2012 - 11:32 Permalink
clang/cling for Windows 32/64 - is there any progress ?
Is there any progress in supporting Windows 32/64 by clang/cling ? I cannot wait when I could start with cling on Windows platform :-)
Submitted by Anonymous (not verified) on Wed, 08/29/2012 - 16:25 Permalink
Re: Win progress
Hi Vladimir,
Not that I am aware of. We will only get to that next year - unless someone else contributes patches before.
Cheers, Axel.
Submitted by Anonymous (not verified) on Fri, 05/04/2012 - 01:18 Permalink
minor windoze build issue
Submitted by Anonymous (not verified) on Fri, 05/04/2012 - 10:48 Permalink
Re: minor windoze build issue
Hi,
Okay, so you are building with GCC on Windows - which one, MingW or cygwin? None of that has ever been tried to my knowledge, and it's unfortunate that the linker doesn't cope with the exports table.
The local_cxa_atexit symbol might not even be needed when building with GCC. Could you open a bug report at https://savannah.cern.ch/bugs/?func=additem&group=savroot? I cannot promise that this will get fixed soon, foryhour configuration, but I would nonetheless like to have a reminder that this issue exists.
For now you are much better off building cling on Linux or MacOS. Take a virtual machine and off you go!
Cheers, Axel
Submitted by Anonymous (not verified) on Mon, 05/07/2012 - 11:21 Permalink
I'm sorry but i'm total noob
I'm sorry but i'm total noob at linux Axel :) I dunno why, everytime i try linux it took less than a day to make me revert to windoze XP :D I use gcc 4.6.3 mingw/msys. you mean that wildcard supposed to resolved by the gcc's linker?
Submitted by Anonymous (not verified) on Wed, 08/29/2012 - 16:27 Permalink
Re: mingw build
Hi,
Sorry - if you cannot get it to work on Windows yourself you're out of luck for now... We will attack cling on Windows only next year.
Cheers, Axel.
Submitted by Anonymous (not verified) on Fri, 05/04/2012 - 01:09 Permalink
Hi Axl, I build latest cling
Hi Axl, I build latest cling for windows, apparently load module .L doesn't work as expected (in the example) [cling]$ .L libz input_line_6:1:10: fatal error: 'libz' file not found #include "libz" Load file failed. I have put zlib.dll zlib.dll.a zlib.a in current folder. Even set LLVM_LIB_SEARCH_PATH doesn't help. More importantly why it treated as #include "libz"? Thank you Axl, cling is great for learning!
Submitted by Anonymous (not verified) on Fri, 05/04/2012 - 10:42 Permalink
Re: libz on Windows
Hi,
"zlib" and "libz" are not the same words :-) Try to rename it to libz.dll, or try .L zlib. And please remember that Windows support is still limited for cling due to clang not fully supporting the Windows C++ API yet.
I'm happy to hear that you like cling, even though you take the rocky Windows road!
Cheers, Axel
Submitted by Anonymous (not verified) on Mon, 05/07/2012 - 11:09 Permalink
This time I tried diagnose it
Submitted by Anonymous (not verified) on Wed, 08/29/2012 - 16:28 Permalink
Re: Windows dlopen
Hi,
Sorry, we'll be able to help with the Windows build only next year.
Cheers, Axel.
Submitted by Anonymous (not verified) on Thu, 05/03/2012 - 05:54 Permalink
Syntax Error
After I use the make command in the build directory I get this error. I am trying to compile cling. SyntaxError: invalid syntax make[2]: Entering directory
/home/ryan/Documents/build/tools/cling' llvm[2]: Updating Makefile make[2]: Leaving directory
/home/ryan/Documents/build/tools/cling' svn: '/home/ryan/Documents/llvm' is not a working copy File "", line 1 if >= : print "skip" ^ Any help would be appreciated. Thank You.Submitted by Anonymous (not verified) on Fri, 05/04/2012 - 10:37 Permalink
Re: Syntax Error
Hi,
Can you submit a bug report at https://savannah.cern.ch/bugs/?func=additem&group=savroot, giving the full build log and the output of "svn diff /home/ryan/Documents/llvm"? My suspicion in that you moved / renamed directories after configuring...
Cheers, Axel
Submitted by Anonymous (not verified) on Tue, 05/01/2012 - 22:45 Permalink
clang++
I have built clang/llvm but clang++ doesnt seem to work and i think it could potentially be due to the fact that clang++ only works with mac os as far as i know..could i still run cling if clang++ doesnt work...just to clarify clang works perfectly and it compiles my c code flawlessly just clang++ doesnt work. I am using ubuntu 10.04 Thanks!
Submitted by Anonymous (not verified) on Mon, 08/27/2012 - 20:19 Permalink
Actually clang++ works just
Actually clang++ works just fine on Linux, have a look at this article: http://solarianprogrammer.com/2011/10/16/llvm-clang-libc-linux/
Submitted by Anonymous (not verified) on Wed, 05/02/2012 - 09:55 Permalink
Re: clang++
Hi,
Please discuss clang issues at the clang mailing list cfe-dev@cs.uiuc.edu.
Cheers, Axel.
Submitted by Anonymous (not verified) on Thu, 04/26/2012 - 14:18 Permalink
"LastKnownGoodSVNRevision" of cling for ROOT?
Hello, since i get some errors both during linking (of rootcling_tmp; gives undefined symbol _ZTVN5clang13PragmaHandlerE, though libCling.so is on the path) and compiling (no matching function for call to ‘cling::Interpreter::createUniqueName()’) of ROOT with cling enabled, is it possible to have smth similar to cling's LastKnownGoodLLVMSVNRevision.txt in ROOT? i.e. some way of telling which revision of Cling does the currently checked-out ROOT revision compile (and link) with?
cheers, Constantin
Submitted by Anonymous (not verified) on Wed, 03/21/2012 - 16:18 Permalink
Re: cling and ROOT
Hi Constantin!
Thanks for your question. cling is now distributed as part of ROOT, so there cannot be any revision mismatch.
I have updated the build instructions - maybe it's now clearer that one should not build cling next to clang if using ROOT. And I assume that's what's happening in your case, because you seem to have an old libCling used by a new rootcling.
Also, please submit bug reports like this to Savannah, that help's us triaging them properly. Thanks!
Cheers, Axel
Submitted by Anonymous (not verified) on Tue, 03/27/2012 - 18:37 Permalink
osx link issue
Any help much appreciated: llvm[4]: Linking Debug+Asserts Shared Library libcling.dylib Undefined symbols: "llvm::APInt::initSlowCase(unsigned int, unsigned long, bool)", referenced from: -exported_symbol[s_list] command line option "cling::Interpreter::executeFile(std::basic_string, std::allocator > const&)", referenced from: -exported_symbol[s_list] command line option
Submitted by Anonymous (not verified) on Tue, 04/03/2012 - 03:35 Permalink
Re: link issue
Hi,
Thanks for your report - should be fixed! But please future report bugs at our bug tracker.
Cheers, Axel.
Submitted by Anonymous (not verified) on Wed, 04/04/2012 - 08:42 Permalink
Thanks for the fix. I'll use
Thanks for the fix. I'll use your bug tracker in the future. I wasn't certain that it was a bug and not just something missing on my end. I still get one undefined symbol with latest SVN: "cling::Interpreter::createUniqueName()", referenced from: -exported_symbol[s_list] command line option
Submitted by Anonymous (not verified) on Wed, 03/21/2012 - 04:22 Permalink
Re: bug tracker
Hi,
Thanks for your reports; these things just happen because we still haven't integrated cling into our continuous integration system. I assume it was you who submitted this as a bug on savannah, that's really helpful, thanks a lot!
Cheers, Axel
Submitted by Anonymous (not verified) on Tue, 03/27/2012 - 18:37 Permalink
osx link issue
What would cause this after clang builds fine: llvm[4]: Linking Debug+Asserts Shared Library libcling.dylib Undefined symbols: "llvm::APInt::initSlowCase(unsigned int, unsigned long, bool)", referenced from: -exported_symbol[s_list] command line option "cling::Interpreter::executeFile(std::basic_string, std::allocator > const&)", referenced from: -exported_symbol[s_list] command line option "cling::Interpreter::loadFile(std::basic_string, std::allocator > const&, std::basic_string, std::allocator > const*, bool)", referenced from: -exported_symbol[s_list] command line option "cling::MetaProcessor::process(char const)", referenced from: -exported_symbol[s_list] command line option (maybe you meant: cling::MetaProcessor::process(char const, cling::Value*))
Submitted by Anonymous (not verified) on Thu, 02/23/2012 - 15:33 Permalink
Re: link issue
Hi,
Thanks for your report - should be fixed! But please future report bugs at our bug tracker.
Cheers, Axel.
Submitted by Anonymous (not verified) on Thu, 02/23/2012 - 18:21 Permalink
cling.exe hangs up ...
I use win32 compiled cling.exe, it hangs up in the simplest cases: int i=1; - OK int i=1 - without ";" - hangs up ++i; - OK ++i - hangs up #include "stdio.h" - OK #include "math.h" - hangs up #include "math_not_exist.h" - OK, informs about error What going wrong in these cases ? Thanks, Vladimir
Submitted by Anonymous (not verified) on Fri, 02/24/2012 - 07:35 Permalink
Re: cling on Windows
Hi Vladimir,
Thanks for your report! C++ on Windows is still only rudimentary supported by clang. And cling depends on clang. The available features have already much improved over the last few months - but e.g. the ValuePrinter template instantiation (needed to print the value of the expression when omitting the ';') still causes an infinite loop on Windows. That's Vassil's diagnosis.
As templates are pretty fundamental for C++, and as work on the Windows C++ ABI has been picked up recently, there is hope that this will get fixed in the near future. We at CERN also need cling to work on Windows...
On Windows, today, cling should work in C-mode (cling -x c).
Cheers, Axel
Submitted by Anonymous (not verified) on Fri, 02/24/2012 - 20:44 Permalink
Hi Axel, I'm a bit confused.
Hi Axel, I'm a bit confused. Please clarify what options I have now to use cling in production win application ? As far as I understood in both win32 and win64 cases I can use C language only (until clang will fully support C++ in win32 and win64). It means that I should write C wrappers for C++ DLLs and any C++ code that I want to embed ? Another critical issue, you wrote that there is a critical bug that will be fixed in the nearest 4 weeks - cling sometimes crashes in the end of parsing... Is it applicable for win32/win64 C too ? Thanks, Vladimir
Submitted by Anonymous (not verified) on Fri, 02/17/2012 - 03:10 Permalink
Re: cling on Windows
Hi Vladimir,
As I said, I expect cling on Windows to only work in C mode for the time being. The other bug will affect cling on Windows, too, whether C mode or not - it's about input buffer handling which is the same everywhere. I hope that clarifies the situation. As it is right now I would not recommend cling for production use on Windows. But I cannot predict how long it will take clang to support (most of) Windows C++ ABI: could be months, could be days.
Cheers, Axel
Pages