From 945ba4ce73290de5b3673a3558d217188d888ae7 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Wed, 27 Apr 2022 15:26:13 +0800 Subject: [PATCH] - fix: use utf8 as the encoding for clang's error output --- NEWS.md | 1 + RedPandaIDE/compiler/compiler.cpp | 10 ++++++++-- RedPandaIDE/settings.cpp | 8 ++++---- windows/prepare_clang.sh | 3 +++ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/NEWS.md b/NEWS.md index ed1a1d88..8450cdb8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,6 +6,7 @@ Red Panda C++ Version 1.0.6 - fix: c file should use CC to build in the auto generated makefile - enhancement: package script for msys2 clang - enhancement: auto set problem case's expected output file which has "ans" as the suffix, when batch set cases + - fix: use utf8 as the encoding for clang's error output Red Panda C++ Version 1.0.5 - enhancement: add autolink and project template for sqlite3 diff --git a/RedPandaIDE/compiler/compiler.cpp b/RedPandaIDE/compiler/compiler.cpp index 5aba68b8..6b479b00 100644 --- a/RedPandaIDE/compiler/compiler.cpp +++ b/RedPandaIDE/compiler/compiler.cpp @@ -590,10 +590,16 @@ void Compiler::runCommand(const QString &cmd, const QString &arguments, const Q errorOccurred= true; }); process.connect(&process, &QProcess::readyReadStandardError,[&process,this](){ - this->error(QString::fromLocal8Bit( process.readAllStandardError())); + if (compilerSet()->compilerType() == COMPILER_CLANG) + this->error(QString::fromUtf8(process.readAllStandardError())); + else + this->error(QString::fromLocal8Bit( process.readAllStandardError())); }); process.connect(&process, &QProcess::readyReadStandardOutput,[&process,this](){ - this->log(QString::fromLocal8Bit( process.readAllStandardOutput())); + if (compilerSet()->compilerType() == COMPILER_CLANG) + this->log(QString::fromUtf8(process.readAllStandardOutput())); + else + this->log(QString::fromLocal8Bit( process.readAllStandardOutput())); }); process.connect(&process, QOverload::of(&QProcess::finished),[this](){ this->error(COMPILE_PROCESS_END); diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index 56b2209b..630125ca 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -2066,10 +2066,10 @@ void Settings::CompilerSet::setExecutables() mCCompiler = findProgramInBinDirs(GCC_PROGRAM); if (mCppCompiler.isEmpty()) mCppCompiler = findProgramInBinDirs(GPP_PROGRAM); - if (mDebugger.isEmpty()) - mDebugger = findProgramInBinDirs(GDB_PROGRAM); - if (mDebugServer.isEmpty()) - mDebugServer = findProgramInBinDirs(GDB_SERVER_PROGRAM); +// if (mDebugger.isEmpty()) +// mDebugger = findProgramInBinDirs(GDB_PROGRAM); +// if (mDebugServer.isEmpty()) +// mDebugServer = findProgramInBinDirs(GDB_SERVER_PROGRAM); } else { mCCompiler = findProgramInBinDirs(GCC_PROGRAM); mCppCompiler = findProgramInBinDirs(GPP_PROGRAM); diff --git a/windows/prepare_clang.sh b/windows/prepare_clang.sh index f6f25c42..a560a39f 100644 --- a/windows/prepare_clang.sh +++ b/windows/prepare_clang.sh @@ -40,6 +40,9 @@ rm -rf lib/libclang*.a rm -rf lib/libLLVM*.a rm -rf lib/libtcl*.a rm -rf lib/libtk*.a +rm -rf lib/liblldELF.a +rm -rf lib/liblldCOFF.a +rm -rf lib/liblldMachO.a rm -rf lib/libtdbc* rm -rf lib/tcl8 rm -rf lib/tcl8.6