You are not logged in.

#1 2022-06-03 20:33:48

giostark
Member
Registered: 2016-12-03
Posts: 39

[SOLVED] gcc version 12.1 compiling linux-vfio

edit: solution is listed down.

Hi all ,
Tried to understand reading around but is clear I'm missing steps.

I'm using the kernel linux-vfio for the IMMO groups.
After the usual system update now the nvidia module wont load anymore.
I thought , fine I have to recompile the kernel (is happened several times, it's ok) , done , still error.
All is switching to the gcc 12.1 ...
The kernel was re-compiled with the 11.2 despite in the system there are only the 12.1. How is possible?

[server@server ~]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror --with-build-config=bootstrap-lto --enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.1.0 (GCC) 
[server@server ~]$ which gcc
/usr/bin/gcc
[server@server ~]$ which gcc-12.1
which: no gcc-12.1 in (/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)

I cleared the cache of yay with "yay -Scc". Rebooted in the stock kernel , installed back again the  linux-vfio 5.17.4.arch1-1 (downloaded the source , 30min of compiling, still error because the kernel seems come compiled with the gcc 11.2 ? )
Sorry for the noob question , but the source is compiled itself with the gcc? Then I recompile it again on my system?

Some tips is appreciated !

TNX


DKMS make.log for nvidia-515.43.04 for kernel 5.17.4-arch1-1-vfio (x86_64)
Fri Jun  3 08:41:21 PM CEST 2022
make[1]: Entering directory '/usr/lib/modules/5.17.4-arch1-1-vfio/build'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc (GCC) 11.2.0
  You are using:           cc (GCC) 12.1.0

Warning: Compiler version check failed:

The major and minor number of the compiler used to
compile the kernel:

gcc (GCC) 11.2.0, GNU ld (GNU Binutils) 2.38

does not match the compiler used here:

cc (GCC) 12.1.0

Last edited by giostark (2022-06-05 00:48:21)

Offline

#2 2022-06-03 21:19:56

loqs
Member
Registered: 2014-03-06
Posts: 17,327

Re: [SOLVED] gcc version 12.1 compiling linux-vfio

What is the value of CONFIG_CC_VERSION_TEXT from /usr/lib/modules/5.17.4-arch1-1-vfio/build/.config and does .BUILDINFO of the kernel package contain 'installed = gcc-11.2.0-4-x86_64' (.BUILDINFO is in the root of the package archive)

Offline

#3 2022-06-03 23:36:53

giostark
Member
Registered: 2016-12-03
Posts: 39

Re: [SOLVED] gcc version 12.1 compiling linux-vfio

Thanks for the support :-)

The /usr/lib/modules/5.17.4-arch1-1-vfio/build/.config :

# Automatically generated file; DO NOT EDIT.
# Linux/x86 5.17.4-arch1 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="gcc (GCC) 11.2.0"
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=110200
CONFIG_CLANG_VERSION=0
CONFIG_AS_IS_GNU=y
CONFIG_AS_VERSION=23800
CONFIG_LD_IS_BFD=y
CONFIG_LD_VERSION=23800
CONFIG_LLD_VERSION=0
CONFIG_CC_CAN_LINK=y
CONFIG_CC_CAN_LINK_STATIC=y
CONFIG_CC_HAS_ASM_GOTO=y
CONFIG_CC_HAS_ASM_GOTO_OUTPUT=y
CONFIG_CC_HAS_ASM_INLINE=y
CONFIG_CC_HAS_NO_PROFILE_FN_ATTR=y
CONFIG_IRQ_WORK=y
CONFIG_BUILDTIME_TABLE_SORT=y
CONFIG_THREAD_INFO_IN_TASK=y

Downloading the snapshot ,  it contain the "config" as above.
In the sources https://aur.archlinux.org/packages/linux-vfio-headers still the content is the exactly the same.

I should change the line CONFIG_CC_VERSION_TEXT="gcc (GCC) 11.2.0" to CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.1.0"  , save the file and recompile the kernel?

Offline

