# Can we use clang instead of gcc now ?



## sw2wolf (Aug 9, 2011)

```
>uname -a
 FreeBSD mybsd.zsoft.com 8.2-RELEASE FreeBSD 8.2-RELEASE #2: Sat Feb 26 16:53:57 CST 2011     
root@mybsd.zsoft.com:/media/G/usr/obj/media/G/usr/src/sys/MYKERNEL  i386

>clang -v
 clang version 2.9 (tags/RELEASE_29/final)
 Target: i386-portbld-freebsd8.2
 Thread model: posix

 >head -15 /etc/make.conf
 .if !defined(CC) || ${CC} == "cc"
 CC=clang
 .endif
 .if !defined(CXX) || ${CXX} == "c++"
 CXX=clang++
 .endif
 .if !defined(CPP) || ${CPP} == "cpp"
 CPP=clang -E
 .endif
 # Don't die on warnings
 NO_WERROR=
 WERROR=
 # Don't forget this when using Jails!
 #NO_FSCHG=

 try a little software:
 >cd /usr/ports/lang/guile/
 >sudo make install clean

 >cat ~/.guile 
 (use-modules (ice-9 readline))
 (activate-readline)

 ;(load "money.scm")
 ;(use-modules (money))
 >guile
 guile> (+ 1 2 3)
 6
```

Sincerely!


----------



## xibo (Aug 9, 2011)

You could always use alternatives for individual ports.
FreeBSD-8.2 kernel will build with clang out of the box, the userland needs manual modification. There's also alot of ports that will be troublesome.


----------

