# building ports with gcc46 under 8-STABLE (for the fun)



## tobe (Aug 13, 2011)

Hello,

I have to stay home today just in case my employer calls me for assistance, so i decided to mess around with FreeBSD ports on my laptop 

I've installed gcc46 (as described in the handbook, but for gcc44) and tried to recompile all ports.

*I known this is not a good idea*, but remember i'm just playing with my computer to kill time and probably most of the softwares i've installed so far.

I got some problems with the stack protector flag (now enabled by default), lots of ports failed to build with the following error :


```
undefined reference to `__stack_chk_fail_local'
```

So i decided to remove it (...) by adding the line "SSP_CFLAGS=" in /etc/make.conf, only for ports.

Seems like it's building fine now, but i have a couple of questions :

Is this a known problem ?
Is SSP_CFLAGS= the "right way", if any, to disable stack protection ?
Or, is there any way to keep stack protection and build with gcc46 ?


----------



## poh-poh (Aug 13, 2011)

Try to place gcc46 libs before basegcc libs in rtld(1) hints which also affect ld(1) that's likely link against wrong libssp (another example is PR ports/148196), e.g.

```
Index: etc/rc.d/ldconfig
===================================================================
--- etc/rc.d/ldconfig	(revision 224789)
+++ etc/rc.d/ldconfig	(working copy)
@@ -22,7 +22,7 @@
 	ldconfig=${ldconfig_command}
 	checkyesno ldconfig_insecure && _ins="-i"
 	if [ -x "${ldconfig_command}" ]; then
-		_LDC="/lib /usr/lib"
+		_LDC="/usr/local/lib/gcc46 /lib /usr/lib"
 		for i in ${ldconfig_local_dirs}; do
 			if [ -d "${i}" ]; then
 				_files=`find ${i} -type f`
```


----------



## tobe (Aug 13, 2011)

Thanks for the suggestion, and for pointing me the PR, but i'd prefer something i could configure conditionally like it's done in /etc/make.conf.

I'll take a look at the -rpath option later, i'm now rebuilding all ports and i don't want to stop it right now


----------

