在 ubuntu 20.04 上安装 AMDGPU 驱动程序时无法构建 amdgpu-dkms

在 ubuntu 20.04 上安装 AMDGPU 驱动程序时无法构建 amdgpu-dkms

我在 Ubuntu 20.04 上安装显卡 AMD radeon RX560 的驱动程序时遇到了麻烦。有人能帮帮我吗?我在 AMD 官方网站上下载了驱动程序,但安装失败。这是我尝试使用安装脚本时的输出:

./amdgpu-install 
deb [ trusted=yes ] file:/var/opt/amdgpu-pro-local/ ./

... I removed some line because it's too long, no error in the removed part...

Building for 5.4.0-58-generic
Building for architecture x86_64
Building initial module for 5.4.0-58-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/amdgpu-dkms.0.
crash'
Error! Bad return status for module build on kernel: 5.4.0-58-generic (x86_64)
Consult /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/make.log for more informa
tion.
dpkg: erreur de traitement du paquet amdgpu-dkms (--configure) :
 installed amdgpu-dkms package post-installation script subprocess returned err
or exit status 10
dpkg: des problèmes de dépendances empêchent la configuration de amdgpu :
 amdgpu dépend de amdgpu-dkms (= 1:5.6.14.224-1147286) ; cependant :
 Le paquet amdgpu-dkms n'est pas encore configuré.

dpkg: erreur de traitement du paquet amdgpu (--configure) :
 problèmes de dépendances - laissé non configuré
Paramétrage de libatomic1:i386 (10.2.0-5ubuntu1~20.04) ...
Aucun rapport « apport » n'a été créé car le message d'erreur indique une erreu
r consécutive à un échec précédent.
                                   Paramétrage de xserver-xorg-amdgpu-video-amd
gpu (1:19.1.0-1147286) ...
Paramétrage de mesa-amdgpu-omx-drivers:amd64 (1:20.1.5-1147286) ...
Paramétrage de libdrm2:i386 (2.4.101-2) ...
Paramétrage de libegl1-amdgpu-mesa:amd64 (1:20.1.5-1147286) ...
Paramétrage de libx11-6:i386 (2:1.6.9-2ubuntu1.1) ...
Paramétrage de libwayland-egl1:i386 (1.18.0-1) ...
Paramétrage de libgl1-amdgpu-mesa-glx:amd64 (1:20.1.5-1147286) ...
Paramétrage de libgles2-amdgpu-mesa:amd64 (1:20.1.5-1147286) ...
Paramétrage de libgles2-amdgpu-mesa:i386 (1:20.1.5-1147286) ...
Paramétrage de libdrm-amdgpu1:i386 (2.4.101-2) ...
Paramétrage de libwayland-client0:i386 (1.18.0-1) ...
Paramétrage de libwayland-server0:i386 (1.18.0-1) ...
Paramétrage de libgl1-amdgpu-mesa-dri:amd64 (1:20.1.5-1147286) ...
Paramétrage de libgl1-amdgpu-mesa-dri:i386 (1:20.1.5-1147286) ...
Paramétrage de libdrm-nouveau2:i386 (2.4.101-2) ...
Paramétrage de libgbm1-amdgpu:i386 (1:20.1.5-1147286) ...
Paramétrage de libxdamage1:i386 (1:1.1.5-2) ...
Paramétrage de libosmesa6-amdgpu:amd64 (1:20.1.5-1147286) ...
Paramétrage de libosmesa6-amdgpu:i386 (1:20.1.5-1147286) ...
Paramétrage de gst-omx-amdgpu (1.0.0.1-1147286) ...
Paramétrage de libdrm-radeon1:i386 (2.4.101-2) ...
Paramétrage de libxext6:i386 (2:1.3.4-0ubuntu1) ...
Paramétrage de libxxf86vm1:i386 (1:1.1.4-1build1) ...
Paramétrage de libllvm10:i386 (1:10.0.0-4ubuntu1) ...
Paramétrage de libxfixes3:i386 (1:5.0.3-2) ...
Paramétrage de libegl1-amdgpu-mesa-drivers:amd64 (1:20.1.5-1147286) ...
Paramétrage de libvdpau1:i386 (1.3-1ubuntu2) ...
Paramétrage de libegl1-amdgpu-mesa:i386 (1:20.1.5-1147286) ...
Paramétrage de libgl1-amdgpu-mesa-glx:i386 (1:20.1.5-1147286) ...
Paramétrage de mesa-vdpau-drivers:i386 (20.0.8-0ubuntu1~20.04.1) ...
Paramétrage de mesa-amdgpu-vdpau-drivers:i386 (1:20.1.5-1147286) ...
Paramétrage de amdgpu-lib (20.40-1147286) ...
Paramétrage de libegl1-amdgpu-mesa-drivers:i386 (1:20.1.5-1147286) ...
Paramétrage de vdpau-driver-all:i386 (1.3-1ubuntu2) ...
Paramétrage de amdgpu-lib32 (20.40-1147286) ...
Traitement des actions différées (« triggers ») pour man-db (2.9.1-1) ...
Traitement des actions différées (« triggers ») pour libc-bin (2.31-0ubuntu9.1)
 ...
