Welcome to the Linux Foundation Forum!

export?

Options

I'm trying to give the option to run ccache all day instead of typing in each time to use ccache while I compile, "temp env"

if I do export gcc="ccache gcc" or would alias be better?

Comments

  • atreyu
    atreyu Posts: 216
    Options
    tw3ak wrote:
    I'm trying to give the option to run ccache all day instead of typing in each time to use ccache while I compile, "temp env"
    if I do export gcc="ccache gcc" or would alias be better?

    In this case, I think you'd be best off setting your CC variable, like this:
    export set CC='ccache gcc'
    

    I've never used ccache before, though, so someone correct me if I'm wrong.
  • tw3ak
    tw3ak Posts: 37
    Options
    ok,
    I'm a newb so , that's what is great about this forum. I get sweet answers and no nasties, like on IRC.
    Thank YOU!!!

    I'll have to lookup the man page on set, as I haven't gotten that far yet . I 've read to users' guides and I'm about the second half of my second one. Just the first couple of pages of shell programming.
  • kris_z
    kris_z Posts: 1
    Options
    Actually when you do the export gcc="ccache gcc" you just create the environment variable. To refer this variable from command prompt you need to place $ sign before it name. This is a little bit unusable, I think it is better to use alias gcc="ccache gcc" command instead of export.
  • atreyu
    atreyu Posts: 216
    Options
    kris_z wrote:
    Actually when you do the export gcc="ccache gcc" you just create the environment variable. To refer this variable from command prompt you need to place $ sign before it name. This is a little bit unusable, I think it is better to use alias gcc="ccache gcc" command instead of export.

    Yeah, that was the point - Makefiles inheriting the CC env var, instead of using shell aliases, which they often ignore. but you're definitely right, from the cmd line, the alias way makes more sense.
  • tw3ak
    tw3ak Posts: 37
    Options
    Actually,

    In my case?, The new GCC won't support the two names in this version it changed so I can't use it that way I have to ln -s but in my distro there's already a link from cc to gcc........... I'm thinking that I could duplicate gcc and install it in the cc dir then have symbolic links from gcc to ccache and gxx and cc to ccache?
    is there a better solution?
    alias for all three?
  • abrenar
    abrenar Posts: 117
    Options
    put your export script in your profile. simple as that.

    B)

Categories

Upcoming Training