# gcc version query



## Beeblebrox (Jun 10, 2011)

I build my ports with gcc45. I suspect ccache is not calling the correct version of the compiler, although I have defined in /usr/local/etc/buildflags.conf

```
BUILDFLAGS_GCC= 45
```

1. How can I find out what version of the compiler (42 vs 45) a port was built with?
2. How can I test whether ccache is calling the correct compiler version?


----------



## xibo (Jun 17, 2011)

The __GNUC__, __GNUC_MINOR__ and __GNUC_PATCHLEVEL__ macros hold the gcc version. I don't know whether some port stores them (boost uses them but iirc it doesn't save them somewhere).

In case there isn't, just add a port for

```
#include <stdio.h>
#include <stdlib.h>

int main()
{
  printf("gcc version: %d.%d.%d\n", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
  return (EXIT_SUCCESS);
}
```


----------



## Beeblebrox (Jun 24, 2011)

Thanks xibo.
I have no experience with C code or making ports, etc.  Although your suggestion sounds reasonable, I more or less have absolutely no idea how to implement it 

Thanks anyway...


----------



## Beeblebrox (Oct 29, 2011)

Could I have a little more input / detail on how to make this port?  Can I just [cmd=]# make install <filename>[/cmd] with a txt file containing this script?


----------

