Bug 109443 - Build failure with MSVC when using Scons >= 3.0.2
Summary: Build failure with MSVC when using Scons >= 3.0.2
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-23 20:50 UTC by pal1000
Modified: 2019-03-06 21:51 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Mesa3D MSVC build fails with Scons >= 3.0.2 (28.85 KB, text/plain)
2019-01-23 20:50 UTC, pal1000
Details
Scons source code bisect to determine when this became an issue. (3.98 KB, text/plain)
2019-02-19 16:44 UTC, pal1000
Details
A hack patch that removes the functionality from the build system that Scons >= 3.0.2 doesn't like (391 bytes, patch)
2019-02-25 16:25 UTC, pal1000
Details | Splinter Review
Trial patch to fix issue (897 bytes, patch)
2019-02-26 03:13 UTC, William Deegan
Details | Splinter Review

Description pal1000 2019-01-23 20:50:06 UTC
Created attachment 143208 [details]
Mesa3D MSVC build fails with Scons >= 3.0.2

It appears that Scons 3.0.3 and newer (3.0.4 at the time of writing this) cannot be used to build Mesa3D. Have to stick to 3.0.1. Scons 3.0.2 has been quickly pulled. Something trips the build into looking for a missing header.
Comment 1 pal1000 2019-02-19 16:44:11 UTC
Created attachment 143412 [details]
Scons source code bisect to determine when this became an issue.
Comment 2 pal1000 2019-02-25 16:25:49 UTC
Created attachment 143462 [details] [review]
A hack patch that removes the functionality from the build system that Scons >= 3.0.2 doesn't like
Comment 3 William Deegan 2019-02-25 19:37:11 UTC
If you comment out line 311 in mesascons/gallium.py
    # env.Decider('MD5-timestamp')

You can use SCons 3.0.4.
3.0.4 had a bugfix for a longstanding issue where it was possible that md5-timestamp in conjunction with changing the number of implicit dependencies (think header files) could yield (infrequently) corrupted content signatures in the sconsign file.

By defaulting the decider to MD5, you'll have a temporary workaround and be able to use SCons 3.0.4

I'm investigating this further currently.

It looks like with the bugfix in 3.0.4 api_exec.obj somehow doesn't have nir_opcodes.h (which is a generated file) as an implicit dependency,  thus nir_opcodes.h isn't being generated before api_exec.c is compiled.
Comment 4 William Deegan 2019-02-26 03:13:25 UTC
Created attachment 143466 [details] [review]
Trial patch to fix issue

Trial patch to SCons to address issue. Please apply to SCons/Node/FS.py and let me know if it resolves the issue.

The bug seems to be windows only and has to do with looking up info about previous build to decide if a target needs to be built.

I'm still running tests locally on it against mesa win build. Next I'll run against SCons' own test suite.
Comment 5 William Deegan 2019-02-26 05:52:10 UTC
Found some issues with the patch I attached.  Should have an updated one tomorrow.
Comment 6 Jose Fonseca 2019-02-26 18:38:50 UTC
How about this as workaround:

diff --git a/scons/gallium.py b/scons/gallium.py
index 963834a5fbc..565f19f3f1a 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -308,7 +308,10 @@ def generate(env):
     if env.GetOption('num_jobs') <= 1:
         env.SetOption('num_jobs', num_jobs())
 
-    env.Decider('MD5-timestamp')
+    scons_version = distutils.version.StrictVersion(SCons.__version__)
+    if scons_version < distutils.version.StrictVersion('3.0.2') or \
+       scons_version >= distutils.version.StrictVersion('3.0.4'):
+        env.Decider('MD5-timestamp')
     env.SetOption('max_drift', 60)
 
     # C preprocessor options
Comment 7 pal1000 2019-02-27 16:33:28 UTC
I'd go for this way as 3.0.4 is also affected:

diff --git a/scons/gallium.py b/scons/gallium.py
index 963834a5fbc..565f19f3f1a 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -308,7 +308,10 @@ def generate(env):
     if env.GetOption('num_jobs') <= 1:
         env.SetOption('num_jobs', num_jobs())
 
-    env.Decider('MD5-timestamp')
+    scons_version = distutils.version.StrictVersion(SCons.__version__)
+    if scons_version < distutils.version.StrictVersion('3.0.2') or \
+       scons_version > distutils.version.StrictVersion('3.0.4'):
+        env.Decider('MD5-timestamp')
     env.SetOption('max_drift', 60)
 
     # C preprocessor options
Comment 8 Jose Fonseca 2019-02-28 09:52:42 UTC
(In reply to Alex Granni from comment #7)
> I'd go for this way as 3.0.4 is also affected.

OK.  I'll assume I have your Tested-By and post it for review.
Comment 9 Jose Fonseca 2019-02-28 21:30:01 UTC
Workaround pushed.  Thanks everybody.
Comment 10 William Deegan 2019-02-28 23:10:45 UTC
If you'd like to be notified when the fix gets merged into SCons please add yourself to:

https://github.com/SCons/scons/pull/3311

Hopefully I'll get this wrapped up (need a test to cover this) and into master this weekend and it'll make it into the next release (3.0.5 or 3.1 are the most likely version strings)
Comment 11 William Deegan 2019-03-05 16:09:56 UTC
I've pushed out an alpha package for you to verify your issue is now resolved.

https://github.com/SCons/scons/releases/tag/3.0.5a2

Also available at:
pip install --index-url https://test.pypi.org/simple/ scons==3.0.5.a2

Please let us know if this works!
Comment 12 pal1000 2019-03-06 21:51:16 UTC
Yes, 3.0.5.a.2 has this problem solved. Thank you.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.