Two-stage build w/ ninja - Tests still use stage1 compiler / linker ?

Folks,

I am using a two-stagesimple build like this one:

make -G Ninja -DCLANG_ENABLE_BOOTSTRAP=ON …/src
ninja stage2-check-all

Stage 1 gets built, and when looking at rules.ninja in the stage2-bins I see:

rule CXX_COMPILER_AnalysisTests
depfile = $DEP_FILE
deps = gcc
command = ./bin/clang++ $DEFINES $INCLUDES $FLAGS -MMD -MT $out -MF $DEP_FILE -o $out -c $in

This is just an example, in fact all of the CXX_COMPILER_{unit tests} point to the the compiler and linker as per above example.

Isn’t that the stage1 compiler that is being used here ? I am pretty sure that I am just missing something here. Any pointers of how I can convince cmake to use the just-built (stage2) compiler for the tests ?

Thanks,

/Dirk

Aren’t unit tests always built with the build compiler (which is stage 1 in your case)?

Hello Nemanja,

in effect they are. Even in the 2-stage process both ninja and make use the stage1 compiler (with the caveat that there might be a variable which I am missing). But shouldn’t they be built using the stage2 compiler instead ? As that is the compiler we actually will be installing as product of the build and the one that should be tested ?

Thanks,

/Dirk

From [1], seems Dirk is right. Unless I misread the document.

[1] https://llvm.org/docs/AdvancedBuilds.html#multi-stage-pgo