From 70d5f5090db0e784fd88057a0c7052fed7f52830 Mon Sep 17 00:00:00 2001 From: Dan Mihai Date: Thu, 6 Apr 2017 21:39:48 -0700 Subject: [PATCH] [IOT-1986] Windows: Work around SCons race condition These sporadic linker errors become even more frequent when adding more static LIBs into a single target DLL. Change-Id: I44d2cfeda61a08cbc29cb3d7f685b87ea1cb8b9e Signed-off-by: Dan Mihai Reviewed-on: https://gerrit.iotivity.org/gerrit/18767 Tested-by: jenkins-iotivity Reviewed-by: Omar Maabreh Reviewed-by: Dave Thaler Reviewed-by: Uze Choi Reviewed-by: Mike Fenelon --- build_common/windows/SConscript | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/build_common/windows/SConscript b/build_common/windows/SConscript index 74735e2..55af23c 100644 --- a/build_common/windows/SConscript +++ b/build_common/windows/SConscript @@ -38,7 +38,17 @@ if env['CC'] == 'cl': else: env.AppendUnique(CCFLAGS = ['/MDd', '/Od', '/RTC1']) env.AppendUnique(LINKFLAGS = ['/debug']) + env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')]) + + # Work around [IOT-1986] + # During some Windows multi-threaded builds, SCons/Python/Pywin32 appear to try + # linking with oc.lib while another SCons thread started executing InstallTarget() + # for this static LIB, but didn't finish yet. That behavior results in linker errors. + # Work around this issue by linking with the source of InstallTarget(), rather + # than the target. + env.PrependUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource', 'src')]) + env.AppendUnique(PATH = os.environ['PATH']) env['PDB'] = '${TARGET.base}.pdb' env.Append(LINKFLAGS=['/PDB:${TARGET.base}.pdb']) -- 2.7.4