-
Notifications
You must be signed in to change notification settings - Fork 7.2k
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
Add color to build output log (more readable errors and warnings) (IDFGH-1965) #4162
Comments
I've added |
There is no official support for this in the sense that you can't pass an argument to You still need to set the GCC_COLORS however for the colors you want the output to be. |
You can colorize the log with following code.
I found the way from the source code of esp_log.h |
@esanai I think @AloyseTech was referring to colorizing the actual output build log, not the runtime logs. |
@renzbagaporo You are right. I'm sorry for my misunderstanding. |
Or the devs could actually fix this? It works with Make, for heaven's sake. |
Add the parameters onto the environment, by executing: export EXTRA_CFLAGS=-fdiagnostics-color=always
export GCC_COLORS="error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:quote=01:path=01;36:fixit-insert=32:fixit-delete=31:diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:type-diff=01;32" before my Ps. Putting the some definitive handles here how to enable colour build-output would would surely help a lot of people, as this issue is where people land when searching for coloured build output. |
For me the approach above of setting |
@renzbagaporo Please consider reopening this issue. I believe a colorized output should be the default in 2021. |
Hi all, idf_build_set_property(COMPILE_OPTIONS "-fdiagnostics-color=always" APPEND) if you have other flag to set, you'll need to write them in separate line, e.g. idf_build_set_property(COMPILE_OPTIONS "-Wno-error=class-memaccess" APPEND)
idf_build_set_property(COMPILE_OPTIONS "-fdiagnostics-color=always" APPEND) since |
@wenbozzz |
IDF can and should set this by default, as there's no downside and it's still a (unnecessary) downgrade from Make. |
@KaeLL Thanks for the ping. I think enabling |
Just an update, we haven't forgotten about this issue. Support for color diagnostics has just been merged into CMake (https://gitlab.kitware.com/cmake/cmake/-/merge_requests/6990) and we plan to upgrade the bundled CMake version as soon as the new version is released. |
Another update: CMake 3.24.0 is about to be released and we now have a work-in-progress IDF branch which uses the new |
Related to #4162 Setting this option informs CMake that it should pass -fcolor-diagnostics flag to the compiler. (Colorized build system output, like from GNU Make, is produced even without this flag.) Note that if the build is done using Ninja and the build output is redirected (not a TTY), Ninja will still strip the escape codes from the output. For the case of idf.py, this is handled in the next commit.
Color output from idf.py should now be available in the |
Related to #4162 Setting this option informs CMake that it should pass -fcolor-diagnostics flag to the compiler. (Colorized build system output, like from GNU Make, is produced even without this flag.) Note that if the build is done using Ninja and the build output is redirected (not a TTY), Ninja will still strip the escape codes from the output. For the case of idf.py, this is handled in the next commit.
Related to #4162 Setting this option informs CMake that it should pass -fcolor-diagnostics flag to the compiler. (Colorized build system output, like from GNU Make, is produced even without this flag.) Note that if the build is done using Ninja and the build output is redirected (not a TTY), Ninja will still strip the escape codes from the output. For the case of idf.py, this is handled in the next commit.
Thanks for reporting, will close due to short of feedback, feel free to reopen with more updates. Thanks. |
Environment
Problem Description
The build process output a lot of text. It is sometimes difficult to spot errors and warnings.
Expected Behavior
It could be great if the output could be colorized (red for errors, orange/yellow for warning etc), to make the build log more readable.
The text was updated successfully, but these errors were encountered: