Frogging-Family / nvidia-all

Nvidia driver latest to 396 series AIO installer
811 stars 73 forks source link

Open-Source Kernel Modules Doesn't Link Against LLVM Thin-LTO TKG Kernel(s) #109

Open ThisNekoGuy opened 2 years ago

ThisNekoGuy commented 2 years ago

Below I've attached a full log of the issue. nvidia-build.log

Both the kernel and the nvidia-all PKGBUILD are inheriting clang variables from makepkg.conf, for reference these are the set variables:

#-- Compiler and Linker Flags
export CC=clang
export CXX=clang++
export LD="/usr/bin/ld.lld"
export AR="/usr/bin/llvm-ar"
export NM="/usr/bin/llvm-nm"
export AS="/usr/bin/llvm-as"
export RANLIB="/usr/bin/llvm-ranlib"
export STRIP="/usr/bin/llvm-strip"
export OBJCOPY="/usr/bin/llvm-objcopy"

export OBJC=clang

#CPPFLAGS=""
CFLAGS="-march=znver2 -mtune=znver2 -O3 -pipe -fno-plt -minline-all-stringops -fexceptions -Wall \
        -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \
        -fstack-clash-protection -fcf-protection"
CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
LDFLAGS="-Wl,-O3,--sort-common,--as-needed,-z,relro,-z,now"
LTOFLAGS="-flto=auto"
#-- Debugging flags
## The "-fvar-tracking-assignments" flag is for GCC
DEBUG_CFLAGS="-g"
DEBUG_CXXFLAGS="${DEBUG_CFLAGS}"

Note: Disabling LTO via makepkg makes no difference.

ptr1337 commented 2 years ago

Create a own issue at https://github.com/NVIDIA/open-gpu-kernel-modules and follow their bug report guidelines. Here also a upstream archlinux issue: https://bugs.archlinux.org/task/74714?project=1&string=nvidia-open-dkms

ptr1337 commented 2 years ago

You can try to change the thinlto cachedir with the following patch, does work also for 5.17 the patch: https://github.com/ptr1337/kernel-patches/blob/master/5.18/0001-thinlto-cachdir.patch

This fixes for me the compile of zfs modules with thinlto.

ThisNekoGuy commented 2 years ago

You can try to change the thinlto cachedir with the following patch, does work also for 5.17 the patch: https://github.com/ptr1337/kernel-patches/blob/master/5.18/0001-thinlto-cachdir.patch

This fixes for me the compile of zfs modules with thinlto.

@ptr1337 I tried this and it made little difference; it seems to progress further(?) but it ultimately fails anyway: nvidia-open-dkms.log

ptr1337 commented 2 years ago

One thing you ould try removed !buildflags from the pkgbuild and built the complete nvidia-open-dkms with llvm exported in your makepkg.conf and with this patch.

Actually I only have a 1070ti so I can't test it much.

ThisNekoGuy commented 2 years ago

I've already tried that.