# [Solved] gcc-8.2.0-r3: Plugins not supported?

## toofied

Not sure what I'm doing wrong here or if I found a bug. I seem to remember this working perfectly in gcc7, but recently re-installed Gentoo on the testing branch.

During gen-kernel, if GCC plugins are enabled:

```

* ERROR: Failed to compile the "prepare" target...

* 

* -- Grepping log... --

* 

*  HOSTCC  arch/x86/tools/relocs_common.o

*  HOSTLD  arch/x86/tools/relocs

*In file included from ./scripts/gcc-plugins/gcc-common.h:87,

*                 from <stdin>:1:

*/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/plugin/include/attribs.h: In function ‘tree_node* canonicalize_attr_name(tree)’:

*/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/plugin/include/attribs.h:118:12: error: ‘get_identifier_with_length’ was not declared in this scope

*--

*/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/plugin/include/attribs.h:118:12: note: suggested alternative: ‘get_attr_min_length’

*     return get_identifier_with_length (s + 2, l - 4);

*            ^~~~~~~~~~~~~~~~~~~~~~~~~~

*            get_attr_min_length

*Cannot use CONFIG_GCC_PLUGINS: your gcc installation does not support plugins, perhaps the necessary headers are missing?

*make: *** [scripts/Makefile.gcc-plugins:52: gcc-plugins-check] Error 1

*--

* Running with options: --kernel-config=/kernel.config all

* Using genkernel.conf from /etc/genkernel.conf

* Sourcing arch-specific config.sh from /usr/share/genkernel/arch/x86_64/config.sh ..

* Sourcing arch-specific modules_load from /usr/share/genkernel/arch/x86_64/modules_load ..

*

* ERROR: Failed to compile the "prepare" target...

* 

* -- End log... --

```

This is a standard x86 computer on a 4.9.x kernel.

Any ideas?Last edited by toofied on Sun Oct 07, 2018 5:10 pm; edited 1 time in total

----------

## eccerr0r

Looks like gcc8 causes problems indeed.  What kernel are you trying to compile?

It seems like there were some kernel commits that were done to make gcc8 happy, but they may not have been backported to 4.9.x kernels...  So you'll have to either backport, upgrade the kernel, or go back to gcc7.

----------

## fedeliallalinea

https://groups.google.com/forum/#!topic/qubes-devel/Q3cdQKQS4Tk

[Moderator edit: fixed [url] tag.  Forum auto-linking does not work when the URL contains exclamations. -Hu]

----------

## toofied

 *fedeliallalinea wrote:*   

> https://groups.google.com/forum/#!topic/qubes-devel/Q3cdQKQS4Tk

 

Thanks, this solved it for me in 4.9.131:

```

diff -ru a/scripts/gcc-plugins/gcc-common.h b/scripts/gcc-plugins/gcc-common.h

--- a/scripts/gcc-plugins/gcc-common.h   2018-10-03 20:01:55.000000000 -0400

+++ b/scripts/gcc-plugins/gcc-common.h   2018-10-07 10:11:18.458335576 -0400

@@ -83,6 +83,10 @@

 #include "predict.h"

 #include "ipa-utils.h"

 

+#if BUILDING_GCC_VERSION >= 8000

+#include "stringpool.h"

+#endif

+

 #if BUILDING_GCC_VERSION >= 4009

 #include "attribs.h"

 #include "varasm.h"

diff -ru a/scripts/gcc-plugins/latent_entropy_plugin.c b/scripts/gcc-plugins/latent_entropy_plugin.c

--- a/scripts/gcc-plugins/latent_entropy_plugin.c   2018-10-03 20:01:55.000000000 -0400

+++ b/scripts/gcc-plugins/latent_entropy_plugin.c   2018-10-07 10:10:52.786337142 -0400

@@ -255,21 +255,14 @@

    return NULL_TREE;

 }

 

-static struct attribute_spec latent_entropy_attr = {

-   .name            = "latent_entropy",

-   .min_length         = 0,

-   .max_length         = 0,

-   .decl_required         = true,

-   .type_required         = false,

-   .function_type_required      = false,

-   .handler         = handle_latent_entropy_attribute,

-#if BUILDING_GCC_VERSION >= 4007

-   .affects_type_identity      = false

-#endif

-};

+static struct attribute_spec latent_entropy_attr = { };

 

 static void register_attributes(void *event_data __unused, void *data __unused)

 {

+   latent_entropy_attr.name      = "latent_entropy";

+   latent_entropy_attr.decl_required   = true;

+   latent_entropy_attr.handler      = handle_latent_entropy_attribute;

+

    register_attribute(&latent_entropy_attr);

 }

 

```

----------

## nsoveiko

i will revive this thread as gcc-8.2 is now in stable and i've just encountered the same problem:

```
/usr/src/linux-4.9.158-gentoo # make -j2 -l3

  CHK     include/config/kernel.release

  CHK     include/generated/uapi/linux/version.h

  CHK     include/generated/utsrelease.h

  HOSTCC  arch/x86/tools/relocs_32.o

  HOSTCC  arch/x86/tools/relocs_64.o

  HOSTCC  arch/x86/tools/relocs_common.o

  HOSTLD  arch/x86/tools/relocs

In file included from ./scripts/gcc-plugins/gcc-common.h:87,

                 from <stdin>:1:

/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/plugin/include/attribs.h: In function ‘tree_node* canonicalize_attr_name(tree)’:

/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/plugin/include/attribs.h:118:12: error: ‘get_identifier_with_length’ was not declared in this scope

     return get_identifier_with_length (s + 2, l - 4);

            ^~~~~~~~~~~~~~~~~~~~~~~~~~

/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/plugin/include/attribs.h:118:12: note: suggested alternative: ‘get_attr_min_length’

     return get_identifier_with_length (s + 2, l - 4);

            ^~~~~~~~~~~~~~~~~~~~~~~~~~

            get_attr_min_length

Cannot use CONFIG_GCC_PLUGINS: your gcc installation does not support plugins, perhaps the necessary headers are missing?

make: *** [scripts/Makefile.gcc-plugins:52: gcc-plugins-check] Error 1
```

```
/usr/src/linux-4.9.158-gentoo # gcc --version

gcc (Gentoo Hardened 8.2.0-r6 p1.7) 8.2.0

Copyright (C) 2018 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```

this was supposed to have been fixed in kernel 4.9.131 (according to toofied's post above), yet still present in 4.9.158.

are there better options besides rolling gcc back to 7.x?

----------

