编译安装Mesa,LLVM的详细步骤及错误汇总

安装VTK之前需要先装Mesa库,本文安装版本为:Mesa 10.3.5


下载MesaLib-10.3.5.tar.gz


安装步骤:


1. 配置

sudo ./configure


报错:

checking for DRI2PROTO... no

configure: error: Package requirements (dri2proto >= 2.6) were not met: No package 'dri2proto' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.

Alternatively, you may set the environment variables DRI2PROTO_CFLAGS and DRI2PROTO_LIBS to avoid the need to call pkg-config.

See the pkg-config man page for more details.


搜索并安装该包

apt-file search dri2proto

x11proto-dri2-dev: /usr/include/X11/extensions/dri2proto.h

x11proto-dri2-dev: /usr/share/doc/x11proto-dri2-dev/dri2proto.txt.gz

x11proto-dri2-dev: /usr/share/pkgconfig/dri2proto.pc


sudo apt-get install x11proto-dri2-dev


继续配置

sudo ./configure


提示缺少包

dri3proto


安装后继续配置。仍然报错,根据错误逐条解决,提示少什么包,你就装什么包就行。简略的列出中间需要装的包们如下:


sudo apt-get install xutils-dev

sudo apt-get install flex bison

sudo apt-get install libdrm-dev

sudo apt-get install xcb

sudo apt-get install libx11-xcb-dev libxcb-glx0 libxcb-glx0-dev

sudo apt-get install xorg-dev

sudo apt-get install libxcb-dri2-0-dev


继续配置,仍然报错:

checking for DRIGL... no

configure: error: Package requirements (x11 xext xdamage xfixes x11-xcb xcb-glx >= 1.8.1 xcb-dri2 >= 1.8 xxf86vm) were not met:

No package 'x11-xcb' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.

Alternatively, you may set the environment variables DRIGL_CFLAGS and DRIGL_LIBS to avoid the need to call pkg-config.

See the pkg-config man page for more details.


安装包:

sudo apt-get install libegl1-mesa-dev libgles1-mesa-dev libgles2-mesa-dev


继续配置,仍然报错:

configure: error: Package requirements (dri3proto >= 1.0) were not met:

No package 'dri3proto' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.

没搜到这个包,Google了一下,最后这样解决:在配置命令后面加上--disable-dri3就可以,继续配置:

sudo ./configure --disable-dri3


继续报其它错误:

configure: error: libudev-dev or sysfs required for building DRI


sudo apt-get install libudev-dev


sudo ./configure --disable-dri3


报错:

checking for RADEON... no

configure: error: Package requirements (libdrm_radeon >= 2.4.56) were not met:

Requested 'libdrm_radeon >= 2.4.56' but version of libdrm_radeon is 2.4.52

Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.

Alternatively, you may set the environment variables RADEON_CFLAGS and RADEON_LIBS to avoid the need to call pkg-config.

See the pkg-config man page for more details.


下载安装libdrm-2.4.58.tar.gz,下载地址

cd libdrm-2.4.58

sudo ./config

make

make install


安装完继续配置mesa,继续报新错误:

checking for XCB_DRI2... no

configure: error: Package requirements (x11-xcb xcb-dri2 >= 1.8 xcb-xfixes) were not met:

No package 'xcb-xfixes' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.

Alternatively, you may set the environment variables XCB_DRI2_CFLAGS and XCB_DRI2_LIBS to avoid the need to call pkg-config.

See the pkg-config man page for more details.


apt-file search xcb-xfixes

libxcb-xfixes0: /usr/lib/x86_64-linux-gnu/libxcb-xfixes.so.0

libxcb-xfixes0: /usr/lib/x86_64-linux-gnu/libxcb-xfixes.so.0.0.0

libxcb-xfixes0: /usr/share/doc/libxcb-xfixes0/changelog.Debian.gz

libxcb-xfixes0: /usr/share/doc/libxcb-xfixes0/copyright

libxcb-xfixes0-dbg: /usr/share/doc/libxcb-xfixes0-dbg/changelog.Debian.gz

libxcb-xfixes0-dbg: /usr/share/doc/libxcb-xfixes0-dbg/copyright

libxcb-xfixes0-dev: /usr/lib/x86_64-linux-gnu/libxcb-xfixes.a

libxcb-xfixes0-dev: /usr/lib/x86_64-linux-gnu/libxcb-xfixes.so

libxcb-xfixes0-dev: /usr/lib/x86_64-linux-gnu/pkgconfig/xcb-xfixes.pc

libxcb-xfixes0-dev: /usr/share/doc/libxcb-xfixes0-dev/changelog.Debian.gz

libxcb-xfixes0-dev: /usr/share/doc/libxcb-xfixes0-dev/copyright


sudo apt-get install libxcb-xfixes0 libxcb-xfixes0-dev


sudo ./configure --disable-dri3


报错:

checking for RADEON... yes

configure: error: LLVM is required to build Gallium R300 on x86 and x86_64


sudo apt-get install llvm


安装后不行,这个默认版本不够用!!错误如下:

checking for llvm-config... /usr/bin/llvm-config

configure: error: LLVM 3.1 or newer is required


下载LLVM 3.5.0,

http://llvm.org/releases/download.html#3.5

  • LLVM source code (.sig)

下载的压缩文件为:llvm-3.3.src.tar.gz

解压

cd llvm-3.5.0.src/

./configure

...

checking target architecture... x86_64

checking whether GCC is new enough... no

configure: error:

