Skip to content


matplotlib 1.2.0 doesn't compile with Solaris Studio 12.3 CC #1839

wants to merge 1 commit into from

6 participants


Unlike the matplotlib 1.1.0 release, which compiles seamlessly with the Solaris Studio 12.3
CC compiler (with a few caveats related to linking as described in, the 1.2.0 release fails to compile

building 'matplotlib.ft2font' extension
CC -g -DNDEBUG -O -Kpic -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/usr/local/include -I/vol/python-2.7/lib/python2.7/site-packages/numpy/core/include -I/vol/X11/include/freetype2 -I/vol/X11/include -I. -I/vol/python-2.7/include/python2.7 -c src/ft2font.cpp -o build/temp.solaris-2.10-i86pc-2.7/src/ft2font.o
"/vol/python-2.7/include/python2.7/pyconfig.h", line 1127: Warning (Anachronism): Attempt to redefine _FILE_OFFSET_BITS without using #undef.
"src/ft2font.h", line 84: Error: PythonClass may not have a type qualifier.
"src/ft2font.h", line 84: Error: Py::PythonClassPy::T cannot be initialized in a constructor.
"src/ft2font.h", line 84: Error: Could not find Py::PythonClass::PythonClass() to initialize base class.
"src/ft2font.cpp", line 44: Error: PythonClass may not have a type qualifier.
"src/ft2font.cpp", line 44: Error: Py::PythonClassPy::T cannot be initialized in a constructor.
"src/ft2font.cpp", line 48: Error: Could not find Py::PythonClass::PythonClass() to initialize base class.
"src/ft2font.cpp", line 839: Error: PythonClass may not have a type qualifier.
"src/ft2font.cpp", line 839: Error: Py::PythonClassPy::T cannot be initialized in a constructor.
"src/ft2font.cpp", line 841: Error: Could not find Py::PythonClass::PythonClass() to initialize base class.
"src/ft2font.cpp", line 849: Warning: error hides FT2Font::error.
"src/ft2font.cpp", line 1026: Warning: ptsize hides FT2Font::ptsize.
"src/ft2font.cpp", line 1027: Warning: dpi hides FT2Font::dpi.
"src/ft2font.cpp", line 1029: Warning: error hides FT2Font::error.
"src/ft2font.cpp", line 1333: Warning: error hides FT2Font::error.
"src/ft2font.cpp", line 1383: Warning: error hides FT2Font::error.
"src/ft2font.cpp", line 1738: Warning: error hides FT2Font::error.
"src/ft2font.cpp", line 1788: Warning: error hides FT2Font::error.
"src/ft2font.cpp", line 1991: Warning: angle hides FT2Font::angle.
"src/ft2font.cpp", line 2069: Warning: error hides FT2Font::error.
9 Error(s) and 11 Warning(s) detected.
error: command 'CC' failed with exit status 2

Since I don't know any C++, I've no idea what's wrong, but it would be good to restore
compilation with non-g++ compilers.


Matplotlib Developers member

I dug up this and the way they deal with it there is to add a cast. I'm not sure how that helps us here, though.

Matplotlib Developers member

@rorth: Does the attached patch help? (I have no way of testing, but I did think the line was more specific than necessary and maybe the Solaris compiler doesn't like that).

Matplotlib Developers member

Looks like Oracle Solaris Studio is a free download for RHEL. I'll give this a try later tonight when I get home. Thanks for the patch, @mdboom.


The patch alone is not enough, but the following additional changes allowed all of matplotlib 1.2.0 to compile:

RCS file: src/RCS/ft2font.cpp,v
retrieving revision 1.1
diff -up -r1.1 src/ft2font.cpp
--- src/ft2font.cpp 2012/10/31 00:11:14 1.1
+++ src/ft2font.cpp 2013/03/25 16:38:13
@@ -41,7 +41,7 @@
 FT_Library _ft2Library;

 FT2Image::FT2Image(Py::PythonClassInstance *self, Py::Tuple &args, Py::Dict &kwds) :
-    Py::PythonClass< FT2Image >::PythonClass(self, args, kwds),
+    Py::PythonClass< FT2Image >(self, args, kwds),
     _width(0), _height(0)
@@ -836,7 +836,7 @@ FT2Font::get_path()

 FT2Font::FT2Font(Py::PythonClassInstance *self, Py::Tuple &args, Py::Dict &kwds) :
-    Py::PythonClass<FT2Font>::PythonClass(self, args, kwds),
+    Py::PythonClass<FT2Font>(self, args, kwds),

@rorth rorth closed this
@mdboom mdboom reopened this
Matplotlib Developers member

@rorth: I think perhaps you closed the bug by accident?


Certainly: I just meant to attach my tentative patch and mark the comment as closed. The UI isn't really intuitive,
to put it mildly ;-(

@mdboom mdboom added a commit that referenced this pull request
@mdboom mdboom Fix #1839: Compilation on Solaris f09dd04
Matplotlib Developers member

Agreed -- the "Close & Comment" button is more dangerous than it is useful.

Matplotlib Developers member

However, now I am going to close the bug because the fix has been comitted to the repository. :wink:

@mdboom mdboom closed this
@HubertHolin HubertHolin added a commit to HubertHolin/matplotlib that referenced this pull request
@mdboom mdboom Fix #1839: Compilation on Solaris 53a804d

It looks like this change missed being included in the zip posted on ( In order to build on Solaris I had to manually modify line 84 in src/ft2font.h.

[EDIT: I modified ft2font, not file_compat]

I also had to update numpy, since Solaris 11 comes with Numpy 1.4.1, which does not seem to be compatible with matplotlib. Do we require 1.5.0 at a minimum, now?

Matplotlib Developers member
Matplotlib Developers member

What did you modify in file_compat.h? The PR deals with a change to ft2font.cpp.


It wouldn't build because src/file_compat.h has a line

#include "numpy/npy_3kcompat.h"

I didn't need to change this file, since updating numpy fixed this build issue.

This file is not in version 1.4.1 of numpy ( It is not included until version 1.5.0 (

Matplotlib Developers member

Wow. That's a problem. You're totally right. We've been 'supporting' numpy v1.4 all this time without realising we haven't support numpy v1.4 since at least mpl v1.2. I'll open a separate issue for this.

Matplotlib Developers member

Thanks @tswast. The issue has been reported in #2152.


There is a similar bug in matplotlib 1.2.1 which makes compilation fail on solaris. It can be resolved by changing line 84 in src/ft2font.h to read:

Glyph(Py::PythonClassInstance *self, Py::Tuple &args, Py::Dict &kwds) :
    Py::PythonClass<Glyph>(self, args, kwds) { }
virtual ~Glyph();
Matplotlib Developers member

@gunnarleffler Thanks for providing some diagnostics for us! In #2198 I implemented your patch. Can you confirm that it works?


I'm running matplotlib 1.2.1 on my test server (SUN M3000) successfully!

In addition to the fix I posted above, the requires modification to compile using SolarisStudio. If it isn't modified, then you get "referenced symbol not found" errors when trying to run matplot lib.

The patch that @tswast provided seems to be for an earlier version of matplotlib and mangles the that ships with 1.2.1. His patch was very informative, and I was able to edit to work.

I can provide a diff file here that can be used to patch matplotlib 1.2.1, or on my github. Which would you prefer?



I have to jet, so here is the diff file for that should make matplotlib 1.2.1 compile on solaris with solarisstudio 12.3:

~/m3000/matplotlib-1.2.1 > diff
> elif sys.platform == 'sunos5':
>     std_libs = ['Crun', 'Cstd']
>     print "sunos5 libraries set"
>         module.libraries.extend(std_libs)
>     include_dirs.append('/usr/include')
>     module.libraries.extend(std_libs)
>             module.libraries.extend(std_libs)
>         module.libraries.extend(std_libs)
>     module.libraries.extend(std_libs)
>     delaunay.libraries.extend(std_libs)
>     module.libraries.extend(std_libs)
Matplotlib Developers member

@gunnarleffler I'm having problems applying your patch. It doesn't appear to be in unified format. Would you mind applying it to your branch and making a pull request against my fix_solaris_compile branch?

@mdboom mdboom deleted the mdboom:ft2font-solaris-compile branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 25, 2013
  1. @mdboom

    Try to fix Solaris compilation

    mdboom committed
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/ft2font.h
2 src/ft2font.h
@@ -81,7 +81,7 @@ class Glyph : public Py::PythonClass<Glyph>
Glyph(Py::PythonClassInstance *self, Py::Tuple &args, Py::Dict &kwds) :
- Py::PythonClass<Glyph>::PythonClass(self, args, kwds) { }
+ Py::PythonClass<Glyph>(self, args, kwds) { }
virtual ~Glyph();
static Py::PythonClassObject<Glyph> factory(const FT_Face&, const FT_Glyph&, size_t, long);
int setattro(const Py::String &name, const Py::Object &value);
Something went wrong with that request. Please try again.