#4 2022-06-03 23:46:33

loqs
Member
Registered: 2014-03-06
Posts: 17,327

Re: [SOLVED] gcc version 12.1 compiling linux-vfio

No the build will set CONFIG_CC_VERSION_TEXT and related values.  If you still have the $srcdir for the new build does the $srcdir/linux-vfio/.config show gcc 11 or 12?

Offline

#5 2022-06-04 00:16:31

giostark
Member
Registered: 2016-12-03
Posts: 39

Re: [SOLVED] gcc version 12.1 compiling linux-vfio

Ok I lunched again the compiling for regenerate the src and it say 11.2 ( /home/server/.cache/yay/linux-vfio/src/config )

Last edited by giostark (2022-06-04 00:18:21)

Offline

#6 2022-06-04 11:27:41

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: [SOLVED] gcc version 12.1 compiling linux-vfio

Does it help if you manually remove /home/server/.cache/yay/linux-vfio folder and then build again ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#7 2022-06-04 20:31:35

giostark
Member
Registered: 2016-12-03
Posts: 39

Re: [SOLVED] gcc version 12.1 compiling linux-vfio

@Lone thanks for the tip but unfortunately I tried already to clear the cache with yay -Scc. When I execute this command it clear the src folder and I have to re-download the source.
Is there not way to compile it with the gcc 12.1?

Offline

#8 2022-06-04 20:42:21

loqs
Member
Registered: 2014-03-06
Posts: 17,327

Re: [SOLVED] gcc version 12.1 compiling linux-vfio

What is the output of

type -a gcc

If you remove the use of yay and instead use

makepkg -Crso

The build will stop after prepare has been executed.  Check the version of gcc recorded in $srcdir/linux-vfio/.config

Offline

#9 2022-06-04 22:35:24

giostark
Member
Registered: 2016-12-03
Posts: 39

Re: [SOLVED] gcc version 12.1 compiling linux-vfio

[server@server ~]$ type -a gcc
gcc is /usr/bin/gcc

Executed the makepkg -Crso and the result of ~/linux-vfio/src/config is identical to the "config" above with gcc 11.2.
But in the console are mentioned the 12.1 :

