SQLite Forum



(1) By anonymous on 2021-11-08 15:04:58 [link] [source]


I am compiling Qt6 source code with CMake 3.22 -DNinja and GHS compiler on WINDOWS OS.

Qt is recommending to use Ninja build system for building Qt6 source code (officially supported).

But there is an issue connected with following problem: "ar.exe can't handle backslashes in rsp files"

It is already fixed for GCC on WINDOWS (like here https://gitlab.kitware.com/cmake/cmake/-/blob/v3.18.1/Source/cmNinjaNormalTargetGenerator.cxx#L724-728)

But GHS compiler for WINDOWS has the same trouble in case of using Ninja build system and CMake's Ninja generator.

Generated paths inside *.rsp file have backslashes which cannot be handled by ar.exe:

[284/1083] Linking CXX static library qtbase\lib\libQt6Core.a
FAILED: qtbase/lib/libQt6Core.a qtbase/src/corelib/Core.version C:/Users/taboriso/targetbuild/qtbase/src/corelib/Core.version
cmd.exe /C "cmd.exe /C "cd /D C:\Users\taboriso\qt5\qtbase\src\corelib && "C:\Program Files\Git\usr\bin\perl.exe" C:/Users/taboriso/qt5/qtbase/mkspecs/features/data/unix/findclasslist.pl < C:/Users/taboriso/targetbuild/qtbase/src/corelib/Core.version.in > C:/Users/taboriso/targetbuild/qtbase/src/corelib/Core.version  && cd C:\Users\taboriso\targetbuild" && "C:\Program Files\CMake\bin\cmake.exe" -E rm -f qtbase\lib\libQt6Core.a && C:\Qt\Tools\mingw810_64\bin\ar.exe qc qtbase\lib\libQt6Core.a  @CMakeFiles\Core.rsp && C:\Qt\Tools\mingw810_64\bin\ranlib.exe qtbase\lib\libQt6Core.a && cd ."
C:\Qt\Tools\mingw810_64\bin\ar.exe: qtbasesrccorelibCMakeFilesCore.dirCore_autogenmocs_compilation.cpp.o: No such file or directory
ninja: build stopped: subcommand failed.

But GHS compiler problem can be easy fixed in the same way like it was fixed for GCC on WIN:

diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index d5b5eb0e4c..38f6a971e7 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -180,7 +180,7 @@ std::string cmGlobalNinjaGenerator::EncodePath(const std::string& path)
   std::string result = path;
 #ifdef _WIN32
-  if (this->IsGCCOnWindows())
+  if (this->IsGCCOnWindows() || this->UsingGHSOnWindows)
     std::replace(result.begin(), result.end(), '\\', '/');
     std::replace(result.begin(), result.end(), '/', '\\');
@@ -941,6 +941,9 @@ void cmGlobalNinjaGenerator::EnableLanguage(
           cmHasLiteralSuffix(compilerId, "Clang")))) {
       this->UsingGCCOnWindows = true;
+    else if(compilerId == "GHS") {
+      this->UsingGHSOnWindows = true;
+    }
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index ec73475db5..a8b5f47f1a 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -540,6 +540,7 @@ private:
   std::unordered_map<std::string, int> RuleCmdLength;

   bool UsingGCCOnWindows = false;
+  bool UsingGHSOnWindows = false;

   /// The set of custom command outputs we have seen.
   std::set<std::string> CustomCommandOutputs;


Maybe fix can be used?

Just wish to notify about problem existence and propose a fix as soon as CMake + Ninja + GHS + WIN failing for now.

Thank you,
anonymous :-)

(2) By Gunter Hick (gunter_hick) on 2021-11-08 15:31:36 in reply to 1 [source]

I'm not quite sure what the connection to SQLite is here. Can you elaborate?