# -fstack-protector not supported by compiler?

## dataking

Trying to install/compile the gentoo-sources kernel 4.9.6-r1, and it fails with the following error:

```
*Enable tracing for RCU (RCU_TRACE) [N/y/?] n

*Provide debugging asserts for adding NO_HZ support to an arch (RCU_EQS_DEBUG) [N/y/?] (NEW)

*Force round-robin CPU selection for unbound work items (DEBUG_WQ_FORCE_RR_CPU) [N/y/?] (NEW)

*Force extended block device numbers and spread them (DEBUG_BLOCK_EXT_DEVT) [N/y/?] n

*Enable CPU hotplug state control (CPU_HOTPLUG_STATE_CONTROL) [N/y/?] (NEW)

*Notifier error injection (NOTIFIER_ERROR_INJECTION) [N/m/y/?] (NEW)

*--

*  SYSTBL  arch/x86/entry/syscalls/../../include/generated/asm/syscalls_32.h

*  HOSTCC  scripts/basic/bin2c

*  CHK     include/config/kernel.release

*  UPD     include/config/kernel.release

*Cannot use CONFIG_CC_STACKPROTECTOR_REGULAR: -fstack-protector not supported by compiler

*make: *** [Makefile:1066: prepare-compiler-check] Error 1

*--

```

All of the searching  I've done seems to indicate that gcc needs to be updated to compile the newer kernels.  But all of the forum and mailing list threads I can find are usually talking about "older" gcc's, e.g. 4.3.x/4.4.x, etc.  I'm currently on gcc-4.9.4 and it seems the only newer versions in portage are 5.x.

Do I need to migrate to gcc-5.x to compile this kernel?  If so, shouldn't the kernel ebuild require >=gcc-5.x?

Am I missing something?

TIA

----------

## NeddySeagoon

dataking,

What does 

```
gcc-config -l
```

 show?

and the output of 

```
emerge sys-devel/gcc -pv
```

 please?

----------

## Syl20

 *dataking wrote:*   

> Do I need to migrate to gcc-5.x to compile this kernel?

 

You don't. Gcc 4.9 does support -fstack-protector (and even -fstack-protector-strong).

----------

## dataking

Neddy, requested output below.  Thanks!

 *NeddySeagoon wrote:*   

> 
> 
> ```
> gcc-config -l
> ```
> ...

 

```
$ sudo gcc-config -l

 [1] i686-pc-linux-gnu-4.9.4 *

```

 *NeddySeagoon wrote:*   

> 
> 
> ```
> emerge sys-devel/gcc -pv
> ```
> ...

 

```
$ sudo emerge -pv sys-devel/gcc

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild   R    ] sys-devel/gcc-4.9.4:4.9.4::gentoo  USE="cxx fortran nls nptl openmp sanitize vtv (-altivec) (-awt) -cilk -debug -doc (-fixed-point) -gcj -go -graphite (-hardened) (-libssp) (-multilib) -nopie -nossp -objc -objc++ -objc-gc -regression-test -vanilla" 88,027 KiB

Total: 1 package (1 reinstall), Size of downloads: 88,027 KiB

```

----------

## ct85711

 *Quote:*   

>  If so, shouldn't the kernel ebuild require >=gcc-5.x? 

 

The kernel it's self does not depend on gcc-5, because you enabled that kernel config option, that is why it is needing gcc-5; you could easily disable that config option and not depend on gcc-5...

----------

## dataking

 *ct85711 wrote:*   

>  *Quote:*    If so, shouldn't the kernel ebuild require >=gcc-5.x?  
> 
> The kernel it's self does not depend on gcc-5, because you enabled that kernel config option, that is why it is needing gcc-5; you could easily disable that config option and not depend on gcc-5...

 Well, if it's really Just That Simple™......   :Wink: 

The odd thing about it though, is this is just from a "genkernel all".  I'm not trying to do anything "fancy".  (genkernel.conf is also *mostly* default.)  Which should mean that others trying to build/install this kernel with genkernel should be seeing similar issues.  If they aren't then it's something unique to my environment.  The problem is, I have no idea what (is unique)!

----------

## Parmenides

 *dataking wrote:*   

