# nvidia-drivers and gcc-9.x issues [solved]

## Mgiese

hello, 

when using gcc-9.1 or gcc-9.2,  I have issues installing nvidia-drivers-440.31(as well as nvidia-drivers-435.21). using 8.x works well, any suggestions on this ?

```

cc1: error: incompatible gcc/plugin versions

cc1: error: fail to initialize plugin ./scripts/gcc-plugins/structleak_plugin.so

cc1: error: incompatible gcc/plugin versions

cc1: error: fail to initialize plugin ./scripts/gcc-plugins/latent_entropy_plugin.so

cc1: error: incompatible gcc/plugin versions

cc1: error: fail to initialize plugin ./scripts/gcc-plugins/randomize_layout_plugin.so

cc1: error: incompatible gcc/plugin versions

cc1: error: fail to initialize plugin ./scripts/gcc-plugins/structleak_plugin.so

cc1: error: incompatible gcc/plugin versions

cc1: error: fail to initialize plugin ./scripts/gcc-plugins/latent_entropy_plugin.so

cc1: error: incompatible gcc/plugin versions

cc1: error: fail to initialize plugin ./scripts/gcc-plugins/randomize_layout_plugin.so

make[2]: *** [scripts/Makefile.build:281: /var/tmp/portage/x11-drivers/nvidia-drivers-440.31/work/kernel/nvidia/nv-frontend.o] Error 1

make[2]: *** Waiting for unfinished jobs....

make[2]: *** [scripts/Makefile.build:281: /var/tmp/portage/x11-drivers/nvidia-drivers-440.31/work/kernel/nvidia/nv.o] Error 1

cc1: error: incompatible gcc/plugin versions

cc1: error: incompatible gcc/plugin versions

cc1: error: fail to initialize plugin ./scripts/gcc-plugins/structleak_plugin.so

cc1: error: fail to initialize plugin ./scripts/gcc-plugins/structleak_plugin.so

cc1: error: incompatible gcc/plugin versions

cc1: error: incompatible gcc/plugin versions

cc1: error: fail to initialize plugin ./scripts/gcc-plugins/latent_entropy_plugin.so

cc1: error: fail to initialize plugin ./scripts/gcc-plugins/latent_entropy_plugin.so

cc1: error: incompatible gcc/plugin versions

cc1: error: incompatible gcc/plugin versions

cc1: error: fail to initialize plugin ./scripts/gcc-plugins/randomize_layout_plugin.so

cc1: error: fail to initialize plugin ./scripts/gcc-plugins/randomize_layout_plugin.so

make[2]: *** [scripts/Makefile.build:281: /var/tmp/portage/x11-drivers/nvidia-drivers-440.31/work/kernel/nvidia/nv-pci.o] Error 1

make[2]: *** [scripts/Makefile.build:281: /var/tmp/portage/x11-drivers/nvidia-drivers-440.31/work/kernel/nvidia/nv-acpi.o] Error 1

make[1]: *** [Makefile:1626: _module_/var/tmp/portage/x11-drivers/nvidia-drivers-440.31/work/kernel] Error 2

make[1]: Leaving directory '/usr/src/linux-5.3.6-gentoo-r1'

make: *** [Makefile:81: modules] Error 2

```

thanks a lot

----------

## Hu

For what gcc are those plugins built?  It looks to me like you built the kernel with one version of gcc, then tried to build the drivers with a different version of gcc.  Even if you got past the plugin problems, this likely won't work, since the kernel normally requires you to use the same version of gcc for the core kernel and for the modules.

----------

## OldTango

 *Hu wrote:*   

> For what gcc are those plugins built?  It looks to me like you built the kernel with one version of gcc, then tried to build the drivers with a different version of gcc.  Even if you got past the plugin problems, this likely won't work, since the kernel normally requires you to use the same version of gcc for the core kernel and for the modules.

 Are you sure about this?  I know the nvidia-drivers have to be built against the kernel you intend to run or they won't load, but I have never heard that gcc could pose a problem. I believe the nvidia package uses /usr/src/linux by default for the kernel it builds against.

```
uname -a

Linux SuperTux 4.16.5-gentoo #6 SMP Tue May 15 11:12:26 MDT 2018 x86_64 AMD Ryzen Threadripper 1950X 16-Core Processor AuthenticAMD GNU/Linux
```

As you can see the kernel I am running was built over a year ago and I believe it was built with ether the 6x or 7x versions of gcc. I have updated and ran at least one version of gcc and several updates to the nvidia-drivers packages as well without a single issue using this kernel, (yet).

Tango.....  :Confused: 

----------

## Hu

