cling icon indicating copy to clipboard operation
cling copied to clipboard

Cannot compile cling on windows

Open MohammadMD1383 opened this issue 2 years ago • 10 comments

tried with both msvc2019 and mingw-w64 8 but I cannot compile it.

  • using msvc after about one or two minutes I got some errors I think with linking and ...
  • using mingw it spent more than 3 hours!!! 87% was completed but an error occurred and ... Ahhhhh, that's not justice :/

using mingw I'm getting following error:

[ 87%] Building CXX object tools/cling/lib/Interpreter/CMakeFiles/obj.clingInterpreter.dir/DynamicLookup.cpp.obj
[ 87%] Building CXX object tools/cling/lib/Interpreter/CMakeFiles/obj.clingInterpreter.dir/DynamicExprInfo.cpp.obj
[ 87%] Building CXX object tools/cling/lib/Interpreter/CMakeFiles/obj.clingInterpreter.dir/Exception.cpp.obj
D:\ClingWin\src\tools\cling\lib\Interpreter\Exception.cpp: In function 'void* cling_runtime_internal_throwIfInvalidPointer(void*, void*, const void*)':
D:\ClingWin\src\tools\cling\lib\Interpreter\Exception.cpp:54:62: error: exception handling disabled, use -fexceptions to enable
           cling::InvalidDerefException::DerefType::NULL_DEREF);
                                                              ^
At global scope:
cc1plus.exe: warning: unrecognized command line option '-Wno-unused-local-typedef'
cc1plus.exe: warning: unrecognized command line option '-Wno-covered-switch-default'
cc1plus.exe: warning: unrecognized command line option '-Wno-nested-anon-types'
mingw32-make.exe[2]: *** [tools\cling\lib\Interpreter\CMakeFiles\obj.clingInterpreter.dir\build.make:351: tools/cling/lib/Interpreter/CMakeFiles/obj.clingInterpreter.dir/Exception.cpp.obj] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:59001: tools/cling/lib/Interpreter/CMakeFiles/obj.clingInterpreter.dir/all] Error 2
mingw32-make.exe: *** [Makefile:155: all] Error 2

any way... I think using wsl won't kill anyone...

MohammadMD1383 avatar Sep 16 '21 16:09 MohammadMD1383

MSVC should work, we build with it, too. What's the error? We don't build with mingw, I'm not surprised that it doesn't work.

Axel-Naumann avatar Nov 11 '21 12:11 Axel-Naumann

That's about one month ago... I don't have the error messages anymore.

MohammadMD1383 avatar Nov 11 '21 15:11 MohammadMD1383

could you please tell me where can I download cling for windows? I think that would be better :)

MohammadMD1383 avatar Nov 11 '21 15:11 MohammadMD1383

We don't seem to offer windows binaries: https://root.cern/download/cling/ - let me find out why :-)

Axel-Naumann avatar Nov 11 '21 16:11 Axel-Naumann

Quick comment, might be late for you guys.

I built cling under Win32, x86, didn't work. Then I tried x64 release build, it works like a miracle (VS2017). But the problem is that after I run cling, a simple #include statement can cause it to crash: #include .

But if I run cling in the VS2017 command prompt, then everything seems to work fine. I guess some mislink to wrong dynamic libraries.

ericzhng avatar Feb 15 '22 05:02 ericzhng

We don't seem to offer windows binaries: https://root.cern/download/cling/ - let me find out why :-)

so why?

Darley-Wey avatar May 27 '22 09:05 Darley-Wey

Man, I wish cling worked on Windows.

Welding-Torch avatar Jul 21 '23 00:07 Welding-Torch

Man, I wish cling worked on Windows.

It does

bellenot avatar Jul 21 '23 05:07 bellenot

Could you explain how? I looked at cling's official repository, and there's no setup file for cling on windows.

Welding-Torch avatar Jul 23 '23 00:07 Welding-Torch

You have to build it from source. See the Cling Build Instructions. On Windows, in a x64 Native Tools Command Prompt for VS 2022:

git clone http://root.cern/git/llvm.git src
cd src
git checkout cling-patches
cd tools
git clone http://root.cern/git/cling.git
git clone http://root.cern/git/clang.git
cd clang
git checkout cling-patches
cd ../..

And then build:

mkdir build
cd build
cmake -G"Visual Studio 17 2022" -A x64 -Thost=x64 -DCMAKE_INSTALL_PREFIX=[Install Path] ..\src
cmake --build . --config Release
cmake --build . --target install

bellenot avatar Jul 23 '23 13:07 bellenot

Listen,

Most people don't want to download Microsoft's clunky Visual Studio just in order to build a compiler. Can you please release some binaries so people can just install this easily?

You can even setup a GitHub Action to automatically build the binaries from this repository. https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md

Welding-Torch avatar Apr 12 '24 14:04 Welding-Torch

You have binaries here that include Cling (and other stuff): https://root.cern/install/all_releases/ It's an up-to-date workaround at the moment if you need it.

The standalone Cling binaries and CI is broken at the moment: see https://github.com/root-project/cling/issues/447 https://github.com/root-project/web/issues/951

ferdymercury avatar Apr 12 '24 14:04 ferdymercury

I am low on storage space. I'd really prefer not installing other stuff. I just want cling.

If the CI for building Cling binaries for Windows is broken, are there any immediate plans to fix it? I know this is an open-source project, but some communication on this topic would be appreciated.

Welding-Torch avatar Apr 12 '24 15:04 Welding-Torch

@Welding-Torch I'll check what can be done. BTW, is Cling working without Visual Studio installed on the system? I thought the headers were needed... But I'll check nevertheless

bellenot avatar Apr 12 '24 15:04 bellenot

No that's the thing, I don't want to install Visual Studio on my system. Hence, I haven't tried Cling yet.

Welding-Torch avatar Apr 12 '24 15:04 Welding-Torch

Well, AFAIK, Cling (the JIT) needs the header files, as any other compiler

bellenot avatar Apr 12 '24 15:04 bellenot

Maybe related: https://www.reddit.com/r/cpp_questions/comments/txipit/using_clang_on_windows_without_visual_studio/

They claim to show how to use LLVM Clang on Windows with CMake. You'll still need the Windows SDK and MSVC support libraries installed, but you don't have to use MSVC.

ferdymercury avatar Apr 12 '24 15:04 ferdymercury

I don't think the Windows SDK is enough, but I'll check. And BTW, the Windows SDK comes with Visual Studio, last time I checked it was not possible to install the Windows SDK alone

bellenot avatar Apr 12 '24 15:04 bellenot

Hence, I haven't tried Cling yet.

Consider also trying https://clang.llvm.org/docs/ClangRepl.html

ferdymercury avatar Apr 12 '24 16:04 ferdymercury

So you're saying that even if I build cling with Visual Studio IDE on a different PC and then transfer the binary to my PC, I won't be able to run it on my PC without Visual Studio IDE installed?

Well that's not ideal. Is it possible to run cling standalone?

Welding-Torch avatar Apr 13 '24 10:04 Welding-Torch

Well, just try (I don't have any PC without Visual Studio installed...)

bellenot avatar Apr 15 '24 08:04 bellenot