ft2font error while building with python3 support

Dear list,

I have been trying to build matplotlib with python2 *and* python3
support. I am using Gentoo and a custom ebuild which can be found on
gnlay overlay[1]. However, I had a build error while trying to compile
'src/ft2font.cpp' (see the log attached[2]). I was wondering weather
there are any preparation steps involved to make this file compile,
which might be different from the python2 version?

I found the 'CXX/Extensions.hxx' and the problem might be that it is
not loaded due to some reason?

I am afraid that this might have something to do with the my ebuild,
so could someone tell me more about how the building process works? Or
how much it is different for python3 compared with python2?

Thanks a lot,
Ignas

[1] - https://github.com/gns-ank/gnlay/tree/
[2] - http://pastebin.com/m9Lf3s0J

···

--
Q: Because it reverses the logical flow of conversation.
A: Why is putting a reply at the top of the message frowned upon?

2011/11/24 Ignas Anikevicius <anikevicius@...287...>:

Dear list,

I have been trying to build matplotlib with python2 *and* python3
support. I am using Gentoo and a custom ebuild which can be found on
gnlay overlay[1]. However, I had a build error while trying to compile
'src/ft2font.cpp' (see the log attached[2]). I was wondering weather
there are any preparation steps involved to make this file compile,
which might be different from the python2 version?

I found the 'CXX/Extensions.hxx' and the problem might be that it is
not loaded due to some reason?

The log looks ok, although the lines are remarkably short, compared to
building on a Mac. Did you modify CFLAGS or CC?

The ``-I.`` should just do the trick, at least. So I wonder if, for
some reason, maybe your CWD is no longer the matplotlib root
directory. I could imagine that it has either sth to do with your
gentoo ebuild or with Python3k's distutils? Just a rough guess.

I am afraid that this might have something to do with the my ebuild,
so could someone tell me more about how the building process works? Or
how much it is different for python3 compared with python2?

For py2k it's just pythonX.Y setup.py build and then pythonX.Y
setup.py install, if you want to install. ft2font.so is built during
the build step. I believe it's the same for py3k.

I actually don't know if it'll work if you say e.g. pythonX.Y
matplotlib.git/setup.py build ...... might be an mistake in either
distutils or the matplotlib build engine which I don't know at all (if
there are additions from the mpl side to building at all.....). If
I'm right a ``cd ........./matplotlib`` should do the trick. :slight_smile: I
believe it's rare to invoke the setup.py from another directory than
that where it resides in.

I don't know how to build ebuild scripts. I'm just a user of them.

cu,
Friedrich

Hi,

Thanks for your reply.


>...

  > building on a Mac. Did you modify CFLAGS or CC?

  >

There was in the ebuild some additional flags like

fno-strict-aliasing, but nothing change by removing the aditional

flags. The strange thing is that it still builds for 2.7, but not

for

3.2.

>...

  >...

  > I actually don't know if it'll work if you say e.g. pythonX.Y

  > matplotlib.git/setup.py build ...... might be an mistake in

either

  > distutils or the matplotlib build engine which I don't know

at all (if

  > there are additions from the mpl side to building at

all…). If

  > I'm right a ``cd ........./matplotlib`` should do the trick.

:slight_smile:

