Bug 208947 - bsdmake loses colored output with -j 2
Summary: bsdmake loses colored output with -j 2
Status: Closed Works As Intended
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 10.3-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-21 08:37 UTC by Hannes Hauswedell
Modified: 2022-11-18 21:14 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hannes Hauswedell 2016-04-21 08:37:22 UTC
Since version 5 of GCC and in all recent versions of clang color is used to greatly enhance the readability of the compiler output.
With FreeBSD's make the color disappears, as soon as you use multiple jobs which is something you almost always want to do.

To reproduce, create

==test.cpp==

#include <iostream>
int main()
{
    std::cout << "foo" << "bar;
    return 0;
}

==Makefile==

test: test.cpp
	g++5 -o test test.cpp -std=c++14


% make
[see output with color]

% gmake
[see output with color]

% make -j 2
[no color :'(]

% gmake
[see output with color]


This might seems like it is not really important, but for larger codebases with templatatized code (and thus huge error messages) it makes a big difference! Also, I suspect it wouldn't be too hard to fix?

Thank you very much!
Comment 1 Ed Maste freebsd_committer freebsd_triage 2022-11-18 21:14:36 UTC
see the -fdiagnostics-color option in the GCC documentation, and in particular -fdiagnostics-color=always. most build tools buffer output from individual jobs when running multiple jobs, and so tools like GCC or Clang detect that they are not outputting to a terminal (directly) and disable colour by default. So, this behaviour is as expected.