# Matplotlib: compiling matplotlib on solaris10¶

how to install sunstudio and build matplotlib on solaris 10 might give some hints.

JDH said:

Hi Erik – if you succeed, then we’ll have convincing proof that compiling mpl on solaris is easier than giving up the sauce.

Well, it has turned out to be easier than giving up the sauce (at least for me), but only by a whisker. In the end, the fix is incredibly simple (if you consider recompiling python and manually adjusting the auto-produced pyconfig.h incredibly simple, anyway). After two solid days of commenting this and that out, recompiling everything and its mother 76 different ways from Sunday, poring over a legion of Solaris sys includes, slaughtering a few spotlessly white lambs and one pure black sheep, wrapping the bones and tendons and viscera in a double layer of fat and burning the offering to Delphic Apollo, I found the answer:

2 after extracting it and running ./configure, edit the generated pyconfig.h as follows:

i) if _XOPEN_SOURCE is defined to be 600 (i.e., if the line "#define _XOPEN_SOURCE 600" appears in the file), redefine it to 500

ii) if _XOPEN_SOURCE_EXTENDED is defined at all (i.e. if the line "#define _XOPEN_SOURCE_EXTENDED 1" appears in the file), comment out its definition


3 make && make install

The problem was with Solaris’s support for the X/Open standards. To make a long story short, you can use Open Group Technical Standard, Issue 6 (XPG6/UNIX 03/SUSv3) (XOPENSOURCE == 600) if and only if you are using an ISO C99 compiler. If you use X/Open CAE Specification, Issue 5 (XPG5/UNIX 98/SUSv2) (XOPENSOURCE == 500), you don’t have to use an ISO C99 compiler. For full details, see the Solaris header file /usr/include/sys/feature_tests.h.

This is why muhpubuh (AKA matplotlib—long story) compiles on Solaris 10 if you have the big bucks and can afford Sun’s OpenStudio 10 compiler. gcc does not have full C99 support yet. In particular, its lack of support for the wide character library makes the build go bust. (See, e.g., http://gcc.gnu.org/c99status.html.)

More helpful links on the wchar problem with Python.h and Solaris :

Section author: AndrewStraw, Unknown[83], Unknown[89]