Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*

Building latest linux kernel fails

SInfolke
Beginner
544 Views

I'm trying to build latest linux kernel with this compiler. I followed this instruction and executed with the following command:

 

 

 

CFLAGS="-xHost -fast -mtune=native -O2 -flto -w -s -fvisibility=hidden"

make CC=icx CFLAGS="$CFLAGS" LD=xild AR=xiar NM=llvm-nm STRIP=llvm-strip OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump READELF=llvm-readelf HOSTCC=icx HOSTCXX=icpx HOSTAR=xiar HOSTLD=xild LLVM=/opt/intel/oneapi/compiler/2024.2/bin/compiler
  SYNC    include/config/auto.conf.cmd
  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
icx: unknown assembler invoked
scripts/Kconfig.include:51: Sorry, this assembler is not supported.
make[3]: *** [scripts/kconfig/Makefile:85: syncconfig] Error 1
make[2]: *** [Makefile:681: syncconfig] Error 2
/home/ura/Downloads/linux-6.11.3/Makefile:759: include/config/auto.conf.cmd: No such file or directory
make[1]: *** [/home/ura/Downloads/linux-6.11.3/Makefile:782: include/config/auto.conf.cmd] Error 2
make: *** [Makefile:224: __sub-make] Error 2

 

 

How would i fix that?

 

I just realised it also fails to build if i simply run  "make LLVM=1" which likely suppose i either done some configurations incorrectly or there is a kernel build system bug.
I'm using linux mint version. By the instruction above i copied a configuration that already exists:
in the /boot dir there were some files like config-6.8.0-VER-generic, and were files with VER 38, 45, 47. I copied config-6.8.0-47-generic as ".config" to the root dir of linux kernel and run:

 ./scripts/config --file .config --set-str LOCALVERSION "-pratham"
make olddefconfig

 

llvm compiler i use is one icx come with.

0 Kudos
2 Replies
SInfolke
Beginner
468 Views

I've found that when using clang from llvm and clang packages installed by apt it builds well so it is still Intel C++ issue

0 Kudos
SInfolke
Beginner
285 Views

i have found this restriction can be bypassed. Open scripts/Kconfig.include and replace checks with error to static:

cc-info := "Clang"
cc-name := "Clang"
cc-version := "18"

# Get the assembler name, version, and error out if it is not supported.
as-info := "LLVM Assembler"
as-name := "LLVM Assembler"
as-version := "18"

# Get the linker name, version, and error out if it is not supported.
ld-info := "LLVM ld"
ld-name := "LLVM ld"
ld-version := "18"

 

this emulates as if we now compiling with clang, while actual compiler is Intel C++.

 

In options need to set CC=icx, HOSTCC=icx and advisable HOSTCXX=icpx

 

Then need to add pragmas to disable warning about stack limits that (which grows into error later) by mofidying arch/x86/kvm/hyperv.c. Add:

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wall"
#pragma clang diagnostic ignored "-Wextra"
#pragma clang diagnostic ignored "-Wpedantic"
#pragma clang diagnostic ignored "-Wframe-larger-than"


Now kernel lets to be compiled, but on Modules linking it fails with following:

MODPOST Module.symvers
ERROR: modpost: "_intel_fast_memset" [arch/x86/events/amd/amd-uncore.ko] undefined!
ERROR: modpost: "_intel_fast_memset" [arch/x86/kernel/cpu/mce/mce-inject.ko] undefined!
ERROR: modpost: "_intel_fast_memcpy" [arch/x86/kernel/cpu/mce/mce-inject.ko] undefined!
ERROR: modpost: "_intel_fast_memset" [arch/x86/crypto/twofish-x86_64-3way.ko] undefined!
ERROR: modpost: "_intel_fast_memset" [arch/x86/crypto/twofish-avx-x86_64.ko] undefined!
ERROR: modpost: "_intel_fast_memset" [arch/x86/crypto/serpent-sse2-x86_64.ko] undefined!
ERROR: modpost: "_intel_fast_memcpy" [arch/x86/crypto/serpent-sse2-x86_64.ko] undefined!
ERROR: modpost: "_intel_fast_memset" [arch/x86/crypto/serpent-avx-x86_64.ko] undefined!


I have no ideas what to do with this error

0 Kudos
Reply