下载Mesa源代码:
git clone https://gitlab.freedesktop.org/mesa/mesa.git
如果下载太慢,请参看 下载国外资源。
我下载后看到的Mesa版本信息为:20.2.0-devel
接下来,开始构建。
拿到一个新的开源工程,先查看其工程目录下的README,这里面通常包含怎样构建该工程的信息。所以,
cd mesa vim README.rst
可以看到构建命令为:
mkdir build cd build meson .. sudo ninja install
尝试运行meson命令时,发现没有该命令,因为按TAB键时没有自动补全,所以安装meson:
brew install meson
开始构建,
meson ..
但是报错:
➜ build git:(master) meson .. The Meson build system Version: 0.53.0 Source dir: /Users/chencheng/gitlab/mesa Build dir: /Users/chencheng/gitlab/mesa/build Build type: native build Program python found: YES (/usr/bin/python) Project name: mesa Project version: 20.2.0-devel meson.build:21:0: ERROR: Unknown compiler(s): ['cc', 'gcc', 'clang', 'pgcc', 'icc'] The follow exceptions were encountered: Running "pgcc --version" gave "[Errno 2] No such file or directory: 'pgcc': 'pgcc'" Running "icc --version" gave "[Errno 2] No such file or directory: 'icc': 'icc'" A full log can be found at /Users/chencheng/gitlab/mesa/build/meson-logs/meson-log.txt
可以看到没有找到pgcc和icc命令。需要下载安装PGI。
再次构建,报错如下:
meson.build:876:2: ERROR: Problem encountered: Python (3.x) mako module >= 0.8.0 required to build mesa.
没有找到mako模块。解决办法如下:
pip3 install mako
再次构建,报错如下:
meson.build:1702:4: ERROR: Dependency "xext" not found, tried pkgconfig, framework and cmake