I am trying to compile cling with MinGw on Windows 7. It fails at 90% with the following error:
C:\cling\src\tools\cling\lib\Interpreter\Exception.cpp:44:62: error: exception handling disabled, use -fexceptions to enable
cling::InvalidDerefException::DerefType::NULL_DEREF);
^
I used these commands to build it:
cmake -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX="c:/cling" -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="C:/Qt/Qt5.14.1/Tools/mingw730_32/bin/gcc.exe" -DCMAKE_CXX_COMPILER="C:/Qt/Qt5.14.1/Tools/mingw730_32/bin/g++.exe" ..\src
cmake --build .
I tried to add -fexceptions to the cmake tags like this:
-DCMAKE_CXXFLAGS="-fexceptions"
and this:
-DCMAKE_CXX_FLAGS="-fexceptions"
but it doesn't help, I get the same error.
Any help would be appreciated.
Edit:
I was trying to avoid this but I modified the files \tools\cling\lib\Interpreter\CMakeLists.txt
and \tools\cling\lib\UserInterface\CMakeLists.txt
to get rid of this error.
I changed if (UNIX)
to if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
.
Then I got wchar_t
conversion errors like this:
error: cannot convert 'LPTSTR {aka char*}' to 'const wchar_t*'
so I added -DCMAKE_CXX_FLAGS="-DUNICODE -D_UNICODE"
to the
cmake call:
cmake -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX="c:/cling" -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="C:/Qt/Qt5.14.1/Tools/mingw730_32/bin/gcc.exe" -DCMAKE_CXX_COMPILER="C:/Qt/Qt5.14.1/Tools/mingw730_32/bin/g++.exe" -DCMAKE_CXX_FLAGS="-DUNICODE -D_UNICODE" ..\src
Now I get the following errors:
C:\cling\src\tools\cling\lib\Utils\PlatformWin.cpp: In function 'int cling::utils::platform::windows::GetVisualStudioVersionCompiledWith()':
C:\cling\src\tools\cling\lib\Utils\PlatformWin.cpp:380:11: error: '_MSC_VER' was not declared in this scope
return (_MSC_VER / 100) - 6;
^~~~~~~~
C:\cling\src\tools\cling\lib\Utils\PlatformWin.cpp:380:11: note: suggested alternative: '_TSCHAR'
return (_MSC_VER / 100) - 6;
^~~~~~~~
_TSCHAR
C:\cling\src\tools\cling\lib\Utils\PlatformWin.cpp: In function 'const void* cling::utils::platform::DLSym(const string&, std::__cxx11::string*)':
C:\cling\src\tools\cling\lib\Utils\PlatformWin.cpp:614:42: error: invalid conversion from 'FARPROC {aka int (__attribute__((__stdcall__)) *)()}' to 'v
oid*' [-fpermissive]
if (void* Addr = ::GetProcAddress(*It, s.c_str())) {
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
C:\cling\src\tools\cling\lib\Utils\PlatformWin.cpp:625:44: error: invalid conversion from 'FARPROC {aka int (__attribute__((__stdcall__)) *)()}' to 'v
oid*' [-fpermissive]
if (void* Addr = ::GetProcAddress(Modules[i], s.c_str()))
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
C:\cling\src\tools\cling\lib\Utils\PlatformWin.cpp: In function 'bool cling::utils::platform::Popen(const string&, llvm::SmallVectorImpl<char>&, bool)
':
I guess the _MSC_VER
error is not a problem, I can fake some random version but what about the cast of FARPROC
to void*
?