[SERVER-60681] SCons HEAD after 4.2 doesn't use Icecream correctly Created: 13/Oct/21  Updated: 26/Oct/21  Resolved: 21/Oct/21

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Ryan Egesdahl (Inactive) Assignee: Andrew Morrow (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Sprint: Dev Platform 2021-11-01
Participants:

 Description   

I just tried to build with SCons 4.2.0 to test an upstream PR, and I got this error while building with Icecream:

mkdir -p build/scons/icecream && ICECC_VERSION_TMP=$(/usr/bin/icecc-create-env --clang /opt/mongodbtoolchain/v3/bin/clang /opt/mongodbtoolchain/v3/bin/clang++ | awk '/^creating .*\.tar\.gz/ { print $2 }') && mv $ICECC_VERSION_TMP build/scons/icecream/icecc-create-env._opt_mongodbtool
chain_v3_bin_clang_opt_mongodbtoolchain_v3_bin_clang++.tar.gz
tar xfO build/scons/icecream/icecc-create-env._opt_mongodbtoolchain_v3_bin_clang_opt_mongodbtoolchain_v3_bin_clang++.tar.gz | shasum -b -a 256 - | awk '{ print $1 }' > build/scons/icecream/icecc-create-env._opt_mongodbtoolchain_v3_bin_clang_opt_mongodbtoolchain_v3_bin_clang++.tar.gz.
sha256
ln -f build/scons/icecream/icecc-create-env._opt_mongodbtoolchain_v3_bin_clang_opt_mongodbtoolchain_v3_bin_clang++.tar.gz build/scons/icecream/icecream_py_sha256_$(cat build/scons/icecream/icecc-create-env._opt_mongodbtoolchain_v3_bin_clang_opt_mongodbtoolchain_v3_bin_clang++.tar.gz.
sha256).tar.gz
echo /home/ubuntu/workspace/mongo/build/scons/icecream/icecream_py_sha256_$(cat build/scons/icecream/icecc-create-env._opt_mongodbtoolchain_v3_bin_clang_opt_mongodbtoolchain_v3_bin_clang++.tar.gz.sha256).tar.gz > build/scons/icecream/icecc-create-env._opt_mongodbtoolchain_v3_bin_clan
g_opt_mongodbtoolchain_v3_bin_clang++.tar.gz.sha256.path
<lambda>([None], ["build/scons/icecream/icecc-create-env._opt_mongodbtoolchain_v3_bin_clang_opt_mongodbtoolchain_v3_bin_clang++.tar.gz.sha256.path"])
Creating 'build/scons/icecream/run-icecc.sh'
Chmod("build/scons/icecream/run-icecc.sh", "u+x")
scons: done building targets.
[356/6335 (  5%) 28.812s] Compiling build/opt/mongo/client/hedging_mode_gen.o
ICECC[28789] 2021-10-13 22:46:10: $ICECC_VERSION has to point to an existing file to be installed None03ce9c68d5738a2cf8bdc6c4855b01af

While the above output shows Ninja in use, this is not a factor - the same behavior occurs without Ninja in play.



 Comments   
Comment by Andrew Morrow (Inactive) [ 21/Oct/21 ]

This was investigated and found to be an upstream bug in SCons newer than 4.2: https://github.com/SCons/scons/issues/4037

Since there isn't any work to do on our side, I'm closing this as "done".

Comment by Andrew Morrow (Inactive) [ 20/Oct/21 ]

SCons at HEAD currently does the wrong thing with this:

env = Environment()
 
def generator(source, target, env, for_signature):
    if for_signature:
        return "sig"
    return "val"
 
env['GENERATOR'] = generator
 
env.Textfile(
    target="target",
    source=[
        "@generated@",
    ],
    SUBST_DICT={
        '@generated@' : '$GENERATOR',
    },
)

The 4.2 version correctly puts val in the target file, but current SCons head puts in sig. That breaks the icecc_version_string_generator result and we get a non-working icecream setup.

Generated at Thu Feb 08 05:50:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.