Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

File Locking with Resource Compiler. Why?



  • Why does the resource compiler lock files?

    My Setup

    I have:

    • Linux Kubuntu 20.04 LTS
    • NFS mount to my sources
    • CMake project file
    • CLion

    Problem

    For some reason when building a Qt demo project I get file locking failures.

    Excerpt 'CMakeLists.txt'

    set(CMAKE_AUTOUIC ON)
    set(CMAKE_AUTOMOC ON)
    set(CMAKE_AUTORCC ON)
    
    set(SOURCES
    	main.cpp
    	mainwindow.cpp
    	mainwindow.h
    	myform.ui
    	demo1.qrc
    	)
    
    AutoRcc error
    -------------
    Locking of the lock file "SRC:/cmake-build-debug/CMakeFiles/demo1_autogen.dir/AutoRcc_demo1_EWIEGA46WW_Lock.lock" failed.
    No locks available
    

    When setting up the CMakeLists.txt as presented next there is no problem.

    set(SOURCES
    	main.cpp
    	mainwindow.cpp
    	mainwindow.h
    	myform.ui
    	)
    
    qt5_add_resources(SOURCES demo1.qrc)
    

    Enabling file locking on my Linux server with systemctl enable rpc-statd and systemctl start rpc-statd also fixed the problem for me since there is no qt6_add_resources(...) function anymore.

    Questions

    File locking is possible on NFS but for other types of mounts it is not.
    Is there a possibility to disable file locking?
    Why is there a need for file locking anyway?


  • Lifetime Qt Champion

    I don't see what Qt can do against this - when the OS says that there are no resources available (No locks available) the app can't do anything against it.



  • @Christian-Ehrlicher said in File Locking with Resource Compiler. Why?:

    I don't see what Qt can do against this - when the OS says that there are no resources available (No locks available) the app can't do anything against it.

    It is Qt's resource compiler that is doing the locking.


Log in to reply