-CONFIG_CC_VERSION_TEXT="gcc (GCC) 11.2.0"
+CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.1.0"
[server@server linux-vfio]$ makepkg -Crso
==> Making package: linux-vfio 5.17.4.arch1-1 (Sun 05 Jun 2022 12:22:21 AM CEST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Cloning archlinux-linux git repo...
Cloning into bare repository '/home/server/Downloads/builds_tmp/linux-vfio-5.17/linux-vfio/archlinux-linux'...
remote: Enumerating objects: 9059741, done.
remote: Total 9059741 (delta 0), reused 0 (delta 0), pack-reused 9059741
Receiving objects: 100% (9059741/9059741), 3.71 GiB | 28.78 MiB/s, done.
Resolving deltas: 100% (7516813/7516813), done.
  -> Found config
  -> Found add-acs-overrides.patch
  -> Found i915-vga-arbiter.patch
==> Validating source files with sha256sums...
    archlinux-linux ... Skipped
    config ... Passed
    add-acs-overrides.patch ... Passed
    i915-vga-arbiter.patch ... Passed
==> Verifying source file signatures with gpg...
    archlinux-linux git repo ... Passed
==> Removing existing $srcdir/ directory...
==> Extracting sources...
  -> Creating working copy of archlinux-linux git repo...
Cloning into 'archlinux-linux'...
done.
Updating files: 100% (76673/76673), done.
Updating files: 100% (20321/20321), done.
Switched to a new branch 'makepkg'
==> Starting prepare()...
Setting version...
Applying patch add-acs-overrides.patch...
patching file Documentation/admin-guide/kernel-parameters.txt
Hunk #1 succeeded at 3937 (offset 308 lines).
patching file drivers/pci/quirks.c
Hunk #1 succeeded at 193 (offset 1 line).
Hunk #2 succeeded at 5065 with fuzz 1 (offset 196 lines).
Applying patch i915-vga-arbiter.patch...
patching file drivers/gpu/drm/i915/display/intel_display.c
Hunk #1 succeeded at 9750 (offset -2554 lines).
Hunk #2 succeeded at 9907 (offset -2571 lines).
Hunk #3 succeeded at 10761 (offset -2622 lines).
patching file drivers/gpu/drm/i915/display/intel_display.h
Hunk #1 succeeded at 566 (offset 2 lines).
patching file drivers/gpu/drm/i915/display/intel_vga.c
Hunk #1 succeeded at 44 (offset 3 lines).
Hunk #2 succeeded at 83 (offset 3 lines).
patching file drivers/gpu/drm/i915/display/intel_vga.h
patching file drivers/gpu/drm/i915/i915_params.c
Hunk #1 succeeded at 143 with fuzz 2 (offset 3 lines).
patching file drivers/gpu/drm/i915/i915_params.h
Hunk #1 succeeded at 75 with fuzz 2 (offset 3 lines).
Setting config...
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/menu.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTCC  scripts/kconfig/util.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
--- ../config   2022-04-22 21:35:16.000000000 +0200
+++ .config     2022-06-05 00:27:22.193972951 +0200
@@ -2,9 +2,9 @@
 # Automatically generated file; DO NOT EDIT.
 # Linux/x86 5.17.4-arch1 Kernel Configuration
 #
-CONFIG_CC_VERSION_TEXT="gcc (GCC) 11.2.0"
+CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.1.0"
 CONFIG_CC_IS_GCC=y
-CONFIG_GCC_VERSION=110200
+CONFIG_GCC_VERSION=120100
 CONFIG_CLANG_VERSION=0
 CONFIG_AS_IS_GNU=y
 CONFIG_AS_VERSION=23800
@@ -351,6 +351,8 @@
 CONFIG_X86_MPPARSE=y
 # CONFIG_GOLDFISH is not set
 CONFIG_RETPOLINE=y
+CONFIG_CC_HAS_SLS=y
+# CONFIG_SLS is not set
 CONFIG_X86_CPU_RESCTRL=y
 # CONFIG_X86_EXTENDED_PLATFORM is not set
 CONFIG_X86_INTEL_LPSS=y
@@ -10043,16 +10045,15 @@
 #
 # Kernel hardening options
 #
-CONFIG_GCC_PLUGIN_STRUCTLEAK=y
 
 #
 # Memory initialization
 #
+CONFIG_CC_HAS_AUTO_VAR_INIT_PATTERN=y
+CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO=y
 # CONFIG_INIT_STACK_NONE is not set
-# CONFIG_GCC_PLUGIN_STRUCTLEAK_USER is not set
-# CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF is not set
-CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL=y
-# CONFIG_GCC_PLUGIN_STRUCTLEAK_VERBOSE is not set
+# CONFIG_INIT_STACK_ALL_PATTERN is not set
+CONFIG_INIT_STACK_ALL_ZERO=y
 # CONFIG_GCC_PLUGIN_STACKLEAK is not set
 CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y
 # CONFIG_INIT_ON_FREE_DEFAULT_ON is not set
Prepared linux-vfio version 5.17.4-arch1-1-vfio
==> Sources are ready.

Last edited by giostark (2022-06-04 22:38:30)

Offline

#10 2022-06-04 22:42:11

loqs
Member
Registered: 2014-03-06
Posts: 17,327

Re: [SOLVED] gcc version 12.1 compiling linux-vfio

The output from makepkg looks promising.  You can continue that build with:

makepkg -ers

Offline

#11 2022-06-05 00:46:48

giostark
Member
Registered: 2016-12-03
Posts: 39

Re: [SOLVED] gcc version 12.1 compiling linux-vfio

Invaluable help , TNX. (alone I would take age for found this solution also reading the makepkg page)
It worked !!!
I mark as solved and update this tip on the linux-vfio page.
Proud to use Arch.

Offline

Board footer

Powered by FluxBB