Personal tools
You are here: Home cmgui Wiki Building Mesa library
Views
FrontPage >>

Building Mesa library

last edited 6 months ago by Alanwu

Mesa library is a free software graphics library which provides generic OpenGL implementation and is required to build the cmgui.

The latest source code for the Mesa library can be downloaded from http://www.mesa3d.org/.

Building Mesa library is generally a simple process under most of the platforms. User will only need to specify the OS name with the make command and the build process should be completed without much problem.

Compilation problem with AIX

However I did encounter a problem when I compiled the Mesa library for AIX(rs6000-AIX) and here is the error message that I received: "ld: 0711-317 ERROR: Undefined symbol: .__builtin_expect". To fix this problem, I removed the macro for IBMC compiler in the src/mesa/main/glheader.h file (thanks Shane for pointing this out). However this will not fix the problem completely, the compilation will still fail. To compile the library successfully, I ran the make command inside the src folder and now the lib files will be built inside the lib folder.

Compiling Mesa for Windows with MinGW

Mesa comes with makefiles titles Makefile.mgw for building with MinGW. Following is what worked for me; if you find a way to build it conveniently for mingw under cygwin, please document this!

  1. Install MinGW with the appropriate compilers plus mingw32-make. If running on Vista, note there is a defect in current mingw32 compilers (cannot exec cc1plus : No such file or directory) which requires patched versions - google cc1plus vista mingw.
  2. Open a Windows command window (needed for DOS copy/del commands invoked from makefiles), and set up paths and environment (Following for MinGW installed under D:\MinGW\):
        set path=D:\MinGW\bin;%PATH%
        set LIBRARY_PATH=D:\MinGW\lib
        set C_INCLUDE_PATH=D:\MinGW\include
        set CPLUS_INCLUDE_PATH=D:\MinGW\include\c++\3.4.5;D:\MinGW\include\c++\3.4.5\backward;D:\MinGW\include\c++\mingw32;D:\MinGW\include
    
  3. Change to your mesa folder and invoke the make file:
        mingw32-make -f Makefile.mgw
    
  4. Copy the include and lib folder contents to the following locations expected by cmgui (in my case {CMISS_ROOT} is d:\cmiss):
        {CMISS_ROOT}\mesa\include\i386-win32\
        {CMISS_ROOT}\mesa\lib\i386-win32\
    

Compiling Mesa for Windows using cross-compiler in Linux

Compiling MESA for windows in Linux requires a cross-platform mingw gcc compiler. To compile MESA, user needs to change the Makefile.mgw script at different part in the src folder in the MESA source code to specify a cross-compiler. In our current build system we have a win32 make script called i386-mingw32-cross-make which uses win32 compilers including i386-mingw32msvc-gcc. Therefore to build the library I change a line in the Makefile.mgw from:

    {default} TOOLS_PREFIX = mingw32-
    to
    {edited}  TOOLS_PREFIX = i386-mingw32msvc-

Contributing to this site

Please add to the wiki any relevant information that you think might be useful to other users of this website. For example, you might like to contribute your experiences, questions and answers.

You are encouraged to contribute to this site regardless of your level of experience. Contributions are welcomed from new and regular visitors.

If you ask a question and receive an answer from a developer you should record it in the wiki. This information is extremely useful and can help other users overcome the same problem.

See how to add and edit pages for more information.