It did not help :(...

I have probably found out the cause in the difference. The relevant

part of the log for the Python 2.7 build:
···

On 24/11/11 18:54, Friedrich Romstedt wrote:

---------------------------

running build_ext

building 'matplotlib.ft2font' extension

creating build-2.7/temp.linux-x86_64-2.7

creating build-2.7/temp.linux-x86_64-2.7/src

creating build-2.7/temp.linux-x86_64-2.7/CXX

x86_64-pc-linux-gnu-g++ -pthread -march=native -O2

-fno-strict-aliasing -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API
-DPYCXX_ISO_CPP_LIB=1 -I/usr/local/include -I/usr/include
-I/usr/lib64/python2.7/site-packages/numpy/core/include
-I/usr/include/freetype2 -I/usr/include -I. -I/usr/include/python2.7
-c src/ft2font.cpp -o build-2.7/temp.linux-x86_64-2.7/src/ft2font.o

---------------------------

And know for the Python 3.2 build:

---------------------------

running build_ext

building 'matplotlib.ft2font' extension

creating build-3.2/temp.linux-x86_64-3.2

creating build-3.2/temp.linux-x86_64-3.2/src

---------------------------

<<< !!!!!!!!!!!!!!!!!!!!!!!!!!!!!missing line

!!!>>>

---------------------------

x86_64-pc-linux-gnu-g++ -pthread -march=native -O2 -fPIC

-DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -DPYCXX_ISO_CPP_LIB=1
-DPYCXX_PYTHON_2TO3=1 -I/usr/local/include -I/usr/include
-I/usr/lib64/python3.2/site-packages/numpy/core/include
-I/usr/include/freetype2 -I/usr/include -I. -I/usr/include/python3.2
-c src/ft2font.cpp -o build-3.2/temp.linux-x86_64-3.2/src/ft2font.o

---------------------------

Note that there is a missing line for the 3.2 build as it does not

create the build-3.2/temp.linux-x86_64-3.2/CXX directory.

Hence, my question is whether this behaviour is due to some code in

the MPL building system, or should I research my ebuild more?

Cheers,

Ignas A.

--

Q: Because it reverses the logical flow of conversation.

A: Why is putting a reply at the top of the message frowned upon?

2011/11/24 Ignas Anikevicius <anikevicius@...287...>:

I have probably found out the cause in the difference. The relevant
part of the log for the Python 2.7 build:
---------------------------
running build_ext
building 'matplotlib.ft2font' extension
creating build-2.7/temp.linux-x86_64-2.7
creating build-2.7/temp.linux-x86_64-2.7/src
creating build-2.7/temp.linux-x86_64-2.7/CXX
x86_64-pc-linux-gnu-g++ -pthread -march=native -O2 -fno-strict-aliasing
-fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -DPYCXX_ISO_CPP_LIB=1
-I/usr/local/include -I/usr/include
-I/usr/lib64/python2.7/site-packages/numpy/core/include
-I/usr/include/freetype2 -I/usr/include -I. -I/usr/include/python2.7 -c
src/ft2font.cpp -o build-2.7/temp.linux-x86_64-2.7/src/ft2font.o
---------------------------

And know for the Python 3.2 build:
---------------------------
running build_ext
building 'matplotlib.ft2font' extension
creating build-3.2/temp.linux-x86_64-3.2
creating build-3.2/temp.linux-x86_64-3.2/src
---------------------------
<<< !!!!!!!!!!!!!!!!!!!!!!!!!!!!!missing line
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!>>>
---------------------------
x86_64-pc-linux-gnu-g++ -pthread -march=native -O2 -fPIC
-DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -DPYCXX_ISO_CPP_LIB=1
-DPYCXX_PYTHON_2TO3=1 -I/usr/local/include -I/usr/include
-I/usr/lib64/python3.2/site-packages/numpy/core/include
-I/usr/include/freetype2 -I/usr/include -I. -I/usr/include/python3.2 -c
src/ft2font.cpp -o build-3.2/temp.linux-x86_64-3.2/src/ft2font.o
---------------------------

Note that there is a missing line for the 3.2 build as it does not
create the build-3.2/temp.linux-x86_64-3.2/CXX directory.

Hence, my question is whether this behaviour is due to some code in
the MPL building system, or should I research my ebuild more?

Good research! Unfortunately, this beyond my level. Keep us posted.
I would suspect some bug in distutils, but this can be completely off.
  Normally the obvious guesses are rather wrong in such cases as this.

How does the ebuild work? Does it invoke setup.py? If yes, maybe
matplotlib installs the CXX dir s.t. it does not work for py3k? Maybe
just the attribute matplotlib is monkeypatching. if at all, changed
its name? All this ideas do not claim that they explain it, they just
are meant to help you being let to the real cause of the malfunction.

Good luck, and a lot of inspiration
Friedrich

P.S.: "Luck – has nothing to do with it. Faith, and hard work, girl,
'cause I'll be damned if ..." [Final Fantasy]

Hi all,

      > How does the ebuild work? Does

it invoke setup.py? If yes, maybe

  > matplotlib installs the CXX dir s.t. it does not work for

py3k?

Sorry for making the noise, I found the problem, actually it was my

ebuild which removed the CXX folder after the 2.7 python succeeded

to

build. I do not know the reasons behind this though.

No I do not have the error there, but I have elsewhere. :) Here it

is:

···

On 24/11/11 23:02, Friedrich Romstedt wrote:

------------------

x86_64-pc-linux-gnu-g++ -pthread -march=native -O2

-fno-strict-aliasing -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API
-DPYCXX_ISO_CPP_LIB=1 -DPYCXX_PYTHON_2TO3=1 -I/usr/local/include
-I/usr/include -I/usr/include -I.
-I/usr/lib64/python3.2/site-packages/numpy/core/include -Isrc
-Iagg24/include -I.
-I/usr/lib64/python3.2/site-packages/numpy/core/include
-I/usr/include/freetype2 -I/usr/include -I. -I/usr/include -I.
-I/usr/include/pygtk-2.0 -I/usr/include/gtk-2.0
-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include
-I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0
-I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0
-I/usr/include/pango-1.0 -I/usr/include/pixman-1
-I/usr/include/libpng15 -I/usr/include/libdrm
-I/usr/lib64/python3.2/site-packages/numpy/core/include
-I/usr/include/python3.2 -c src/_gtkagg.cpp -o
build-3.2/temp.linux-x86_64-3.2/src/_gtkagg.o

src/_gtkagg.cpp: In function ‘PyObject* init_gtkagg()’:

src/_gtkagg.cpp:137:5: error: return-statement with no value, in

function returning ‘PyObject*’

src/_gtkagg.cpp:138:5: error: ‘PyCObject_Check’ was not declared in

this scope

src/_gtkagg.cpp:138:5: error: ‘PyCObject_AsVoidPtr’ was not declared

in this scope

src/_gtkagg.cpp:138:5: error: return-statement with no value, in

function returning ‘PyObject*’

src/_gtkagg.cpp:138:5: error: return-statement with no value, in

function returning ‘PyObject*’

------------------

If anybody could explain why I am getting the above. Is it because

of

a wrong version of PyGobject (2.28.6) or PyGtk (2.24.0) ? Or is it

because the GTK Backend is not yet ported to Python 3?

Also, could anybody tell me what differences are there in

dependencies

between Py2 and Py3 versions of MPL?

Cheers,

Ignas A.

--

Q: Because it reverses the logical flow of conversation.

A: Why is putting a reply at the top of the message frowned upon?