Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build system: Codegen messages are noisy #836

Closed
StephanTLavavej opened this issue May 15, 2020 · 8 comments · Fixed by #1884
Closed

Build system: Codegen messages are noisy #836

StephanTLavavej opened this issue May 15, 2020 · 8 comments · Fixed by #1884
Labels
build Related to the build system external This issue is unrelated to the STL

Comments

@StephanTLavavej
Copy link
Member

Building the STL prints:

S:\GitHub\STL>ninja -C out\build\x64
ninja: Entering directory `out\build\x64'
[390/936] Linking CXX shared library out\bin\amd64\msvcp140_oss.dll
   Creating library stl\msvcp140_base_oss.lib and object stl\msvcp140_base_oss.exp
Generating code
Finished generating code
[427/936] Linking CXX shared library out\bin\amd64\msvcp140_1_oss.dll
   Creating library stl\msvcp140_1_oss.lib and object stl\msvcp140_1_oss.exp
Generating code
Finished generating code
[436/936] Linking CXX shared library out\bin\amd64\msvcp140d_oss.dll
   Creating library stl\msvcp140_based_oss.lib and object stl\msvcp140_based_oss.exp
[575/936] Linking CXX shared library out\bin\amd64\msvcp140_codecvt_ids_oss.dll
   Creating library stl\msvcp140_codecvt_ids_oss.lib and object stl\msvcp140_codecvt_ids_oss.exp
Generating code
Finished generating code
[578/936] Linking CXX shared library out\bin\amd64\msvcp140d_codecvt_ids_oss.dll
   Creating library stl\msvcp140_codecvt_idsd_oss.lib and object stl\msvcp140_codecvt_idsd_oss.exp
[583/936] Linking CXX shared library out\bin\amd64\msvcp140_1d_oss.dll
   Creating library stl\msvcp140_1d_oss.lib and object stl\msvcp140_1d_oss.exp
[704/936] Linking CXX shared library out\bin\amd64\msvcp140_2_oss.dll
   Creating library stl\msvcp140_2_oss.lib and object stl\msvcp140_2_oss.exp
Generating code
Finished generating code
[705/936] Linking CXX shared library out\bin\amd64\msvcp140_2d_oss.dll
   Creating library stl\msvcp140_2d_oss.lib and object stl\msvcp140_2d_oss.exp
[936/936] Linking CXX static library out\lib\amd64\libcpmt1.lib

All of these Creating library, Generating code, and Finished generating code messages are noisy. They also interrupt ninja's progress reporting.

  • Is there some way to configure ninja to suppress these messages?
  • Is there some way to enhance ninja to suppress these messages? (I observe that the MSVC compiler front-end ordinarily likes to print meow.cpp when it compiles a file, yet that isn't appearing here - is that somehow being suppressed, and could that suppression be extended to codegen/linker messages?)
  • Should we file an issue on Developer Community requesting a /silent compiler option? (For compatibility reasons, it's presumably not possible to change the behavior of /nologo.) I can even see where the Generating code / Finished generating code messages are being printed in the compiler's source code, so this shouldn't be too hard to implement.
@StephanTLavavej StephanTLavavej added help wanted Extra attention is needed external This issue is unrelated to the STL build Related to the build system labels May 15, 2020
@cpplearner
Copy link
Contributor

It appears that ninja filters the output of cl in https://github.com/ninja-build/ninja/blob/master/src/clparser.cc:

// static
bool CLParser::FilterInputFilename(string line) {
  transform(line.begin(), line.end(), line.begin(), ToLowerASCII);
  // TODO: other extensions, like .asm?
  return EndsWith(line, ".c") ||
      EndsWith(line, ".cc") ||
      EndsWith(line, ".cxx") ||
      EndsWith(line, ".cpp");
}

then (in CLParser::Parse):

    } else if (FilterInputFilename(line)) {
      // Drop it.
      // TODO: if we support compiling multiple output files in a single
      // cl.exe invocation, we should stash the filename.
    } else {

@StephanTLavavej
Copy link
Member Author

Ah, so it should be possible to add additional filtering! Awesome.

@Berrysoft
Copy link
Contributor

I don't think it's easy for ninja to add filters, because the messages emitted by cl is localized, which means ninja needs hundreds of filters to omit that message. It's eaiser to change code of the compiler, I think.

@AlexGuteniev
Copy link
Contributor

Honestly it may be useful to implement silence option for CL as well, and then skip heuristic from ninja side for a compiler that supports it...

@StephanTLavavej
Copy link
Member Author

@barcharcraz observed that if we get an option from the compiler back-end, we should notify CMake or contribute a change, because CMake could pass that option when creating projects.

@StephanTLavavej
Copy link
Member Author

Thanks @orgads - I see that https://gitlab.kitware.com/cmake/cmake/-/issues/21422 was fixed by https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5492 and should be available in CMake 3.20.0. So awesome! 😸

@orgads
Copy link

orgads commented Mar 17, 2021

Right, I forgot to update here. Sorry.

@StephanTLavavej
Copy link
Member Author

No problem - I’m happy that you set this in motion for when we get a new CMake version via VS. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Related to the build system external This issue is unrelated to the STL
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants