Ubuntu22.04平台安装mesa

1,环境准备

1,在Ubuntu22.04的环境下编译安装Mesa22版本的全过程。


2,以下面编译选项为依据:
meson build -Degl=true --buildtype debug -Dplatforms=x11 -Dgallium-drivers=swrast


3,编译mesa22版本时依赖的所有依赖库的顺序:

sudo apt install meson

sudo apt-get install pkg-config

sudo apt-get install cmake

sudo apt-get install zlib1g-dev

sudo apt-get install libzstd-dev

sudo apt-get install libexpat1-dev

sudo apt install libdrm-dev

sudo apt install llvm

sudo apt install libelf-dev

sudo apt install valgrind

sudo apt install bison

sudo apt install flex


如果上面的编译选项需要支持wayland平台,比如 meson build -Degl=true --buildtype debug -Dplatforms=x11,wayland -Dgallium-drivers=swrast
编译到此处时还需要安装wayland协议相关的依赖库。包括以下3个:wayland-scanner,wayland-protocol,wayland-egl-backend
(1)sudo apt install libwayland-dev
(2)wayland-protocol 没有找到直接解决的命令,采样的是源码编译的方式。github上下载 wayland-protocols库的源码, meson build 和 ninja -C build install 可解决该依赖项。
(3)sudo apt install libwayland-egl-backend-dev 


sudo apt install libx11-dev

sudo apt install libxext-dev

sudo apt install libxfixes-dev

sudo apt install libxcb-glx0-dev
sudo apt install libxcb-shm0-dev
sudo apt install libx11-xcb-dev
sudo apt install libxcb-dri2-0-dev
sudo apt install libxcb-dri3-dev
sudo apt install libxcb-present-dev
sudo apt install libxshmfence-dev

sudo apt install libxxf86vm-dev

sudo apt install libxrandr-dev

至此,可以解决上面的所有依赖项,完成mesa源码的编译。
 

2, mesa编译过程

(1) 下载源码

sudo apt install meson

meson build -Degl=true --buildtype debug -Dplatforms=x11 -Dgallium-drivers=swrast

meson build -Degl=true --buildtype debug -Dplatforms=x11,wayland -Dgallium-drivers=swrast

meson build --reconfigure -Degl=true --buildtype debug -Dplatforms=x11,wayland -Dgallium-drivers=swrast

(2)编译成功

meson build 成功时的打印:

WARNING: Library target 'EGL' has 'name_prefix' set. Compilers may not find it from its '-lEGL' linker flag in the 'egl.pc' pkg-config file.
WARNING: Library target 'EGL' has 'name_prefix' set. Compilers may not find it from its '-lEGL' linker flag in the 'egl-uninstalled.pc' pkg-config file.
Message: Configuration summary:
        
        prefix:          /usr/local
        libdir:          lib/x86_64-linux-gnu
        includedir:      include
        
        OpenGL:          yes (ES1: yes ES2: yes)
        OSMesa:          no
        
        DRI platform:    drm
        DRI drivers:     no
        DRI driver dir:  /usr/local/lib/x86_64-linux-gnu/dri
        
        GLX:             DRI-based
        
        EGL:             yes
        EGL drivers:     builtin:egl_dri2 builtin:egl_dri3
        EGL/Vulkan/VL platforms:   x11 surfaceless drm xcb
        GBM:             yes
        GBM backends path: /usr/local/lib/x86_64-linux-gnu/gbm
        
        Vulkan drivers:  amd intel swrast
        Vulkan ICD dir:  share/vulkan/icd.d
        
        llvm:            yes
        llvm-version:    13.0.1
        
        Gallium drivers: swrast
        Gallium st:      mesa
        HUD lmsensors:   no
        
        Shared-glapi:    yes
        
        Perfetto:        no
        Perfetto ds:     auto

Build targets in project: 193
NOTICE: Future-deprecated features used:
 * 0.55.0: {'ExternalProgram.path'}
 * 0.56.0: {'meson.source_root'}

mesa 22.1.2

  User defined options
    buildtype      : debug
    egl            : true
    gallium-drivers: swrast
    platforms      : x11

Found ninja-1.10.1 at /usr/bin/ninja

(3)安装成功

ninja -C build install
ninja: Entering directory `build'
[1/2] Installing files.
Installation failed due to insufficient permissions.
Attempting to use polkit to gain elevated privileges...
Installing src/mapi/shared-glapi/libglapi.so.0.0.0 to /usr/local/lib/x86_64-linux-gnu
Installing symlink pointing to libglapi.so.0.0.0 to /usr/local/lib/x86_64-linux-gnu/libglapi.so.0
Installing symlink pointing to libglapi.so.0 to /usr/local/lib/x86_64-linux-gnu/libglapi.so
Installing src/mapi/es1api/libGLESv1_CM.so.1.1.0 to /usr/local/lib/x86_64-linux-gnu
Installing symlink pointing to libGLESv1_CM.so.1.1.0 to /usr/local/lib/x86_64-linux-gnu/libGLESv1_CM.so.1
Installing symlink pointing to libGLESv1_CM.so.1 to /usr/local/lib/x86_64-linux-gnu/libGLESv1_CM.so
Installing src/mapi/es2api/libGLESv2.so.2.0.0 to /usr/local/lib/x86_64-linux-gnu
Installing symlink pointing to libGLESv2.so.2.0.0 to /usr/local/lib/x86_64-linux-gnu/libGLESv2.so.2
Installing symlink pointing to libGLESv2.so.2 to /usr/local/lib/x86_64-linux-gnu/libGLESv2.so
Installing src/intel/vulkan/intel_icd.x86_64.json to /usr/local/share/vulkan/icd.d
Installing src/intel/vulkan/libvulkan_intel.so to /usr/local/lib/x86_64-linux-gnu
Installing src/amd/vulkan/libvulkan_radeon.so to /usr/local/lib/x86_64-linux-gnu
Installing src/amd/vulkan/radeon_icd.x86_64.json to /usr/local/share/vulkan/icd.d
Installing src/gbm/libgbm.so.1.0.0 to /usr/local/lib/x86_64-linux-gnu
Installing symlink pointing to libgbm.so.1.0.0 to /usr/local/lib/x86_64-linux-gnu/libgbm.so.1
Installing symlink pointing to libgbm.so.1 to /usr/local/lib/x86_64-linux-gnu/libgbm.so
Installing src/gallium/targets/dri/libgallium_dri.so to /usr/local/lib/x86_64-linux-gnu/dri
Installing src/gallium/targets/lavapipe/libvulkan_lvp.so to /usr/local/lib/x86_64-linux-gnu
Installing src/gallium/targets/lavapipe/lvp_icd.x86_64.json to /usr/local/share/vulkan/icd.d
Installing src/glx/libGL.so.1.2.0 to /usr/local/lib/x86_64-linux-gnu
Installing symlink pointing to libGL.so.1.2.0 to /usr/local/lib/x86_64-linux-gnu/libGL.so.1
Installing symlink pointing to libGL.so.1 to /usr/local/lib/x86_64-linux-gnu/libGL.so
Installing src/egl/libEGL.so.1.0.0 to /usr/local/lib/x86_64-linux-gnu
Installing symlink pointing to libEGL.so.1.0.0 to /usr/local/lib/x86_64-linux-gnu/libEGL.so.1
Installing symlink pointing to libEGL.so.1 to /usr/local/lib/x86_64-linux-gnu/libEGL.so
Installing /home/jyc/01_code/mesa-mesa-22.1.2/include/KHR/khrplatform.h to /usr/local/include/KHR
Installing /home/jyc/01_code/mesa-mesa-22.1.2/include/GLES/egl.h to /usr/local/include/GLES
Installing /home/jyc/01_code/mesa-mesa-22.1.2/include/GLES/gl.h to /usr/local/include/GLES
Installing /home/jyc/01_code/mesa-mesa-22.1.2/include/GLES/glext.h to /usr/local/include/GLES
Installing /home/jyc/01_code/mesa-mesa-22.1.2/include/GLES/glplatform.h to /usr/local/include/GLES
Installing /home/jyc/01_code/mesa-mesa-22.1.2/include/GLES2/gl2.h to /usr/local/include/GLES2
Installing /home/jyc/01_code/mesa-mesa-22.1.2/include/GLES2/gl2ext.h to /usr/local/include/GLES2
Installing /home/jyc/01_code/mesa-mesa-22.1.2/include/GLES2/gl2platform.h to /usr/local/include/GLES2
Installing /home/jyc/01_code/mesa-mesa-22.1.2/include/GLES3/gl3.h to /usr/local/include/GLES3
Installing /home/jyc/01_code/mesa-mesa-22.1.2/include/GLES3/gl31.h to /usr/local/include/GLES3
Installing /home/jyc/01_code/mesa-mesa-22.1.2/include/GLES3/gl32.h to /usr/local/include/GLES3
Installing /home/jyc/01_code/mesa-mesa-22.1.2/include/GLES3/gl3ext.h to /usr/local/include/GLES3
Installing /home/jyc/01_code/mesa-mesa-22.1.2/include/GLES3/gl3platform.h to /usr/local/include/GLES3
Installing /home/jyc/01_code/mesa-mesa-22.1.2/include/GL/gl.h to /usr/local/include/GL
Installing /home/jyc/01_code/mesa-mesa-22.1.2/include/GL/glcorearb.h to /usr/local/include/GL
Installing /home/jyc/01_code/mesa-mesa-22.1.2/include/GL/glext.h to /usr/local/include/GL
Installing /home/jyc/01_code/mesa-mesa-22.1.2/include/GL/glx.h to /usr/local/include/GL
Installing /home/jyc/01_code/mesa-mesa-22.1.2/include/GL/glxext.h to /usr/local/include/GL
Installing /home/jyc/01_code/mesa-mesa-22.1.2/include/EGL/egl.h to /usr/local/include/EGL
Installing /home/jyc/01_code/mesa-mesa-22.1.2/include/EGL/eglext.h to /usr/local/include/EGL
Installing /home/jyc/01_code/mesa-mesa-22.1.2/include/EGL/eglplatform.h to /usr/local/include/EGL
Installing /home/jyc/01_code/mesa-mesa-22.1.2/include/EGL/eglmesaext.h to /usr/local/include/EGL
Installing /home/jyc/01_code/mesa-mesa-22.1.2/include/EGL/eglextchromium.h to /usr/local/include/EGL
Installing /home/jyc/01_code/mesa-mesa-22.1.2/include/GL/internal/dri_interface.h to /usr/local/include/GL/internal
Installing /home/jyc/01_code/mesa-mesa-22.1.2/src/gbm/main/gbm.h to /usr/local/include
Installing /home/jyc/01_code/mesa-mesa-22.1.2/src/util/00-mesa-defaults.conf to /usr/local/share/drirc.d
Installing /home/jyc/01_code/mesa-mesa-22.1.2/build/meson-private/glesv1_cm.pc to /usr/local/lib/x86_64-linux-gnu/pkgconfig
Installing /home/jyc/01_code/mesa-mesa-22.1.2/build/meson-private/glesv2.pc to /usr/local/lib/x86_64-linux-gnu/pkgconfig
Installing /home/jyc/01_code/mesa-mesa-22.1.2/src/amd/vulkan/00-radv-defaults.conf to /usr/local/share/drirc.d
Installing /home/jyc/01_code/mesa-mesa-22.1.2/build/meson-private/gbm.pc to /usr/local/lib/x86_64-linux-gnu/pkgconfig
Installing /home/jyc/01_code/mesa-mesa-22.1.2/build/meson-private/dri.pc to /usr/local/lib/x86_64-linux-gnu/pkgconfig
Installing /home/jyc/01_code/mesa-mesa-22.1.2/build/meson-private/egl.pc to /usr/local/lib/x86_64-linux-gnu/pkgconfig
Installing /home/jyc/01_code/mesa-mesa-22.1.2/build/meson-private/gl.pc to /usr/local/lib/x86_64-linux-gnu/pkgconfig
Running custom install script '/usr/bin/python3 /home/jyc/01_code/mesa-mesa-22.1.2/bin/install_megadrivers.py /home/jyc/01_code/mesa-mesa-22.1.2/build/src/gallium/targets/dri/libgallium_dri.so /usr/local/lib/x86_64-linux-gnu/dri swrast_dri.so kms_swrast_dri.so'

你可能感兴趣的:(Linux图形栈,linux,ubuntu,运维)