我正在尝试在 Windows 7 上使用 MinGw 编译 Cling。它在 90% 时失败,并出现以下错误:
C:\cling\src\tools\cling\lib\Interpreter\Exception.cpp:44:62: error: exception handling disabled, use -fexceptions to enable
cling::InvalidDerefException::DerefType::NULL_DEREF);
^
我使用这些命令来构建它:
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 .
我试图将 -fexceptions 添加到 cmake 标签中,如下所示:
-DCMAKE_CXXFLAGS="-fexceptions"
和 this:
-DCMAKE_CXX_FLAGS="-fexceptions"
但这没有帮助,我得到了同样的错误。
任何帮助,将不胜感激。
编辑:
我试图避免这种情况,但我修改了文件\tools\cling\lib\Interpreter\CMakeLists.txt
并\tools\cling\lib\UserInterface\CMakeLists.txt
摆脱了这个错误。我if (UNIX)
改为if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
.
然后我得到wchar_t
这样的转换错误:
error: cannot convert 'LPTSTR {aka char*}' to 'const wchar_t*'
所以我添加-DCMAKE_CXX_FLAGS="-DUNICODE -D_UNICODE"
到 cmake 调用:
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
现在我收到以下错误:
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)
':
我想_MSC_VER
错误不是问题,我可以伪造一些随机版本,但是 to 的演员表FARPROC
呢void*
?