You are not logged in.

#1 2014-10-31 17:06:37

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

[SOLVED] how to colorize compilation's output?

hi fellows,
I've recently read http://www.phoronix.com/scan.php?page=n … px=MTM2MzI
that GCC is now able to show a colorized output with this magic switch

-fdiagnostics-color=always

now, my question is: where I should put it?

Last edited by nTia89 (2014-11-01 11:08:27)


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#2 2014-10-31 17:23:17

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,532
Website

Re: [SOLVED] how to colorize compilation's output?

It's a command line switch, you put it on the command line.  If you want it always enabled there is a way to do that.  Perhaps you should RTFM.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2014-10-31 17:27:12

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: [SOLVED] how to colorize compilation's output?

do you mean

/etc/makepkg.conf

?


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#4 2014-10-31 17:29:16

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,532
Website

Re: [SOLVED] how to colorize compilation's output?

No.

It's a command line option for gcc, you put it on the command line when you type a gcc command.  If you want it to be automatic it is described in the man page how to do that - the man page for gcc.  RTFM!


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2014-10-31 17:52:51

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: [SOLVED] how to colorize compilation's output?

1) I find that if I set the environment variable

GCC_COLORS

, gcc interprets it as

--fdiagnostics-color=auto

but it's not what I want.....
2) why I can't put it into my

/etc/makepkg.conf

, in the

CFLAGS

line, because it contains other switches?


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#6 2014-10-31 19:46:44

jakobcreutzfeldt
Member
Registered: 2011-05-12
Posts: 1,041

Re: [SOLVED] how to colorize compilation's output?

nTia89 wrote:

1) I find that if I set the environment variable

GCC_COLORS

, gcc interprets it as

--fdiagnostics-color=auto

but it's not what I want.....
2) why I can't put it into my

/etc/makepkg.conf

, in the

CFLAGS

line, because it contains other switches?

Out of curiosity, why do you want it set to always instead of auto? Without RTFM-ing myself, I imagine that it adds the color escape sequences only if stdout is a terminal.

I don't think it will harm anything to put it in your CFLAGS.

Offline

#7 2014-10-31 21:54:52

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: [SOLVED] how to colorize compilation's output?

just curiosity


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#8 2014-10-31 22:22:17

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,532
Website

Re: [SOLVED] how to colorize compilation's output?

You can put it in your makepkg.conf if you want it to only work when you run makepkg - but that's not at all what you asked.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#9 2014-10-31 22:24:17

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: [SOLVED] how to colorize compilation's output?

Just export that var in your ~/.bashrc or whatever.

export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
man gcc wrote:

-fdiagnostics-color[=WHEN]
-fno-diagnostics-color
  Use color in diagnostics.  WHEN is never, always, or auto.  The default is never if GCC_COLORS environment variable isn't present in the environment, and auto otherwise.

Last edited by graysky (2014-11-01 11:14:04)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#10 2014-11-01 11:08:10

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: [SOLVED] how to colorize compilation's output?

ok, now I understand
thank!


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

Board footer

Powered by FluxBB