[Interest] Rebuilding cmake project (in Qt Creator) fails - build directories write-protected?

James DeLisle james.delisle at qt.io
Thu Dec 31 15:29:04 CET 2020


Hi,

There are some on-going peculiarities with CMake and translation files, as evidenced here:
https://bugreports.qt.io/browse/QTBUG-76410
While maybe not directly related to your issue, would still be good to keep in mind as you decipher your problem.

Happy New Year!
James

From: Interest <interest-bounces at qt-project.org> on behalf of Jason H <jhihn at gmx.com>
Date: Wednesday, December 30, 2020 at 11:37 AM
To: Till Oliver Knoll <till.oliver.knoll at gmail.com>
Cc: Qt Project <interest at qt-project.org>
Subject: Re: [Interest] Rebuilding cmake project (in Qt Creator) fails - build directories write-protected?

I don't have any specific knowlege, but if it were me, I would check Sysinternals diskmon and see where/whow/who is setting the read-only flag. (Asuming I checked and the flad is actually set)

Also likely - there is a process in that directory that is preventing deletion and windows is not reporting it accurately. I've not used windows in a while but I remember it being picky about such things.




Sent: Wednesday, December 30, 2020 at 6:33 AM
From: "Till Oliver Knoll" <till.oliver.knoll at gmail.com>
To: "Qt Project" <interest at qt-project.org>
Subject: [Interest] Rebuilding cmake project (in Qt Creator) fails - build directories write-protected?

Dear all,

It's been a while since I asked my last question here - or posted anything meaningful, for that matter - so first of all "Hello!" and "Merry Christmas / Holidays" :)

I have started a new Qt 5.15.2 (open source) project on Windows 10 (due to a dependency on Flight Simulator 2020, specifically SimConnect.dll ;)), and since Qt 6 will default to cmake (as I understand) I also chose cmake in the Qt Creator 4.14.0.

The problem: "rebuilding" (QtCreator: "Build/Rebuild All Projects") the project fails when trying to generate the translation *.ts files respectively the correspoding "list" (?) file:

FAILED: C:/dev/Qt/MainWindow/MainWindow_de_DE.ts CMakeFiles/MainWindow_de_DE.ts_lst_file
cmd.exe /C "cd /D C:\dev\Qt\build-MainWindow-Desktop_Qt_5_15_2_MinGW_64_bit-Debug && C:\Qt\5.15.2\mingw81_64\bin\lupdate.exe @C:/dev/Qt/build-MainWindow-Desktop_Qt_5_15_2_MinGW_64_bit-Debug/CMakeFiles/MainWindow_de_DE.ts_lst_file -ts C:/dev/Qt/MainWindow/MainWindow_de_DE.ts"
lupdate error: List file 'C:/dev/Qt/build-MainWindow-Desktop_Qt_5_15_2_MinGW_64_bit-Debug/CMakeFiles/MainWindow_de_DE.ts_lst_file' is not readable.
ninja: build stopped: subcommand failed.

Initially I thought that this is yet another issue with whitespace in the build path, but that's not the case (I now moved it from c:/Users/Oliver Knoll/work/... to c:/dev/Qt/work/... - that is, no spaces in path anymore).



However I noticed that some directories in the "build" directory (c:/dev/Qt/build-MainWindow-Desktop_...) have the "Write Protected" flag set:

.cmake
CMakeFiles
MainWindow_autogen

The Windows 10 "Properties" dialog says: "Write-Protected (only concerns files in the directory)" (or similar, in German: "Schreibgeschützt (betrifft nur Dateien im Ordner).

So when trying to manually delete those folders a dialog pops up asking me for administrator rights, and when I click on Continue (with admin rights) then another dialog tells me that I need the corresponding access rights from user "Oliver Knoll" - well, that's exactly my user (with admin rights).

However I can "cd" into the remaining directories and delete all files without problems, and after that I can delete the entire build folder at last.

Back in Qt Creator a CTRL + B (Build Project "MainWindow") then re-builds the project again.



Another - proper? - solution, in Qt Creator (all in "Build" menu):

* Clean Project "MainWindow"
* Clear CMake Configuration (at that point the subdirectory .cmake/api/v1/query (and reply) still remains, plus 3 "ninja" related files and cmake_install.cmake)
* Run CMake
* Rebuild Project "MainWindow"

It works, but... really? 4 steps instead of just one? Is that the proper "CMake way" (I am totally new to CMake) to rebuild a project from scratch?

The above example refers to a simple "MainWindow" project setup in Qt Creator as follows:

* New File Or Project
* Qt Widgets Application
* Name: MainWindow (any name)
* Build System: CMake
* Default classes/files, including Generate form
* Add any translation language
* Default Qt Kit: Qt 5.15.2 MinGW 64-bit
* No version control

The above experiments were done with the default generated CMakeLists.txt.



Development environment:

* Qt 5.15.2 Open Source
* QtCreator 4.14.0
* CMake 3.19.0 (installed via Qt Installer)
* Windows 10 2004 (all updates installed)
* Except the MS FS2020 SDK (SimConnect.dll) there are no other developer tools installed (specifically no other CMake, no Visual Studio, no other compilers etc.)
* "Default Windows Home installation" (one user - Oliver Knoll - with admin rights; yes, it's a "gaming machine" ;))


Other:

* Most likely not relevant, but: it is a "Windows To Go" installation (created/installed via tool "WinToUSB"), installed on an external SSD (which is connected to a Mac ;))

The full compilation error during a "Rebuild" (without clearing the CMake configuration):

12:02:08: Running steps for project MainWindow...
12:02:08: Starting: "C:\Qt\Tools\CMake_64\bin\cmake.exe" --build . --target clean
[1/2 54.3/sec] Cleaning additional files...
[2/2 83.6/sec] Cleaning all built files...
Cleaning... 0 files.
12:02:08: The process "C:\Qt\Tools\CMake_64\bin\cmake.exe" exited normally.
12:02:08: Starting: "C:\Qt\Tools\CMake_64\bin\cmake.exe" --build . --target all
[1/6 2.7/sec] Automatic MOC and UIC for target MainWindow
[2/6 5.1/sec] Generating C:/dev/Qt/MainWindow/MainWindow_de_DE.ts
FAILED: C:/dev/Qt/MainWindow/MainWindow_de_DE.ts CMakeFiles/MainWindow_de_DE.ts_lst_file
cmd.exe /C "cd /D C:\dev\Qt\build-MainWindow-Desktop_Qt_5_15_2_MinGW_64_bit-Debug && C:\Qt\5.15.2\mingw81_64\bin\lupdate.exe @C:/dev/Qt/build-MainWindow-Desktop_Qt_5_15_2_MinGW_64_bit-Debug/CMakeFiles/MainWindow_de_DE.ts_lst_file -ts C:/dev/Qt/MainWindow/MainWindow_de_DE.ts"
lupdate error: List file 'C:/dev/Qt/build-MainWindow-Desktop_Qt_5_15_2_MinGW_64_bit-Debug/CMakeFiles/MainWindow_de_DE.ts_lst_file' is not readable.
ninja: build stopped: subcommand failed.
12:02:09: The process "C:\Qt\Tools\CMake_64\bin\cmake.exe" exited with code 1.




_______________________________________________ Interest mailing list Interest at qt-project.org https://lists.qt-project.org/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20201231/c5483cc8/attachment.html>


More information about the Interest mailing list