# Changing used gcc version for ports in make.conf



## his_royal_evilness (Mar 17, 2011)

Hi all, 

I'm trying to use gcc45 for my ports, but want to exclude openldap from it.. It is not working, openldap still uses gcc45.

Contents of my make.conf:


```
.if !empty(.CURDIR:M/usr/ports/*) && exists(/usr/local/bin/gcc45)
CC=gcc45
CXX=g++45
CPP=cpp45
.endif


.if !empty(.CURDIR:M/usr/ports/*) && exists(/usr/local/bin/gcc45)
.if empty(.CURDIR:M/usr/ports/net/openldap*)
CC=gcc45
CXX=g++45
CPP=cpp45
.endif
.endif
```


----------



## sk8harddiefast (Mar 17, 2011)

Never touch system's compiler! There is a judge list with ports that cannot build with gcc45! If you want to compile something with gcc45 do it manually. But you never change system's default compiler. Can harmful your system!


----------



## his_royal_evilness (Mar 17, 2011)

Perhaps you're not getting my point: I only use gcc45 for ports. But I want to exclude packages like openldap from gcc 45, so that I can compile these with the default compiler!


----------



## sk8harddiefast (Mar 17, 2011)

I am getting your point.





> I only use gcc45 for ports ..


. Is wrong! That I am trying to explain to you.
But if you insist, then maybe comment all lines on make.conf, compile the packages you want and comment them again.
I don't know how exactly you can permanent exclude packages to be build with default compiler.


----------



## dennylin93 (Mar 17, 2011)

Check out this article: Using newer version of GCC and binutils with the FreeBSD Ports Collection.


----------



## his_royal_evilness (Mar 17, 2011)

dennylin93 said:
			
		

> Check out this article: Using newer version of GCC and binutils with the FreeBSD Ports Collection.



I've based my make.conf on that, but it doesn't work. It makes me build all ports with gcc45, even my configured exceptions are still being built with the 45 version :\


----------



## tyson (Mar 17, 2011)

his_royal_evilness said:
			
		

> Hi all ,
> 
> I'm trying to use gcc45 for my ports , but want to exclude openldap from it..
> 
> ...



To make it working you need to delete the first "if/endif" block

```
[B]REMOVE THIS !!![/B]
.if !empty(.CURDIR:M/usr/ports/*) && exists(/usr/local/bin/gcc45)
CC=gcc45
CXX=g++45
CPP=cpp45
.endif
```

and leave only this part:

```
.if !empty(.CURDIR:M/usr/ports/*) && exists(/usr/local/bin/gcc45)
.if empty(.CURDIR:M/usr/ports/net/openldap*)
CC=gcc45
CXX=g++45
CPP=cpp45
.endif
.endif
```


----------