>  *ct85711 wrote:*    *Quote:*    If so, shouldn't the kernel ebuild require >=gcc-5.x?  
> 
> The kernel it's self does not depend on gcc-5, because you enabled that kernel config option, that is why it is needing gcc-5; you could easily disable that config option and not depend on gcc-5... Well, if it's really Just That Simple™......  
> 
> The odd thing about it though, is this is just from a "genkernel all".  I'm not trying to do anything "fancy".  (genkernel.conf is also *mostly* default.)  Which should mean that others trying to build/install this kernel with genkernel should be seeing similar issues.  If they aren't then it's something unique to my environment.  The problem is, I have no idea what (is unique)!

 

same problem and no idea how to solve

----------

## krinn

You need the option off, or a gcc that could use it.

I highly recommand you upgrade gcc to 5, because of ABI change, please read https://www.gentoo.org/support/news-items/2015-10-22-gcc-5-new-c++11-abi.html

----------

## Tzvi

I am having the exact same issue;  but I am already running GCC 5.x  (5.4.0)

At this point I think it makes sense for me to turn the option off;  but I am a newbie and not quite sure how to do that.    I tried using genkernal --menuconfig all,  but I have no idea what exactly I need to turn off.

Any help?

----------

## NeddySeagoon

Tzvi,

Have you selected gcc-5.4 and performed the revdep-rebuild or do you have gcc-5.4 installed but not yet in use?

What does 

```
gcc-config -l
```

 say?

----------

## Tzvi

I managed to find the option to disable and everything is working well now.

Thanks NeddySeagoon

----------

## NeddySeagoon

Tzvi,

It works for the wrong reasons.

fstack-protector is a security feature.

The correct course of action is to fix the problem, not work around it by disabling security features.

----------

## krinn

the hint to turn off the option was also made with install a gcc that could support it because the user have a 4x gcc series, and i recommand the switching to gcc 5x over turning off the option.

out of the two options, you create a 3rd: use a gcc 5 and turn the option off.

sorry, that's a bad 3rd option.

----------

## Tzvi

Thank you all for explaining it to me,  I feel better about Gentoo knowing that there is an awesome community like this.

I will attempt to create the kernel with all the necessary security.

----------

## sevilla.larry

genkernel all

Got the same error:

```
*Cannot use CONFIG_CC_STACKPROTECTOR_REGULAR: -fstack-protector not supported by compiler
```

gcc-config -l

```
[1] i686-pc-linux-gnu-6.4.0 *
```

emerge sys-devl/gcc -pv

```

[ebuild R ] sys-devl/gcc-6.4.0-r1:6.4.0::gentoo USE="cxx fortran nls nptl openmp pch (pie) sanitize ssp vtv (-altivec) (-awt) -cilk -debu -doc (-fixed-point) (-gcj) -go -graphite (-hardened) (-jlt) (-libssp) -mpx (-multilib) -objc -objc++ -objc-gc-pgo -regression-test -vanilla" 74,387 KiB

```

----------

## acmondor

I encountered this same problem with "genkernel all" yesterday. I normally don't use genkernel, but I was having trouble getting a manually build kernel to boot as a qemu guest so I thought I'd give it a try. This is on brand new install using the lastest stage3 with gcc 6.4.0. The odd thing is that version of gcc most definitely supports -fstack-protector. I confirmed that by compiling as simple hello world program with that option. I also eventually abandoned genkernel and returned to my manually configured kernel, which I did manage to get working, and it does use CONFIG_CC_STACKPROTECTOR_REGULAR. So, it does seem like there is something not quite right with the way genkernel is doing things.

----------

## LIsLinuxIsSogood

I would find it difficult to believe the problem is with anything other than user systems being misconfigured when running the tool.

Neddy, I think the reason advising about changing kernel configuration option seems incorrect is because that is the purpose of the tool in the first place to not have to configure the kernel  :Razz: 

Also developers of this kind of automated tool that does the work for the user cannot account for every feature, and setting that woud be present andcould  possibly go crazy attempting that.  If the genkernel doesn't build the kernel on the system, it is either time to upgrade the system, reinstall the system, or else learn to manually configure and build the kernel without the need for genkernel.

Those seem like viable options. I don't know what genkernel can do that is so great anyway, anyone???

----------

## khayyam

 *LIsLinuxIsSogood wrote:*   

> Those seem like viable options. I don't know what genkernel can do that is so great anyway, anyone???

 

LIsLinuxIsSogood ... it increases the number of posts on the forum tenfold, and so doubleplusgood.

best ... khay

----------

