MantisBT - CMake | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0015729 | CMake | CMake | public | 2015-09-06 04:36 | 2016-03-07 09:12 |
Reporter | Stefan Bühler | ||||
Assigned To | Stephen Kelly | ||||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | Linux | OS | Debian | OS Version | testing/unstable |
Product Version | CMake 3.3.1 | ||||
Target Version | Fixed in Version | CMake 3.4 | |||
Summary | 0015729: ninja: TARGET_OBJECTS not working, ObjectDirectory and ObjectPathMax used before they are set | ||||
Description | I converted a project to Qt5, and TARGET_OBJECTS are not working across directories anymore with ninja; traditional make is still working. I pulled cmake from git (master 9e64fda6a77b49b394835dadba0e2951580eb86b), and got even stranger errors (but not everytime) that CMAKE_OBJECT_PATH_MAX was 0 and the "Object file ... cannot be safely placed under this directory.". I added some debugging and got a backtrace like this: #0 cmLocalGenerator::CreateSafeUniqueObjectFileName (this=0x12f2010, sin=..., dir_max=...) at ../Source/cmLocalGenerator.cxx:2660 #1 0x0000000000aeab84 in cmLocalGenerator::GetObjectFileNameWithoutTarget (this=0x12f2010, source=..., dir_max=..., hasSourceExtension=0x0) at ../Source/cmLocalGenerator.cxx:2810 0000002 0x00000000009223a5 in cmLocalNinjaGenerator::ComputeObjectFilenames (this=0x12f2010, mapping=..., gt=0x13ea920) at ../Source/cmLocalNinjaGenerator.cxx:269 0000003 0x0000000000a5ddec in cmGeneratorTarget::GetObjectSources (this=0x13ea920, data=..., config=...) at ../Source/cmGeneratorTarget.cxx:480 0000004 0x0000000000a4b820 in TargetObjectsNode::Evaluate (this=0xfdd3c0 <targetObjectsNode>, parameters=..., context=0x7fffffffb010, content=0x131d850) at ../Source/cmGeneratorExpressionNode.cxx:1285 0000005 0x0000000000a413f6 in GeneratorExpressionContent::Evaluate[abi:cxx11](cmGeneratorExpressionContext*, cmGeneratorExpressionDAGChecker*) const (this=0x131d850, context=0x7fffffffb010, dagChecker=0x7fffffffb720) at ../Source/cmGeneratorExpressionEvaluator.cxx:154 0000006 0x0000000000a5856c in cmCompiledGeneratorExpression::EvaluateWithContext (this=0x132cff0, context=..., dagChecker=0x7fffffffb720) at ../Source/cmGeneratorExpression.cxx:101 0000007 0x0000000000a58474 in cmCompiledGeneratorExpression::Evaluate (this=0x132cff0, mf=0x130f300, config=..., quiet=false, headTarget=0x1333028, currentTarget=0x1333028, dagChecker=0x7fffffffb720, language=...) at ../Source/cmGeneratorExpression.cxx:79 0000008 0x00000000008d140d in processSources (tgt=0x1333028, entries=..., srcs=..., uniqueSrcs=..., dagChecker=0x7fffffffb720, config=..., debugSources=false) at ../Source/cmTarget.cxx:557 #9 0x00000000008d21b7 in cmTarget::GetSourceFiles (this=0x1333028, files=..., config=...) at ../Source/cmTarget.cxx:700 0000010 0x00000000008d25e8 in cmTarget::GetSourceFiles (this=0x1333028, files=..., config=...) at ../Source/cmTarget.cxx:750 #11 0x0000000000a70b8a in cmGeneratorTarget::GetConfigCommonSourceFiles (this=0x13f0240, files=...) at ../Source/cmGeneratorTarget.cxx:4431 0000012 0x0000000000888ecd in cmQtAutoGenerators::InitializeAutogenTarget (this=0x7fffffffc6d0, lg=0x1312970, target=0x1333028) at ../Source/cmQtAutoGenerators.cxx:408 0000013 0x0000000000a99924 in cmGlobalGenerator::CreateQtAutoGeneratorsTargets (this=0x101ad40, autogens=...) at ../Source/cmGlobalGenerator.cxx:1465 0000014 0x0000000000a986c3 in cmGlobalGenerator::Compute (this=0x101ad40) at ../Source/cmGlobalGenerator.cxx:1272 0000015 0x0000000000900927 in cmake::Generate (this=0x7fffffffd7f0) at ../Source/cmake.cxx:1770 0000016 0x0000000000900783 in cmake::Run (this=0x7fffffffd7f0, args=..., noconfigure=false) at ../Source/cmake.cxx:1757 0000017 0x00000000008197d5 in do_cmake (ac=4, av=0x10111f0) at ../Source/cmakemain.cxx:330 0000018 0x0000000000818d8a in main (ac=4, av=0x10111f0) at ../Source/cmakemain.cxx:190 CreateQtAutoGeneratorsTargets gets called before ComputeObjectMaxPath in cmGlobalGenerator::Compute, and ObjectPathMax is not initialized, i.e. has a random value at that point (for me 0 or 1). Also it turned out gt->ObjectDirectory is empty when TargetObjectsNode::Evaluate is called in a similar backtrace from CreateQtAutoGeneratorsTargets, which is why newer cmake version can't find the object files (older cmake versions simply drop the object, leading to undefined symbols during linking). Moving the call to CreateQtAutoGeneratorsTargets below InitGeneratorTargets fixes it; calling ComputeTargetObjectDirectory and ComputeObjectMaxPath on demand and initializing ObjectPathMax to 0 fixes it too. | ||||
Steps To Reproduce | git clone -b v0.6.0 https://github.com/dosnut/nut [^] cd nut mkdir build cd build cmake -G Ninja .. ninja cnut | ||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2015-09-06 04:36 | Stefan Bühler | New Issue | |||
2015-09-18 14:32 | Stephen Kelly | Note Added: 0039444 | |||
2015-09-18 15:21 | Stefan Bühler | Note Added: 0039446 | |||
2015-09-18 18:30 | Stefan Bühler | Note Added: 0039447 | |||
2015-09-20 10:12 | Stephen Kelly | Note Added: 0039450 | |||
2015-09-20 13:53 | Stefan Bühler | Note Added: 0039452 | |||
2015-09-29 12:11 | Stephen Kelly | Note Added: 0039493 | |||
2015-09-29 12:11 | Stephen Kelly | Status | new => resolved | ||
2015-09-29 12:11 | Stephen Kelly | Fixed in Version | => CMake 3.4 | ||
2015-09-29 12:11 | Stephen Kelly | Resolution | open => fixed | ||
2015-09-29 12:11 | Stephen Kelly | Assigned To | => Stephen Kelly | ||
2016-03-07 09:12 | Robert Maynard | Note Added: 0040602 | |||
2016-03-07 09:12 | Robert Maynard | Status | resolved => closed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|