I was certain when I wrote that, but I checked the sources before answering now and I see that I was wrong.  The version magic requires matching kernel release (UTS), SMP, PREEMPT, MODULE_UNLOAD, MODVERSIONS, architecture vermagic, and randstruct.  Notably absent from this list is gcc version.  Therefore, you are correct: you can use different gcc versions for the core kernel and modules, and the kernel will not complain.  Whether it is guaranteed to work correctly is an entirely separate question.  :Smile: 

Since OP has enabled randstruct, he will need matching randstruct configurations between core kernel and modules, and to get that, he will need to get the randstruct plugin to work.  The easiest way to do that would be to use the same gcc version everywhere.  While my advice to match gcc versions was based on a faulty recollection, it still would solve a problem that needs to be solved.  :Wink: 

Also, I should point out that you really ought to upgrade.  A kernel more than a year out of date is missing numerous security patches, and that series has long since been discontinued.

----------

## OldTango

 *Hu wrote:*   

> I was certain when I wrote that, but I checked the sources before answering now and I see that I was wrong.  The version magic requires matching kernel release (UTS), SMP, PREEMPT, MODULE_UNLOAD, MODVERSIONS, architecture vermagic, and randstruct.  Notably absent from this list is gcc version.  Therefore, you are correct: you can use different gcc versions for the core kernel and modules, and the kernel will not complain.  Whether it is guaranteed to work correctly is an entirely separate question. 

 I can't say you were wrong because the Nvidia docs do state  *Quote:*   

> You appear to be compiling the NVIDIA kernel module with
> 
>    a compiler different from the one that was used to compile
> 
>    the running kernel. This may be perfectly fine, but there
> ...

 All of the nvidia-driver packages in portage set "IGNORE_CC_MISMATCH" and should suppress all gcc mismatch errors, but as you say there is no guarantee this will work right if at all. 

 *Hu wrote:*   

> Since OP has enabled randstruct, he will need matching randstruct configurations between core kernel and modules, and to get that, he will need to get the randstruct plugin to work.  The easiest way to do that would be to use the same gcc version everywhere.  While my advice to match gcc versions was based on a faulty recollection, it still would solve a problem that needs to be solved. 

 Seems like sound advise to me....  :Smile: 

 *Hu wrote:*   

> Also, I should point out that you really ought to upgrade.  A kernel more than a year out of date is missing numerous security patches, and that series has long since been discontinued.

 Again good advise. I put this kernel together reluctantly but at the time it was the only one in portage that provided the necessary drivers and support for my hardware and even the stable version of gcc at the time didn't provide good support for my processor. Once gentoo-sources-4.19.82 is stable (soon now) I will be installing it.

Tango.....  :Smile: 

----------

## krinn

i think you have more an issue with the gcc modules, everything i have is older, and fine

```
strings /lib/modules/4.14.67/video/nvidia.ko | grep "gcc\|version\="

gcc version 9.2.0 (Gentoo 9.2.0 p1) 

version=435.17

srcversion=69532EC3A412554E1395430
```

----------

## Mgiese

thanks for the replies! is there a way to find out with which gcc the kernel has been build ?

and is it sufficient to do "make menuconfig all" and then exit , to build with the new gcc version (after gcc-config x) ? or is it necessary to do a "make clean" ?

----------

## Jaglover

You do 'make clean' and 'make' and 'make modules_install', nothing else.

----------

## Mgiese

 *Jaglover wrote:*   

> You do 'make clean' and 'make' and 'make modules_install', nothing else.

 

it looked as if the whole kernel was rebuild after switching to gcc-9.2. i did not do clean or modules_install.... nvidia-drivers-440.31 compile fine now....

----------

## OldTango

 *Mgiese wrote:*   

> thanks for the replies! is there a way to find out with which gcc the kernel has been build ?

 

```
uname -a
```

Will tell you what kernel your booted into. If you have more than one kernel that you can boot, be careful that you KNOW which kernel is booted.

```
eselect gcc list
```

Will tell you what versions of gcc you have and if more than one which one is currently active.

If you running a later kernel find it's .config file and have a look.  Near the very top should be a line telling you what complier was used to build the kernel. Here is the info from my recent .config.

```
#

# Automatically generated file; DO NOT EDIT.

# Linux/x86 4.19.82-gentoo Kernel Configuration

#

#

# Compiler: gcc (Gentoo 9.2.0-r2 p3) 9.2.0
```

Best TangoLast edited by OldTango on Fri Nov 15, 2019 1:37 am; edited 1 time in total

----------

## OldTango

A little late with my help I see. Glad you got it fixed.  Remember to mark this subject as SOLVED.

Best Tango

----------

## Mgiese

 *OldTango wrote:*   

> A little late with my help I see. Glad you got it fixed.  Remember to mark this subject as SOLVED.
> 
> Best Tango

 

i`ll do. thanks a lot !

----------

