Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

mdboom
Copy link
Member

@mdboom mdboom commented Mar 25, 2013

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 http://www.timswast.com/blog/2012/08/06/compiling-matplotlib-with-solaris-studio/), the 1.2.0 release fails to compile
immediately:

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.

Thanks.
Rainer

@dmcdougall
Copy link
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.

@mdboom
Copy link
Member

mdboom commented Mar 25, 2013

@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).

@dmcdougall
Copy link
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.

@rorth
Copy link
Author

rorth commented Mar 26, 2013

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),
     _isDirty(true),
     _buffer(NULL),
     _width(0), _height(0)
@@ -836,7 +836,7 @@ FT2Font::get_path()
 PYCXX_NOARGS_METHOD_DECL(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),
     image()
 {
     args.verify_length(1);

@rorth rorth closed this Mar 26, 2013
@mdboom mdboom reopened this Mar 26, 2013
@mdboom
Copy link
Member

mdboom commented Mar 26, 2013

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

@rorth
Copy link
Author

rorth commented Mar 26, 2013

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 added a commit that referenced this pull request Mar 26, 2013
@mdboom
Copy link
Member

mdboom commented Mar 26, 2013

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

@mdboom
Copy link
Member

mdboom commented Mar 26, 2013

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

@mdboom mdboom closed this Mar 26, 2013
HubertHolin pushed a commit to HubertHolin/matplotlib that referenced this pull request Apr 8, 2013
@tswast
Copy link

tswast commented May 31, 2013

It looks like this change missed being included in the zip posted on matplotlib.org (https://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.2.1/matplotlib-1.2.1.tar.gz). 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?

@WeatherGod
Copy link
Member

No, version 1.4 is the minimum. What happened to make you think it wasn't
compatible?

@mdboom
Copy link
Member

mdboom commented May 31, 2013

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

@tswast
Copy link

tswast commented May 31, 2013

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 (https://github.com/numpy/numpy/tree/v1.4.1/numpy/core/include/numpy) It is not included until version 1.5.0 (https://github.com/numpy/numpy/raw/v1.5.0/numpy/core/include/numpy/npy_3kcompat.h)

@dmcdougall
Copy link
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.

@dmcdougall
Copy link
Member

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

@gunnarleffler
Copy link

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();

@dmcdougall
Copy link
Member

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

@gunnarleffler
Copy link

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

In addition to the fix I posted above, the setupext.py 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 setupext.py that ships with 1.2.1. His patch was very informative, and I was able to edit setupext.py 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?

@gunnarleffler
Copy link

@dmcdougall

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

~/m3000/matplotlib-1.2.1 > diff setupext.py.bak setupext.py
257a258,260
> elif sys.platform == 'sunos5':
>     std_libs = ['Crun', 'Cstd']
>     print "sunos5 libraries set"
345c348
<
---
>         module.libraries.extend(std_libs)
346a350
>     include_dirs.append('/usr/include')
616a621
>     module.libraries.extend(std_libs)
1045a1051
>             module.libraries.extend(std_libs)
1085a1092
>         module.libraries.extend(std_libs)
1094a1102
>     module.libraries.extend(std_libs)
1330a1339
>     delaunay.libraries.extend(std_libs)
1385a1395
>     module.libraries.extend(std_libs)

@dmcdougall
Copy link
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 ft2font-solaris-compile branch November 10, 2015 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants