Bug 2121894 - builtins.h requires mpc.h from libmpc-devel
Summary: builtins.h requires mpc.h from libmpc-devel
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: cross-gcc
Version: 36
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: David Howells
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-08-27 03:13 UTC by Robert Elliott
Modified: 2024-08-13 16:09 UTC (History)
4 users (show)

Fixed In Version: cross-gcc-12.2.1-1.fc38 cross-gcc-14.1.1-1.el10_0.1
Clone Of:
Environment:
Last Closed: 2022-08-31 01:00:22 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Robert Elliott 2022-08-27 03:13:02 UTC
Description of problem:
Cross compiles of the linux kernel 6.0-rc1 allmodconfig fail for arm, arm64, mips, powerpc, and s390.

This originates in scripts/gcc-plugins/Kconfig, which has this entry:

menuconfig GCC_PLUGINS
        bool "GCC plugins"
        depends on HAVE_GCC_PLUGINS
        depends on CC_IS_GCC
        depends on $(success,test -e $(shell,$(CC) -print-file-name=plugin)/include/plugin-version.h)
        default y
        depends on $(success,test -e $(shell,$(CC) -print-file-name=plugin)/include/plugin-version.h)

arch/sparc/Kconfig does not include
	select HAVE_GCC_PLUGINS
but all the others do.

The -print-file-name tests passes for all the cross-compilers, but does not 
for native x86:

$ gcc -print-file-name=plugin
plugin 
$ powerpc64-linux-gnu-gcc -print-file-name=plugin
/usr/lib/gcc/powerpc64-linux-gnu/12/plugin
$ aarch64-linux-gnu-gcc -print-file-name=plugin
/usr/lib/gcc/aarch64-linux-gnu/12/plugin

$ find /usr/lib/gcc -name plugin-version.h
/usr/lib/gcc/s390x-linux-gnu/12/plugin/include/plugin-version.h
/usr/lib/gcc/aarch64-linux-gnu/12/plugin/include/plugin-version.h
/usr/lib/gcc/powerpc64-linux-gnu/12/plugin/include/plugin-version.h
/usr/lib/gcc/sparc64-linux-gnu/12/plugin/include/plugin-version.h
/usr/lib/gcc/arm-linux-gnueabi/12/plugin/include/plugin-version.h
/usr/lib/gcc/mips64-linux-gnu/12/plugin/include/plugin-version.h

so  the .x86 .config file only gets:
CONFIG_HAVE_GCC_PLUGINS=y

while the others get that, CONFIG_GCC_PLUGINS, and a several
specific plugins:
build-arm64/.config:CONFIG_HAVE_GCC_PLUGINS=y
build-arm64/.config:CONFIG_GCC_PLUGINS=y
build-arm64/.config:CONFIG_GCC_PLUGIN_LATENT_ENTROPY=y
build-arm64/.config:CONFIG_GCC_PLUGIN_STACKLEAK=y
build-arm64/.config:CONFIG_GCC_PLUGIN_RANDSTRUCT=y

build-arm/.config:CONFIG_HAVE_GCC_PLUGINS=y
build-arm/.config:CONFIG_GCC_PLUGINS=y
build-arm/.config:CONFIG_GCC_PLUGIN_LATENT_ENTROPY=y
build-arm/.config:CONFIG_GCC_PLUGIN_RANDSTRUCT=y

build-mips/.config:CONFIG_HAVE_GCC_PLUGINS=y
build-mips/.config:CONFIG_GCC_PLUGINS=y
build-mips/.config:CONFIG_GCC_PLUGIN_LATENT_ENTROPY=y
build-mips/.config:CONFIG_GCC_PLUGIN_RANDSTRUCT=y

build-powerpc/.config:CONFIG_HAVE_GCC_PLUGINS=y
build-powerpc/.config:CONFIG_GCC_PLUGINS=y
build-powerpc/.config:CONFIG_GCC_PLUGIN_LATENT_ENTROPY=y
build-powerpc/.config:CONFIG_GCC_PLUGIN_RANDSTRUCT=y

build-s390/.config:CONFIG_HAVE_GCC_PLUGINS=y
build-s390/.config:CONFIG_GCC_PLUGINS=y
build-s390/.config:CONFIG_GCC_PLUGIN_LATENT_ENTROPY=y
build-s390/.config:CONFIG_GCC_PLUGIN_RANDSTRUCT=y

