发现自己还写过一篇mesa编译的文章。
依赖
sudo apt-get install flex bison autoconf libtool python-mako python-libxml2 llvm libexpat1-dev
编译方法
编译:
./autogen.sh
./configure --disable-dri3 --enable-gles1 --enable-gles2 --enable-egl --with-llvm-prefix=/usr/lib/llvm-3.5
对于需要制定llvm的版本的,可以使用上面的–with-llvm-prefix。
版本兼容性
10.1版本
10.1.6无法使用llvm >=3.5来编译
原因:
llvm 3.5没有OwningPtr.h
CXX gallivm/lp_bld_debug.lo
gallivm/lp_bld_debug.cpp:60:32: fatal error: llvm/ADT/OwningPtr.h: 没有那个文件或目录
10.2版本
10.2.9可以使用llvm <= 3.5来编译
原因:
llvm >=3.6中没有LLVMLinkInJIT
gallivm/lp_bld_init.c: In function ‘free_gallivm_state’:
gallivm/lp_bld_init.c:201:7: error: implicit declaration of function ‘LLVMRemoveModuleProvider’ [-Werror=implicit-function-declaration]
LLVMRemoveModuleProvider(gallivm->engine, gallivm->provider,
^
gallivm/lp_bld_init.c: In function ‘init_gallivm_engine’:
gallivm/lp_bld_init.c:283:4: error: implicit declaration of function ‘LLVMAddModuleProvider’ [-Werror=implicit-function-declaration]
LLVMAddModuleProvider(gallivm->engine, gallivm->provider);//new
^
gallivm/lp_bld_init.c: In function ‘lp_build_init’:
gallivm/lp_bld_init.c:437:4: error: implicit declaration of function ‘LLVMLinkInJIT’ [-Werror=implicit-function-declaration]
LLVMLinkInJIT();
^
编译错误处理
1. fstat 和stat未定义——增加sys/stat.h头文件依赖
loader.c: In function ‘udev_device_new_from_fd’:
loader.c:141:16: error: storage size of ‘buf’ isn’t known
struct stat buf;
^
loader.c:145:8: error: implicit declaration of function ‘fstat’ [-Werror=implicit-function-declaration]
if (fstat(fd, &buf) < 0) {
^
loader.c:141:16: warning: unused variable ‘buf’ [-Wunused-variable]
struct stat buf;
^