Clone of mesa.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. <HTML>
  2. <TITLE>Compiling and Installing</TITLE>
  3. <link rel="stylesheet" type="text/css" href="mesa.css"></head>
  4. <BODY>
  5. <H1>Compiling and Installing</H1>
  6. <ol>
  7. <li><a href="#unix-x11">Unix / X11</a>
  8. <ul>
  9. <li><a href="#prereq">Prerequisites for DRI and hardware acceleration</a>
  10. <li><a href="#autoconf">Building with autoconf</a>
  11. <li><a href="#traditional">Building with traditional Makefiles</a>
  12. <li><a href="#libs">The Libraries</a>
  13. <li><a href="#demos">Running the demos
  14. <li><a href="#install">Installing the header and library files
  15. <li><a href="#pkg-config">Building OpenGL programs with pkg-config
  16. </ul>
  17. <li><a href="#windows">Windows</a>
  18. <li><a href="#scons">SCons</a>
  19. <li><a href="#other">Other</a>
  20. </ol>
  21. <br>
  22. <a name="unix-x11">
  23. <H2>1. Unix/X11 Compilation and Installation</H1>
  24. <a name="prereq">
  25. <h3>1.1 Prerequisites for DRI and hardware acceleration</h3>
  26. <p>
  27. The following are required for DRI-based hardware acceleration with Mesa:
  28. </p>
  29. <ul>
  30. <li><a href="http://xorg.freedesktop.org/releases/individual/proto/">dri2proto</a> version 1.99.3 or later
  31. <li>Linux 2.6.28
  32. <li><a href="http://dri.freedesktop.org/libdrm/" target="_parent">libDRM</a>
  33. version 2.4.15 or later
  34. <li>Xorg server version 1.5 or later
  35. </ul>
  36. </p>
  37. <a name="autoconf">
  38. <h3>1.2 Building with Autoconf</h3>
  39. <p>
  40. Mesa may be <a href="autoconf.html">built using autoconf</a>.
  41. This should work well on most GNU-based systems.
  42. If that fails the traditional Mesa build system is available.
  43. <a name="traditional">
  44. <h3>1.3 Building with traditional Makefiles</h3>
  45. <p>
  46. The traditional Mesa build system is based on a collection of pre-defined
  47. system configurations.
  48. </p>
  49. <p>
  50. To see the list of configurations, just type <code>make</code>.
  51. Then choose a configuration from the list and type <code>make</code>
  52. <em>configname</em>.
  53. </p>
  54. <p>
  55. Mesa may be built in several different ways using the predefined configurations:
  56. </p>
  57. <ul>
  58. <li><b><em>Stand-alone/Xlib mode</em></b> - Mesa will be compiled as
  59. a software renderer using Xlib to do all rendering.
  60. The libGL.so library will be a self-contained rendering library that will
  61. allow you to run OpenGL/GLX applications on any X server (regardless of
  62. whether it supports the GLX X server extension).
  63. You will <em>not</em> be able to use hardware 3D acceleration.
  64. <p>
  65. To compile stand-alone Mesa type <code>make</code> in the top-level directory.
  66. You'll see a list of supported system configurations.
  67. Choose one from the list (such as linux-x86), and type:
  68. </p>
  69. <pre>
  70. make linux-x86
  71. </pre>
  72. <p>This will produce libGL.so and several other libraries</p>
  73. </li>
  74. <li><b><em>DRI/accelerated</em></b> - The DRI hardware drivers for
  75. accelerated OpenGL rendering (for ATI, Intel, Matrox, etc) will be built.
  76. The libGL.so library will support the GLX extension and will load/use
  77. the DRI hardware drivers.
  78. <p>
  79. Build Mesa and the DRI hardware drivers by running
  80. </p>
  81. <pre>
  82. make linux-dri
  83. </pre>
  84. <p>
  85. There are also <code>linux-dri-x86</code>, <code>linux-dri-x86-64</code>,
  86. and <code>linux-ppc</code> configurations which are optimized for those
  87. architectures.
  88. </p>
  89. <p>
  90. Make sure you have the prerequisite versions of DRM and Xserver mentioned
  91. above.
  92. </p>
  93. </li>
  94. </ul>
  95. <p>
  96. Later, if you want to rebuild for a different configuration run
  97. <code>make realclean</code> before rebuilding.
  98. </p>
  99. <a name="libs">
  100. <h3>1.4 The libraries</h3>
  101. <p>
  102. When compilation has finished, look in the top-level <code>lib/</code>
  103. (or <code>lib64/</code>) directory.
  104. You'll see a set of library files similar to this:
  105. </p>
  106. <pre>
  107. lrwxrwxrwx 1 brian users 10 Mar 26 07:53 libGL.so -> libGL.so.1*
  108. lrwxrwxrwx 1 brian users 19 Mar 26 07:53 libGL.so.1 -> libGL.so.1.5.060100*
  109. -rwxr-xr-x 1 brian users 3375861 Mar 26 07:53 libGL.so.1.5.060100*
  110. lrwxrwxrwx 1 brian users 11 Mar 26 07:53 libGLU.so -> libGLU.so.1*
  111. lrwxrwxrwx 1 brian users 20 Mar 26 07:53 libGLU.so.1 -> libGLU.so.1.3.060100*
  112. -rwxr-xr-x 1 brian users 549269 Mar 26 07:53 libGLU.so.1.3.060100*
  113. lrwxrwxrwx 1 brian users 12 Mar 26 07:53 libglut.so -> libglut.so.3*
  114. lrwxrwxrwx 1 brian users 16 Mar 26 07:53 libglut.so.3 -> libglut.so.3.7.1*
  115. -rwxr-xr-x 1 brian users 597754 Mar 26 07:53 libglut.so.3.7.1*
  116. lrwxrwxrwx 1 brian users 11 Mar 26 08:04 libGLw.so -> libGLw.so.1*
  117. lrwxrwxrwx 1 brian users 15 Mar 26 08:04 libGLw.so.1 -> libGLw.so.1.0.0*
  118. -rwxr-xr-x 1 brian users 20750 Mar 26 08:04 libGLw.so.1.0.0*
  119. lrwxrwxrwx 1 brian users 14 Mar 26 07:53 libOSMesa.so -> libOSMesa.so.6*
  120. lrwxrwxrwx 1 brian users 23 Mar 26 07:53 libOSMesa.so.6 -> libOSMesa.so.6.1.060100*
  121. -rwxr-xr-x 1 brian users 23871 Mar 26 07:53 libOSMesa.so.6.1.060100*
  122. </pre>
  123. <p>
  124. <b>libGL</b> is the main OpenGL library (i.e. Mesa).
  125. <br>
  126. <b>libGLU</b> is the OpenGL Utility library.
  127. <br>
  128. <b>libglut</b> is the GLUT library.
  129. <br>
  130. <b>libGLw</b> is the Xt/Motif OpenGL drawing area widget library.
  131. <br>
  132. <b>libOSMesa</b> is the OSMesa (Off-Screen) interface library.
  133. </p>
  134. <p>
  135. If you built the DRI hardware drivers, you'll also see the DRI drivers:
  136. </p>
  137. <pre>
  138. -rwxr-xr-x 1 brian users 15607851 Jul 21 12:11 ffb_dri.so
  139. -rwxr-xr-x 1 brian users 15148747 Jul 21 12:11 i810_dri.so
  140. -rwxr-xr-x 1 brian users 14497814 Jul 21 12:11 i830_dri.so
  141. -rwxr-xr-x 1 brian users 16895413 Jul 21 12:11 i915_dri.so
  142. -rwxr-xr-x 1 brian users 11320803 Jul 21 12:11 mach64_dri.so
  143. -rwxr-xr-x 1 brian users 11418014 Jul 21 12:12 mga_dri.so
  144. -rwxr-xr-x 1 brian users 11064426 Jul 21 12:12 r128_dri.so
  145. -rwxr-xr-x 1 brian users 11849858 Jul 21 12:12 r200_dri.so
  146. -rwxr-xr-x 1 brian users 16050488 Jul 21 12:11 r300_dri.so
  147. -rwxr-xr-x 1 brian users 11757388 Jul 21 12:12 radeon_dri.so
  148. -rwxr-xr-x 1 brian users 11232304 Jul 21 12:13 s3v_dri.so
  149. -rwxr-xr-x 1 brian users 11062970 Jul 21 12:13 savage_dri.so
  150. -rwxr-xr-x 1 brian users 11214212 Jul 21 12:13 sis_dri.so
  151. -rwxr-xr-x 1 brian users 11368736 Jul 21 12:13 tdfx_dri.so
  152. -rwxr-xr-x 1 brian users 10598868 Jul 21 12:13 trident_dri.so
  153. -rwxr-xr-x 1 brian users 10997120 Jul 21 12:13 unichrome_dri.so
  154. </pre>
  155. <a name="demos">
  156. <h3>1.5 Running the demos</h3>
  157. <p>
  158. If you downloaded/unpacked the MesaDemos-x.y.z.tar.gz archive or
  159. obtained Mesa from CVS, the <b>progs/</b> directory will contain a
  160. bunch of demonstration programs.
  161. </p>
  162. <p>
  163. Before running a demo, you'll probably have to set two environment variables
  164. to indicate where the libraries are located. For example:
  165. <p>
  166. <blockquote>
  167. <b>cd lib/</b>
  168. <br>
  169. <b>export LD_LIBRARY_PATH=${PWD}</b>
  170. <br>
  171. <b>export LIBGL_DRIVERS_PATH=${PWD}</b> (if using DRI drivers)
  172. </blockquote>
  173. <p>
  174. Next, change to the Mesa/demos/ directory:
  175. </p>
  176. <blockquote>
  177. <b>cd ../progs/demos</b>
  178. </blockquote>
  179. <p>
  180. Run a demo such as gears:
  181. </p>
  182. <blockquote>
  183. <b>./gears</b>
  184. </blockquote>
  185. <p>
  186. If this doesn't work, try the <b>Mesa/progs/xdemos/glxinfo</b> program
  187. and see that it prints the expected Mesa version number.
  188. </p>
  189. <p>
  190. If you're using Linux or a similar OS, verify that the demo program is
  191. being linked with the proper library files:
  192. </p>
  193. <blockquote>
  194. <b>ldd gears</b>
  195. </blockquote>
  196. <p>
  197. You should see something like this:
  198. </p>
  199. <pre>
  200. libglut.so.3 => /home/brian/Mesa/lib/libglut.so.3 (0x40013000)
  201. libGLU.so.1 => /home/brian/Mesa/lib/libGLU.so.1 (0x40051000)
  202. libGL.so.1 => /home/brian/Mesa/lib/libGL.so.1 (0x400e0000)
  203. libc.so.6 => /lib/i686/libc.so.6 (0x42000000)
  204. libm.so.6 => /lib/i686/libm.so.6 (0x403da000)
  205. libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x403fc000)
  206. libXmu.so.6 => /usr/X11R6/lib/libXmu.so.6 (0x404da000)
  207. libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x404f1000)
  208. libXi.so.6 => /usr/X11R6/lib/libXi.so.6 (0x40543000)
  209. libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x4054b000)
  210. libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x405fd000)
  211. libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x40605000)
  212. libpthread.so.0 => /lib/i686/libpthread.so.0 (0x40613000)
  213. /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
  214. libdl.so.2 => /lib/libdl.so.2 (0x40644000)
  215. libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x40647000)
  216. libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x40650000)
  217. </pre>
  218. <p>
  219. Retrace your steps if this doesn't look right.
  220. </p>
  221. <a name="install">
  222. <H3>1.6 Installing the header and library files</H3>
  223. <p>
  224. The standard location for the OpenGL header files on Unix-type systems is
  225. in <code>/usr/include/GL/</code>.
  226. The standard location for the libraries is <code>/usr/lib/</code>.
  227. For more information see, the
  228. <a href="http://oss.sgi.com/projects/ogl-sample/ABI/" target="_parent">
  229. Linux/OpenGL ABI specification</a>.
  230. </p>
  231. <p>
  232. If you'd like Mesa to co-exist with another implementation of OpenGL that's
  233. already installed, you'll have to choose different directories, like
  234. <code>/usr/local/include/GL/</code> and <code>/usr/local/lib/</code>.
  235. </p>
  236. <p>
  237. To install Mesa's headers and libraries, run <code>make install</code>.
  238. But first, check the Mesa/configs/default file and examine the values
  239. of the <b>INSTALL_DIR</b> and <b>DRI_DRIVER_INSTALL_DIR</b> variables.
  240. Change them if needed, then run <code>make install</code>.
  241. </p>
  242. <p>
  243. The variable
  244. <b>DESTDIR</b> may also be used to install the contents to a temporary
  245. staging directory.
  246. This can be useful for package management.
  247. For example: <code>make install DESTDIR=/somepath/</code>
  248. </p>
  249. <p>
  250. Note: at runtime you can use the LD_LIBRARY_PATH environment variable
  251. (on Linux at least) to switch
  252. between the Mesa libraries and other vendor's libraries whenever you want.
  253. This is a handy way to compare multiple OpenGL implementations.
  254. </p>
  255. <a name="pkg-config">
  256. <H3>1.7 Building OpenGL programs with pkg-config</H3>
  257. <p>
  258. Running <code>make install</code> will install package configuration files
  259. for the pkg-config utility.
  260. </p>
  261. <p>
  262. When compiling your OpenGL application you can use pkg-config to determine
  263. the proper compiler and linker flags.
  264. </p>
  265. <p>
  266. For example, compiling and linking a GLUT application can be done with:
  267. </p>
  268. <pre>
  269. gcc `pkg-config --cflags --libs glut` mydemo.c -o mydemo
  270. </pre>
  271. <br>
  272. <a name="windows">
  273. <H2>2. Windows Compilation and Installation</H1>
  274. <p>
  275. Please see the <a href="#scons">instructions on building with SCons</a>.
  276. Alternatively see <a href="README.WIN32">README.WIN32</a> file.
  277. </p>
  278. <a name="scons">
  279. <H2>3. Building with SCons</H1>
  280. <p>
  281. To build Mesa with SCons on Linux or Windows do
  282. </p>
  283. <pre>
  284. scons
  285. </pre>
  286. <p>
  287. The build output will be placed in
  288. build/<i>platform</i>-<i>machine</i>-<i>debug</i>/..., where <i>platform</i> is for
  289. example linux or windows, <i>machine</i> is x86 or x86_64, optionally followed
  290. by -debug for debug builds.
  291. </p>
  292. <p>
  293. To build Mesa with SCons for Windows on Linux using the MinGW crosscompiler toolchain do
  294. </p>
  295. <pre>
  296. scons platform=windows toolchain=crossmingw machine=x86 statetrackers=mesa drivers=softpipe,trace winsys=gdi
  297. </pre>
  298. <p>
  299. This will create:
  300. </p>
  301. <ul>
  302. <li>build/windows-x86-debug/gallium/winsys/gdi/opengl32.dll &mdash; Mesa + Gallium + softpipe, binary compatible with Windows's opengl32.dll
  303. <li>build/windows-x86-debug/glut/glx/glut32.dll
  304. <li>progs/build/windows-x86-debug/wgl/wglinfo.exe
  305. <li>progs/build/windows-x86-debug/trivial/tri.exe
  306. <li>and many other samples in progs/build/windows-x86-debug/...
  307. </ul>
  308. <p>
  309. Put them all in the same directory to test them.
  310. </p>
  311. <a name="other">
  312. <H2>4. Other systems</H1>
  313. <p>
  314. Documentation for other environments (some may be very out of date):
  315. </p>
  316. <UL>
  317. <li><A HREF="README.VMS">README.VMS</A> - VMS
  318. <LI><A HREF="README.GGI">README.GGI</A> - GGI
  319. <LI><A HREF="README.3DFX">README.3DFX</A> - 3Dfx/Glide driver
  320. <LI><A HREF="README.AMIWIN">README.AMIWIN</A> - Amiga Amiwin
  321. <LI><A HREF="README.BEOS">README.BEOS</A> - BeOS
  322. <LI><A HREF="README.D3D">README.D3D</A> - Direct3D driver
  323. <LI><A HREF="README.DJ">README.DJ</A> - DJGPP
  324. <LI><A HREF="README.LYNXOS">README.LYNXOS</A> - LynxOS
  325. <LI><A HREF="README.MINGW32">README.MINGW32</A> - Mingw32
  326. <LI><A HREF="README.NeXT">README.NeXT</A> - NeXT
  327. <LI><A HREF="README.OpenStep">README.OpenStep</A> - OpenStep
  328. <LI><A HREF="README.OS2">README.OS2</A> - OS/2
  329. <LI><A HREF="README.WINDML">README.WINDML</A> - WindML
  330. </UL>
  331. </body>
  332. </html>