The selected GCC C++ compiler is not new enough to build LLVM. Please upgrade to GCC 4.7. You may pass --disable-compiler-version-checks to configure to bypass these sanity checks.


就像这里说的,clang 3.4 is not supported in ubuntu 12.04 because it needs libstdc++ 4.8.可以直接使用官网提供的二进制的库。

但是我update gcc to 4.8 on Ubuntu 12.04,方法点此或这里。

升级到gcc4.8以后,继续配置

./configure

成功

make

llvm[0]: Constructing LLVMBuild project information.

make[1]: Entering directory `/install/llvm-3.5.0.src/lib/Support'

llvm[1]: Compiling APFloat.cpp for Release+Asserts build

llvm[1]: Compiling APInt.cpp for Release+Asserts build

llvm[1]: Compiling APSInt.cpp for Release+Asserts build

…...

make[1]: Nothing to be done for `all'.

make[1]: Leaving directory `/install/llvm-3.5.0.src/bindings'

llvm[0]: ***** Completed Release+Asserts Build


编译完成。

sudo make install


LLVM装完后。继续配置Mesa。

cd ../Mesa-10.3.5/

sudo ./configure --disable-dri3


报错:

checking for RADEON... yes

configure: error: Could not find llvm shared libraries:

  Please make sure you have built llvm with the --enable-shared option and that your llvm libraries are installed in /usr/local/lib

  If you have installed your llvm libraries to a different directory you can use the --with-llvm-prefix= configure flag to specify this directory.

  NOTE: Mesa is attempting to use llvm shared libraries by default.

  If you do not want to build with llvm shared libraries and instead want to use llvm static libraries then add --disable-llvm-shared-libs to your configure invocation and rebuild.


找不到LLVM的shared library。这个问题其实就是我的LLVM没装对。这里有2种解决途径:

途径一:

修改configure文件,找到BUILD_SHARED_LIBS,设置为ON。即:

option(BUILD_SHARED_LIBS

"Build all libraries as shared libraries instead of static" ON)

重新配置,编译,安装成功就可以了。或者可以试试这篇作者中的方法,直接./configure --enable-shared=yes,配置应该一样效果。


途径二: 直接用官网http://llvm.org/releases/download.html#3.5,提供的Pre-built Binaries,他们提供了丰富的版本。比如Download LLVM 3.3下面的

  • Clang Binaries for Ubuntu-12.04.2 on AMD64 (82M) (.sig)


就是适合我系统,下载下来后文件名为:clang+llvm-3.3-amd64-Ubuntu-12.04.2.tar.gz,只需要解压后将解压出来的文件夹中的文件拷贝到/usr/local/中对应的文件夹里就可以使用了。


成功装完LLVM之后。继续配置Mesa。

cd ../Mesa-10.3.5/

sudo ./configure --disable-dri3 --prefix=/usr/local/Mesa-10.3.5


配置成功完成。


sudo make


报错:

CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/bash /usr/local/src/Mesa-10.3.5/bin/missing aclocal-1.14 -I m4

/usr/local/src/Mesa-10.3.5/bin/missing: line 81: aclocal-1.14: command not found

WARNING: 'aclocal-1.14' is missing on your system.

       You should only need it if you modified 'acinclude.m4' or

       'configure.ac' or m4 files included by 'configure.ac'.

       The 'aclocal' program is part of the GNU Automake package:

      

       It also requires GNU Autoconf, GNU m4 and Perl in order to run:

      

      

      

make: *** [aclocal.m4] Error 127


这个错误是由于时间戳改变导致的几个脚本文件需要重新生成。执行这条命令就行:


sudo autoreconf -ivf


如果不会或执行该命令时出错,请参阅这篇笔记:“Ubuntun 12.04 WARNING: 'aclocal-1.14' is missing on your system


解决上述问题后,重新配置、编译Mesa

sudo ./configure --disable-dri3 --prefix=/usr/local/Mesa-10.3.5

sudo make

成功完成。


sudo make install


安装完成!




其它相关错误:

之前按网上说法,试图这样安装Mesa,但是遇到错误,放弃。

sudo add-apt-repository 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise main'

wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key|sudo apt-key add -

--2014-12-28 20:12:00--  http://llvm.org/apt/llvm-snapshot.gpg.key

Resolving llvm.org (llvm.org)... 128.174.246.134

Connecting to llvm.org (llvm.org)|128.174.246.134|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 3145 (3.1K) [application/pgp-keys]

Saving to: `STDOUT'

100%[==================================================================>] 3,145       --.-K/s   in 0.006s  

2014-12-28 20:12:01 (495 KB/s) - written to stdout [3145/3145]

OK


sudo apt-get update


sudo apt-get install clang-3.4 clang-3.4-doc libclang-common-3.4-dev  libclang-3.4-dev libclang1-3.4 libclang1-3.4-dbg libllvm-3.4-ocaml-dev  libllvm3.4 libllvm3.4-dbg lldb-3.4 llvm-3.4 llvm-3.4-dev llvm-3.4-doc  llvm-3.4-examples llvm-3.4-runtime clang-modernize-3.4 clang-format-3.4  python-clang-3.4 lldb-3.4-dev

Reading package lists... Done

Building dependency tree     

Reading state information... Done

Package lldb-3.4 is not available, but is referred to by another package.

This may mean that the package is missing, has been obsoleted, or is only available from another source


E: Package 'lldb-3.4' has no installation candidate

E: Unable to locate package lldb-3.4-dev

E: Couldn't find any package by regex 'lldb-3.4-dev'

你可能感兴趣的:(VTK)