Views
Building Mesa library
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!
- 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 - googlecc1plus vista mingw. - 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 - Change to your mesa folder and invoke the make file:
mingw32-make -f Makefile.mgw - Copy the
includeandlibfolder contents to the following locations expected by cmgui (in my case{CMISS_ROOT}isd:\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-