I am currently trying to update my AMD drivers on Ubuntu/also downloading the HIP drivers for blender cycles rendering. Problem is that when I install it using the latest amdgpu-install script (with the config: sudo amdgpu-install --usecase=graphics,hip
) I get the following error:
cpp: fatal error: cannot execute 'cc1': execvp: No such file or directory
compilation terminated.
configure: error: *** Cannot determine kernel version.
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/amdgpu-dkms.0.crash'
Error! Bad return status for module build on kernel: 5.15.0-76-generic (x86_64)
Consult /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/make.log for more information.
dpkg: error processing package amdgpu-dkms (--configure):
installed amdgpu-dkms package post-installation script subprocess returned error exit status 10
Errors were encountered while processing:
amdgpu-dkms
E: Sub-process /usr/bin/dpkg returned an error code (1)
Searching online, this cc1 error seems to be fairly common and is either fixed by finding cc1 if it exists within your install and creating a symlink to it in your gcc folder, which I cannot do because cc1 just cannot be found on my system.
Or to reinstall build-essential (a pack on apt that installs gcc, g++, cmake etc). However I'm unable to do this either because whenever I use any apt related command, it tried to build the amdgpu-dkms which obviously doesn't build, which in turn fails the whole apt command as seen here.
Also if it helps here is /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/make.log
:
DKMS make.log for amdgpu-6.1.5-1609671.22.04 for kernel 5.15.0-76-generic (x86_64)
Mon 10 Jul 2023 00:26:58 AEST
make: Entering directory '/usr/src/linux-headers-5.15.0-76-generic'
warning: the compiler differs from the one used to build the kernel
The kernel was built by: gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0
You are using: gcc (Ubuntu 12.1.0-2ubuntu1~22.04) 12.1.0
/var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/Makefile:17: "Local GCC version 120100 does not match kernel compiler GCC version 110300"
/var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/Makefile:18: "This may cause unexpected and hard-to-isolate compiler-related issues"
/var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/Makefile:219: "The local C standard(gnu89) doesn't match kernel default C standard(gnu11/gnu99)"
CC [M] /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/drm_gem_ttm_helper.o
CC [M] /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/drm_buddy.o
CC [M] /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/scheduler/sched_main.o
CC [M] /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/scheduler/sched_fence.o
CC [M] /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/scheduler/sched_entity.o
CC [M] /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/ttm/ttm_tt.o
CC [M] /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/amdkcl/main.o
CC [M] /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/amdgpu/amdgpu_drv.o
CC [M] /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/amdkcl/symbols.o
CC [M] /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/amdkcl/kcl_common.o
In file included from /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/include/kcl/kcl_iosys-map.h:10,
from /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/ttm/backport/backport.h:10,
from <command-line>:
/var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/include/kcl/header/linux/iosys-map.h:5:15: fatal error: linux/iosys-map.h: No such file or directory
5 | #include_next <linux/iosys-map.h>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [scripts/Makefile.build:297: /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/drm_gem_ttm_helper.o] Error 1
make[1]: *** Waiting for unfinished jobs....
CC [M] /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/amdgpu/amdgpu_device.o
In file included from /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/include/kcl/kcl_iosys-map.h:10,
from /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/backport/backport.h:14,
from <command-line>:
/var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/include/kcl/header/linux/iosys-map.h:5:15: fatal error: linux/iosys-map.h: No such file or directory
5 | #include_next <linux/iosys-map.h>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/include/kcl/kcl_iosys-map.h:10,
from /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/ttm/backport/backport.h:10,
from <command-line>:
/var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/include/kcl/header/linux/iosys-map.h:5:15: fatal error: linux/iosys-map.h: No such file or directory
5 | #include_next <linux/iosys-map.h>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/scheduler/sched_main.c:51:
/var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/include/linux/dma-resv.h: In function ‘dma_resv_trylock’:
/var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/include/linux/dma-resv.h:330:16: error: too many arguments to function ‘ww_mutex_trylock’
330 | return ww_mutex_trylock(&obj->lock, NULL);
| ^~~~~~~~~~~~~~~~
In file included from ./include/linux/seqlock.h:20,
from ./include/linux/hrtimer.h:20,
from ./include/linux/sched.h:19,
from /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/include/kcl/backport/kcl_kthread_backport.h:4,
from /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/scheduler/backport/backport.h:7,
from <command-line>:
./include/linux/ww_mutex.h:349:32: note: declared here
349 | static inline int __must_check ww_mutex_trylock(struct ww_mutex *lock)
| ^~~~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:297: /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/amdgpu/amdgpu_drv.o] Error 1
make[2]: *** [scripts/Makefile.build:297: /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/ttm/ttm_tt.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [scripts/Makefile.build:560: /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/ttm] Error 2
CC [M] /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/amdkcl/kcl_kernel_params.o
CC [M] /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/amdkcl/dma-buf/dma-resv.o
make[2]: *** [scripts/Makefile.build:297: /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/scheduler/sched_main.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CC [M] /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/amdkcl/kcl_backlight.o
CC [M] /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/amdkcl/kcl_ioctl.o
In file included from /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/amdkcl/dma-buf/dma-resv.c:36:
/var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/include/linux/dma-resv.h: In function ‘dma_resv_trylock’:
/var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/include/linux/dma-resv.h:330:16: error: too many arguments to function ‘ww_mutex_trylock’
330 | return ww_mutex_trylock(&obj->lock, NULL);
| ^~~~~~~~~~~~~~~~
In file included from /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/include/linux/dma-resv.h:42:
./include/linux/ww_mutex.h:349:32: note: declared here
349 | static inline int __must_check ww_mutex_trylock(struct ww_mutex *lock)
| ^~~~~~~~~~~~~~~~
In file included from /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/include/kcl/kcl_iosys-map.h:10,
from /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/backport/backport.h:14,
from <command-line>:
/var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/include/kcl/header/linux/iosys-map.h:5:15: fatal error: linux/iosys-map.h: No such file or directory
5 | #include_next <linux/iosys-map.h>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [scripts/Makefile.build:297: /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/amdgpu/amdgpu_device.o] Error 1
make[1]: *** [scripts/Makefile.build:560: /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/amdgpu] Error 2
CC [M] /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/amdkcl/kcl_kthread.o
CC [M] /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/amdkcl/kcl_io.o
In file included from ./arch/x86/include/asm/bug.h:86,
from ./include/linux/bug.h:5,
from ./include/linux/cpumask.h:14,
from ./include/linux/smp.h:13,
from ./include/linux/lockdep.h:14,
from ./include/linux/mutex.h:17,
from ./include/linux/ww_mutex.h:20:
/var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/amdkcl/dma-buf/dma-resv.c: In function ‘amddma_resv_add_fence’:
/var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/amdkcl/dma-buf/dma-resv.c:287:17: error: implicit declaration of function ‘dma_fence_is_container’; did you mean ‘dma_fence_is_later’? [-Werror=implicit-function-declaration]
287 | WARN_ON(dma_fence_is_container(fence));
| ^~~~~~~~~~~~~~~~~~~~~~
./include/asm-generic/bug.h:121:32: note: in definition of macro ‘WARN_ON’
121 | int __ret_warn_on = !!(condition); \
| ^~~~~~~~~
CC [M] /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/amdkcl/kcl_seq_file.o
/var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/amdkcl/dma-buf/dma-resv.c: In function ‘amddma_resv_describe’:
/var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/amdkcl/dma-buf/dma-resv.c:726:17: error: implicit declaration of function ‘dma_fence_describe’; did you mean ‘dma_resv_describe’? [-Werror=implicit-function-declaration]
726 | dma_fence_describe(fence, seq);
| ^~~~~~~~~~~~~~~~~~
| dma_resv_describe
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:297: /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/amdkcl/dma-buf/dma-resv.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [scripts/Makefile.build:560: /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/scheduler] Error 2
make[1]: *** [scripts/Makefile.build:560: /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/amdkcl] Error 2
make: *** [Makefile:1914: /var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build] Error 2
make: Leaving directory '/usr/src/linux-headers-5.15.0-76-generic'
All I can glean from that is that my gcc/g++ version is different to that of my kernel, so I tried changing the default gcc/g++ versions back to gcc-11/g++-12 through update-alternatives (I previously updated them to version 12 manually) but that didn't help.
Also I found another log it mentions, config.log:
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by amdgpu-dkms configure 6.1.5, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ ./configure
## --------- ##
## Platform. ##
## --------- ##
hostname = rahul-B550M-H
uname -m = x86_64
uname -r = 5.15.0-76-generic
uname -s = Linux
uname -v = #83-Ubuntu SMP Thu Jun 15 19:16:32 UTC 2023
/usr/bin/uname -p = x86_64
/bin/uname -X = unknown
/bin/arch = x86_64
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /bin/
PATH: /sbin/
PATH: /usr/bin/
PATH: /usr/sbin/
PATH: /usr/lib/dkms/
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2131: looking for aux files: install-sh
configure:2144: trying ./config/
configure:2155: ./config/install-sh found
configure:2310: checking for a BSD-compatible install
configure:2383: result: /bin/install -c
configure:2456: checking for gcc
configure:2488: result: gcc
configure:2841: checking for C compiler version
configure:2850: gcc --version >&5
gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0
Copyright (C) 2021 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.
configure:2861: $? = 0
configure:2850: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04.1' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-aYxV0E/gcc-11-11.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-aYxV0E/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04.1)
... rest of stderr output deleted ...
configure:2861: $? = 0
configure:2850: gcc -V >&5
gcc: error: unrecognized command-line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:2861: $? = 1
configure:2850: gcc -qversion >&5
gcc: error: unrecognized command-line option '-qversion'; did you mean '--version'?
gcc: fatal error: no input files
compilation terminated.
configure:2861: $? = 1
configure:2850: gcc -version >&5
gcc: error: unrecognized command-line option '-version'
gcc: fatal error: no input files
compilation terminated.
configure:2861: $? = 1
configure:2881: checking whether the C compiler works
configure:2903: gcc conftest.c >&5
gcc: fatal error: cannot execute 'cc1': execvp: No such file or directory
compilation terminated.
configure:2907: $? = 1
configure:2947: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "amdgpu-dkms"
| #define PACKAGE_TARNAME "amdgpu-dkms"
| #define PACKAGE_VERSION "6.1.5"
| #define PACKAGE_STRING "amdgpu-dkms 6.1.5"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h. */
|
| int
| main (void)
| {
|
| ;
| return 0;
| }
configure:2952: error: in `/var/lib/dkms/amdgpu/6.1.5-1609671.22.04/build/amd/dkms':
configure:2954: error: C compiler cannot create executables
See `config.log' for more details
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_env_CC_set=set
ac_cv_env_CC_value=gcc
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_path_install='/bin/install -c'
ac_cv_prog_ac_ct_CC=gcc
## ----------------- ##
## Output variables. ##
## ----------------- ##
CC='gcc'
CFLAGS=''
CPP=''
CPPFLAGS=''
DEFS=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EXEEXT=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
KERNEL_MAKE=''
LDFLAGS=''
LIBOBJS=''
LIBS=''
LINUX=''
LINUX_OBJ=''
LINUX_SYMBOLS=''
LINUX_VERSION=''
LTLIBOBJS=''
NPROC=''
OBJEXT=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME='amdgpu-dkms'
PACKAGE_STRING='amdgpu-dkms 6.1.5'
PACKAGE_TARNAME='amdgpu-dkms'
PACKAGE_URL=''
PACKAGE_VERSION='6.1.5'
PATH_SEPARATOR=':'
SHELL='/bin/bash'
ac_ct_CC='gcc'
bindir='${exec_prefix}/bin'
build_alias=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host_alias=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
runstatedir='${localstatedir}/run'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''
## ----------- ##
## confdefs.h. ##
## ----------- ##
/* confdefs.h */
#define PACKAGE_NAME "amdgpu-dkms"
#define PACKAGE_TARNAME "amdgpu-dkms"
#define PACKAGE_VERSION "6.1.5"
#define PACKAGE_STRING "amdgpu-dkms 6.1.5"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
configure: exit 77
From that it looks to me like when it tests to see if gcc works, it tries to compile some file called conftest.c, which fails due to a lack of cc1. Still unable to use this to solve the issue myself though.
I'm fairly new to linux so any help would be appreciated, whether to fix the issue or even just to be able to reinstall build-essential without triggering amdgpu-dkms to build. Thanks in advance!
Btw my system info is:
OS: Kubuntu 22.04.2 LTS x86_64
Host: B550M H
Kernel: 5.15.0-76-generic
CPU: AMD Ryzen 3 3300X (8) @ 3.792GHz
GPU: AMD ATI Radeon RX 6600