build-x86/.config:CONFIG_HAVE_GCC_PLUGINS=y


A header included by each of the plugins, scripts/gcc-plugins/gcc-common.h,
includes a GCC header file called builtins.h that includes <mpc.h>, which 
does not exist anywhere on my system. That causes errors early in the build on all of those architectures.

Version-Release number of selected component (if applicable):
gcc-[each architecture]-linux-gnu 12.1.1

How reproducible:
100%

Steps to Reproduce:
Example for arm 32-bit:

1. make ARCH=arm O=build-arm CROSS_COMPILE=arm-linux-gnu- allmodconfig
2. make ARCH=arm O=build-arm CROSS_COMPILE=arm-linux-gnu- -j 55

Actual results:
For each "GCC plugin", an error like this terminates the make: 

In file included from ../scripts/gcc-plugins/gcc-common.h:95,
                 from ../scripts/gcc-plugins/latent_entropy_plugin.c:78:
/usr/lib/gcc/aarch64-linux-gnu/12/plugin/include/builtins.h:23:10: fatal error: mpc.h: No such file or directory
   23 | #include <mpc.h>
      |          ^~~~~~~
compilation terminated.


Expected results:
no errors

Additional info:
That mpc.h file is provided by the libmpc-devel package.

1. Please add a dependency for the libmpc-devel package from each gcc cross-compiler package that includes a builtins.h file

2. Please investigate whether the native gcc package not having plugins is correct, despite the kernel x86 allmodconfig expecting them by specifying CONFIG_HAVE_GCC_PLUGINS=y

Comment 1 Dan Horák 2022-08-27 11:38:50 UTC
I think that with the native/system gcc you need the gcc-plugin-devel package installed, see https://src.fedoraproject.org/rpms/gcc/blob/rawhide/f/gcc.spec#_755

And because the plugin development files are folded into the main gcc package with cross-gcc, it makes sense to add the missing dependencies there.

Comment 2 Robert Elliott 2022-08-27 16:27:51 UTC
Thanks, installing gcc-plugin-devel makes the native builds work like the others:

$ gcc -print-file-name=plugin
/usr/lib/gcc/x86_64-redhat-linux/12/plugin

make allmodconfig now generates all of these for the native x86 arch:
CONFIG_HAVE_GCC_PLUGINS=y
CONFIG_GCC_PLUGINS=y
CONFIG_GCC_PLUGIN_LATENT_ENTROPY=y
CONFIG_GCC_PLUGIN_STACKLEAK=y
CONFIG_GCC_PLUGIN_RANDSTRUCT=y

It joins the others in having a builtins.h that includes mpc.h:
$ grep mpc.h /usr/lib/gcc/*/12/plugin/include/builtins.h
/usr/lib/gcc/aarch64-linux-gnu/12/plugin/include/builtins.h:#include <mpc.h>
/usr/lib/gcc/arm-linux-gnueabi/12/plugin/include/builtins.h:#include <mpc.h>
/usr/lib/gcc/mips64-linux-gnu/12/plugin/include/builtins.h:#include <mpc.h>
/usr/lib/gcc/powerpc64-linux-gnu/12/plugin/include/builtins.h:#include <mpc.h>
/usr/lib/gcc/s390x-linux-gnu/12/plugin/include/builtins.h:#include <mpc.h>
/usr/lib/gcc/sparc64-linux-gnu/12/plugin/include/builtins.h:#include <mpc.h>
/usr/lib/gcc/x86_64-redhat-linux/12/plugin/include/builtins.h:#include <mpc.h>

Comment 3 Fedora Update System 2022-08-31 00:41:38 UTC
FEDORA-2022-6f4217ad22 has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2022-6f4217ad22

Comment 4 Fedora Update System 2022-08-31 01:00:22 UTC
FEDORA-2022-6f4217ad22 has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 5 Fedora Update System 2024-08-13 11:38:10 UTC
FEDORA-EPEL-2024-009d6cd3eb (cross-gcc-14.1.1-1.el10_0.1) has been submitted as an update to Fedora EPEL 10.0.
https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2024-009d6cd3eb

Comment 6 Fedora Update System 2024-08-13 16:09:09 UTC
FEDORA-EPEL-2024-009d6cd3eb (cross-gcc-14.1.1-1.el10_0.1) has been pushed to the Fedora EPEL 10.0 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.