Des erreurs ont été rencontrées pendant l'exécution :
 amdgpu-dkms
 amdgpu

抱歉,由于消息太长,我不得不删除一些行。

这是 make.log 文件:

DKMS make.log for amdgpu-5.6.14.224-1147286 for kernel 5.4.0-58-generic (x86_64)
sam. 26 déc. 2020 13:17:30 CET
make : on entre dans le répertoire « /usr/src/linux-headers-5.4.0-58-generic »
/var/lib/dkms/amdgpu/5.6.14.224-1147286/build/Makefile:20: "Local GCC version 90303 does not match kernel compiler GCC version 90300"
/var/lib/dkms/amdgpu/5.6.14.224-1147286/build/Makefile:21: "This may cause unexpected and hard-to-isolate compiler-related issues"
  AR      /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/built-in.a
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/main.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/symbols.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_mn.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/scheduler/sched_main.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/scheduler/sched_fence.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_memory.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/scheduler/sched_entity.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_ioctl.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/ttm/ttm_memory.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_device_cgroup.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/ttm/ttm_tt.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/ttm/ttm_bo.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_drm_cache.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/ttm/ttm_bo_util.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_drm.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_drv.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_device.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_fence_array.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_fence.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_io.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_kms.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_kthread.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_mm.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_pci.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_perf_event.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_reservation.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_suspend.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_workqueue.o
/var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_fence.c:30:1: warning: ‘dma_fence_test_signaled_any’ defined but not used [-Wunused-function]
   30 | dma_fence_test_signaled_any(struct dma_fence **fences, uint32_t count,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/ttm/ttm_bo_vm.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/ttm/ttm_module.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/ttm/ttm_execbuf_util.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_seq_file.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_connector.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_backlight.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_atombios.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/ttm/ttm_page_alloc.o
/var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_pci.c: In function ‘amdkcl_pci_init’:
/var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_pci.c:103:84: warning: passing argument 2 of ‘amdkcl_fp_setup’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  103 |  _kcl_pcie_link_speed = (const unsigned char *) amdkcl_fp_setup("pcie_link_speed", _kcl_pcie_link_speed_stub);
      |                                                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_pci.c:4:
/var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_common.h:12:63: note: expected ‘void *’ but argument is of type ‘const unsigned char *’
   12 | static inline void *amdkcl_fp_setup(const char *symbol, void *fp_stup)
      |                                                         ~~~~~~^~~~~~~
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/kcl_drm_atomic_helper.o
  LD [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/scheduler/amd-sched.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/dma-buf/dma-resv.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/ttm/ttm_bo_manager.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/ttm/ttm_agp_backend.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/ttm/ttm_page_alloc_dma.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/atombios_crtc.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_connectors.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/atom.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_fence.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_ttm.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_object.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_gart.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_encoders.o
  LD [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdkcl/amdkcl.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_display.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_i2c.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_fb.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_gem.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_ring.o
  LD [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/ttm/amdttm.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_cs.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_bios.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_benchmark.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_test.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_pm.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/atombios_dp.o
/var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_fb.c: In function ‘amdgpufb_create’:
/var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_fb.c:252:14: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  252 |  info->fbops = &amdgpufb_ops;
      |              ^
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_afmt.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_trace_points.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/atombios_encoders.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_sa.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/atombios_i2c.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_dma_buf.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_vm.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_ib.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_pll.o
/var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_bios.c: In function ‘amdgpu_read_platform_bios’:
/var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_bios.c:200:9: error: implicit declaration of function ‘pci_platform_rom’ [-Werror=implicit-function-declaration]
  200 |  bios = pci_platform_rom(adev->pdev, &size);
      |         ^~~~~~~~~~~~~~~~
/var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_bios.c:200:7: warning: assignment to ‘uint8_t *’ {aka ‘unsigned char *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  200 |  bios = pci_platform_rom(adev->pdev, &size);
      |       ^
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_ucode.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_bo_list.o
  CC [M]  /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_ctx.o
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:275 : /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu/amdgpu_bios.o] Erreur 1
make[2]: *** Attente des tâches non terminées....
make[1]: *** [scripts/Makefile.build:522 : /var/lib/dkms/amdgpu/5.6.14.224-1147286/build/amd/amdgpu] Erreur 2
make: *** [Makefile:1757 : /var/lib/dkms/amdgpu/5.6.14.224-1147286/build] Erreur 2
make : on quitte le répertoire « /usr/src/linux-headers-5.4.0-58-generic »

它说一些警告被视为错误,并且本地 GCC 版本与用于构建内核的版本不匹配。我应该怎么做才能安装驱动程序?

答案1

AMD 发布的 20.45 也像其前一个版本一样存在错误。(抱歉我的德语版本。)

Vormals nicht ausgewähltes Paket amdgpu-dkms wird gewählt.
(Lese Datenbank ... 231500 Dateien und Verzeichnisse sind derzeit installiert.)
Vorbereitung zum Entpacken von .../amdgpu-dkms_5.6.20.906316-1188099_all.deb ...
Entpacken von amdgpu-dkms (1:5.6.20.906316-1188099) ...
amdgpu-dkms (1:5.6.20.906316-1188099) wird eingerichtet ...
Loading new amdgpu-5.6.20.906316-1188099 DKMS files...
Building for 5.8.0-36-generic 5.8.0-38-generic
Building for architecture x86_64
Building initial module for 5.8.0-36-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/amdgpu-dkms.0.crash'
Error! Bad return status for module build on kernel: 5.8.0-36-generic (x86_64)
Consult /var/lib/dkms/amdgpu/5.6.20.906316-1188099/build/make.log for more information.
dpkg: Fehler beim Bearbeiten des Paketes amdgpu-dkms (--configure):
 »installiertes amdgpu-dkms-Skript des Paketes post-installation«-Unterprozess gab den Fehlerwert 10 zurück
Fehler traten auf beim Bearbeiten von:
 amdgpu-dkms
E: Sub-process /usr/bin/dpkg returned an error code (1)
Ein Paket konnte nicht installiert werden. Wiederherstellung wird versucht:
amdgpu-dkms (1:5.6.20.906316-1188099) wird eingerichtet ...
Removing old amdgpu-5.6.20.906316-1188099 DKMS files...

------------------------------
Deleting module version: 5.6.20.906316-1188099
completely from the DKMS tree.
------------------------------
Done.
Loading new amdgpu-5.6.20.906316-1188099 DKMS files...
Building for 5.8.0-36-generic 5.8.0-38-generic
Building for architecture x86_64
Building initial module for 5.8.0-36-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/amdgpu-dkms.0.crash'
Error! Bad return status for module build on kernel: 5.8.0-36-generic (x86_64)
Consult /var/lib/dkms/amdgpu/5.6.20.906316-1188099/build/make.log for more information.
dpkg: Fehler beim Bearbeiten des Paketes amdgpu-dkms (--configure):
 »installiertes amdgpu-dkms-Skript des Paketes post-installation«-Unterprozess gab den Fehlerwert 10 zurück
Fehler traten auf beim Bearbeiten von:
 amdgpu-dkms

这也发生在 amdgpu 或 amdgpu-pro-dkms 的版本中。似乎

/usr/src/linux-hwe-5.8-headers-5.8.0-36/include/linux/hmm.h

存在错误,并且一些变量(-> make.log 和 crash-report)未定义。

我相当失望。

答案2

AMD 已发布更新来解决此问题: https://www.amd.com/en/support/kb/release-notes/rn-amdgpu-unified-linux-20-45

我安装了它,但是出现了一些错误,并且在拔下电池充电器的情况下启动时会出现问题(我在配备 AMD Ryzen 5 3500u 的 HP 笔记本电脑上使用内核为 5.4 的 Ubuntu 20.04)。我不知道这是内核问题还是驱动程序问题。

相关内容