[cmake-developers] [PATCH] Fixed Borland linker issue when used with Ninja generator

James Johnston JamesJ at motionview3d.com
Thu Jun 18 13:41:09 EDT 2015


Hi,

The attached patch is in regards to issue #15620 in mantis bug tracker
("Ninja generator triggers race condition in Borland bcc32 linker causing
intermittent build failure").  Thanks to Brad King's suggestion, I think
using job pools is a lot easier than trying my proposed workaround (which I
realized would probably involve more disruptive code changes).  (I'm new to
both CMake/Ninja, so wasn't aware of this option).

I've tested with building VTK 5.4.2.  Before the patch, 5 out of 5 builds
failed (sooner or later, in a big project like VTK, the race condition would
trash the build).  After the patch, 5 out of 5 builds work without error.

Because of this issue with the linker itself, I can't think of any reason
why anybody would want to change the default settings I put in
Modules/Platform/Windows-Embarcadero.cmake with this patch.  You simply
*must* restrict the linker to one instance, without exception, or you'll
have problems due to the bcc32 linker design flaws I've outlined in the bug
tracker and patch comments.  I was only able to think of three solutions to
this problem:

1.  Modify each upstream CMake project (e.g. VTK) itself to set the Ninja
job pool in the Borland case (not a good option).
2.  Provide a toolchain file that sets up the job pool.  Awkward, since you
have to do this EVERY TIME you use the Ninja generator /w bcc32 or it WILL
NOT WORK.
3.  Patch Windows-Embarcadero.cmake, as I propose here.

(Since JOB_POOLS is a global property and not a variable, I couldn't find a
way to simply pass this as a parameter to cmake.exe - not that that would be
an ideal solution anyway.)

Best regards,

James Johnston

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Work-around-Borland-linker-issue-when-used-with-Ninj.patch
Type: application/octet-stream
Size: 2231 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150618/3c1fedd7/attachment.obj>


More information about the cmake-developers mailing list