Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,818
    • Issues 3,818
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 8
    • Merge requests 8
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Issues
  • #19921
Closed
Open
Created Nov 04, 2019 by Stephen Kelly@steveireDeveloper

Build failure with '.tlh' files resulting from `#import` directive in parallel build

Using this cmake code:

cmake_minimum_required(VERSION 3.10)

project(cmaketest)

add_library(tlb 
    tlblib.cpp
    otherfile1.cpp
)

with these source files:

// tlhlib.h

#import "mscorlib.tlb"
#import "System.Drawing.tlb"
#import "System.Windows.Forms.tlb"
// tlblib.cpp
#include "tlblib.h"
// otherfile1.cpp
#include "tlblib.h"

I get the following output from ninja:


C:\Users\Stephen\dev\src\playground\cmake\build>ninja -v
[1/3] C:\PROGRA~2\MICROS~3.0\VC\bin\amd64\cl.exe  /nologo /TP   /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MDd /Zi /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\tlb.dir\otherfile1.cpp.obj /FdCMakeFiles\tlb.dir\tlb.pdb /FS -c ..\otherfile1.cpp
FAILED: CMakeFiles/tlb.dir/otherfile1.cpp.obj
C:\PROGRA~2\MICROS~3.0\VC\bin\amd64\cl.exe  /nologo /TP   /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MDd /Zi /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\tlb.dir\otherfile1.cpp.obj /FdCMakeFiles\tlb.dir\tlb.pdb /FS -c ..\otherfile1.cpp
c:\users\stephen\dev\src\playground\cmake\tlblib.h(2): warning C4278: 'ReportEvent': identifier in type library 'mscorlib.tlb' is already a macro; use the 'rename' qualifier
c:\users\stephen\dev\src\playground\cmake\tlblib.h(3): fatal error C1083: Cannot open compiler generated file: 'c:\users\stephen\dev\src\playground\cmake\build\cmakefiles\tlb.dir\system.drawing.tlh': Permission denied
[2/3] C:\PROGRA~2\MICROS~3.0\VC\bin\amd64\cl.exe  /nologo /TP   /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MDd /Zi /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\tlb.dir\tlblib.cpp.obj /FdCMakeFiles\tlb.dir\tlb.pdb /FS -c ..\tlblib.cpp
c:\users\stephen\dev\src\playground\cmake\tlblib.h(4): warning C4192: automatically excluding 'IDataObject' while importing type library 'System.Windows.Forms.tlb'
ninja: build stopped: subcommand failed.

The problem seems to be that the compiler creates .tlh files as a side-effect of preprocessing (without anything like lockfiles) and compiling in parallel causes multiple concurrent attempts to write the same tlh file.

I'm not certain if CMake can do anything about this without pre-scanning all header files or adding some command user interface for users to specify the expected tlh files.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking