Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-56003

ninja + icecream with changing compilers doesn't regen run-icecc.sh

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.3.2, 4.4.14, 5.0.8, 5.3.1
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • v5.3, v5.0, v4.4
    • Hide

      as of 5ff2fd561d48c390a03e0d27239e3e378203634b

      1. generate gcc ninja like so:

      /opt/mongodbtoolchain/v3/bin/python3 buildscripts/scons.py --variables-files=etc/scons/mongodbtoolchain_v3_gcc.vars --ninja NINJA_PREFIX=gcc ICECC=icecc generate-ninja VARIANT_DIR=gcc
      

      2. generate clang ninja like so:

      /opt/mongodbtoolchain/v3/bin/python3 buildscripts/scons.py --variables-files=etc/scons/mongodbtoolchain_v3_clang.vars --ninja NINJA_PREFIX=clang ICECC=icecc generate-ninja VARIANT_DIR=clang
      

      3. build clang, make sure to record the hash of the icecream compiler package just created

      ninja -j400 -f clang.ninja install-mongo
      

      4. build gcc, make sure to record the hash of the second compiler package just created

      ninja -j400 -f gcc.ninja install-mongo
      

      5. notice current run-icecc.sh is pointing to gcc compiler package
      6. delete a file from the clang build:

      rm -rf build/clang/mongo/client/mongo_uri.o
      

      7. put on icecream debugging to see compiler fail to start:

      export ICECC_DEBUG=icecc.log
      

      8. run the clang build again, it is still point to the gcc icecream compiler package and will try to use that

      ninja -j400 -f clang.ninja install-mongo
      

      9. notice in the icecream debug logs:

      ICECC[1550] 2022-01-26 11:27:58: flush_writebuf() failed(Error: Broken pipe)
      ICECC[1550] 2022-01-26 11:27:58: setting error state for channel 10.122.7.201: (B eof: 0)
      ICECC[1550] 2022-01-26 11:27:58: remote status: compiler did not start
      ICECC[1550] 2022-01-26 11:27:58: write of source chunk to host 10.122.7.201
      ICECC[1550] 2022-01-26 11:27:58: failed (Error: Broken pipe)
      ICECC[1550] 2022-01-26 11:27:58: </write_fd_to_server from cpp: 370ms>
      ICECC[1550] 2022-01-26 11:27:58: got exception Error 15 - write to host failed (10.122.7.201) 
      ICECC[1550] 2022-01-26 11:27:58: connected to /var/run/icecc/iceccd.socket
      ICECC[1550] 2022-01-26 11:27:58: <building_local>
      
      Show
      as of 5ff2fd561d48c390a03e0d27239e3e378203634b 1. generate gcc ninja like so: /opt/mongodbtoolchain/v3/bin/python3 buildscripts/scons.py --variables-files=etc/scons/mongodbtoolchain_v3_gcc.vars --ninja NINJA_PREFIX=gcc ICECC=icecc generate-ninja VARIANT_DIR=gcc 2. generate clang ninja like so: /opt/mongodbtoolchain/v3/bin/python3 buildscripts/scons.py --variables-files=etc/scons/mongodbtoolchain_v3_clang.vars --ninja NINJA_PREFIX=clang ICECC=icecc generate-ninja VARIANT_DIR=clang 3. build clang, make sure to record the hash of the icecream compiler package just created ninja -j400 -f clang.ninja install-mongo 4. build gcc, make sure to record the hash of the second compiler package just created ninja -j400 -f gcc.ninja install-mongo 5. notice current run-icecc.sh is pointing to gcc compiler package 6. delete a file from the clang build: rm -rf build/clang/mongo/client/mongo_uri.o 7. put on icecream debugging to see compiler fail to start: export ICECC_DEBUG=icecc.log 8. run the clang build again, it is still point to the gcc icecream compiler package and will try to use that ninja -j400 -f clang.ninja install-mongo 9. notice in the icecream debug logs: ICECC[1550] 2022-01-26 11:27:58: flush_writebuf() failed(Error: Broken pipe) ICECC[1550] 2022-01-26 11:27:58: setting error state for channel 10.122.7.201: (B eof: 0) ICECC[1550] 2022-01-26 11:27:58: remote status: compiler did not start ICECC[1550] 2022-01-26 11:27:58: write of source chunk to host 10.122.7.201 ICECC[1550] 2022-01-26 11:27:58: failed (Error: Broken pipe) ICECC[1550] 2022-01-26 11:27:58: </write_fd_to_server from cpp: 370ms> ICECC[1550] 2022-01-26 11:27:58: got exception Error 15 - write to host failed (10.122.7.201) ICECC[1550] 2022-01-26 11:27:58: connected to / var /run/icecc/iceccd.socket ICECC[1550] 2022-01-26 11:27:58: <building_local>
    • Dev Platform 2021-09-06, Dev Platform 2021-09-20, Dev Platform 2021-10-04, Dev Platform 2021-10-18, Dev Platform 2022-01-10, Dev Platform 2022-01-24, Dev Platform 2022-02-07, Dev Platform 2022-03-07, Dev Platform 2022-03-21, Dev Platform 2022-04-04

      when generating multiple ninja files with different compilers in each, the run-icecc.sh script has no input file for ninja to check to see if it needs to be rebuilt.

      Below is an example ninja edge of how run-icecc.sh is built:

      build build/aib_make_archive.py build/cached/mongo/config.h $
          build/cached/mongo/util/version_constants.h build/cached/third_party/wiredtiger/wiredtiger.h $
          build/scons/icecream/run-icecc.sh: TEMPLATE src/mongo/config.h.in $
          src/mongo/util/version_constants.h.in src/third_party/wiredtiger/src/include/wiredtiger.in | $
          /usr/bin/icecc /opt/mongodbtoolchain/v3/bin/gcc /opt/mongodbtoolchain/v3/bin/g++
      

      Here the compiler is an input to run-icecc.sh, but that is not enough because each ninja file will have a compiler with an unchanging mtime so run-icecc.sh will not be regenerated.

      A proposed solution from redbeard0531 is to leverage the method from the ninja module: https://github.com/RedBeard0531/mongo_module_ninja/blob/master/build.py#L358-L385

            Assignee:
            daniel.moody@mongodb.com Daniel Moody
            Reporter:
            daniel.moody@mongodb.com Daniel Moody
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: