Problem building matplotlib-0.87 on Linux

I tried to build matplot lib (both 0.87 and 0.86.2) on Ubuntu Linux 5.10. The
first set of error messages convinced me to install the Tcl and Tk dev
packages.

The second run of errors is just really weird, and I'm not sure how to fix it.

Thanks,
Antoine

First run or errors

···

===============
src/_tkagg.cpp:28:18: error: tk.h: No such file or directory
src/_tkagg.cpp:36: error: ISO C++ forbids declaration of ‘Tcl_Interp’ with no
type
src/_tkagg.cpp:36: error: expected ‘;’ before ‘*’ token
src/_tkagg.cpp:40: error: ‘ClientData’ was not declared in this scope
src/_tkagg.cpp:40: error: ‘Tcl_Interp’ was not declared in this scope
src/_tkagg.cpp:40: error: ‘interp’ was not declared in this scope
src/_tkagg.cpp:41: error: expected primary-expression before ‘int’
src/_tkagg.cpp:41: error: expected primary-expression before ‘char’
src/_tkagg.cpp:41: error: initializer expression list treated as compound
expression
src/_tkagg.cpp:42: error: expected ‘,’ or ‘;’ before ‘{’ token
src/_tkagg.cpp: In function ‘PyObject* _tkinit(PyObject*, PyObject*)’:
src/_tkagg.cpp:176: error: ‘Tcl_Interp’ was not declared in this scope
src/_tkagg.cpp:176: error: ‘interp’ was not declared in this scope
src/_tkagg.cpp:185: error: expected primary-expression before ‘)’ token
src/_tkagg.cpp:185: error: expected `;' before ‘arg’
src/_tkagg.cpp:190: error: ‘struct TkappObject’ has no member named ‘interp’
src/_tkagg.cpp:196: error: ‘Tcl_CmdProc’ was not declared in this scope
src/_tkagg.cpp:196: error: expected primary-expression before ‘)’ token
src/_tkagg.cpp:197: error: ‘ClientData’ was not declared in this scope
src/_tkagg.cpp:197: error: ‘Tcl_CmdDeleteProc’ was not declared in this scope
src/_tkagg.cpp:197: error: expected primary-expression before ‘)’ token
src/_tkagg.cpp:197: error: ‘Tcl_CreateCommand’ was not declared in this scope
./CXX/Extensions.hxx: In constructor
‘Py::PythonExtension<T>::PythonExtension() [with T = BufferRegion]’:

Second run of errors

g++ -pthread -shared build/temp.linux-i686-2.4/src/_tkagg.o
build/temp.linux-i686-2.4/CXX/cxx_extensions.o
build/temp.linux-i686-2.4/CXX/cxxsupport.o
build/temp.linux-i686-2.4/CXX/IndirectPythonInterface.o
build/temp.linux-i686-2.4/CXX/cxxextensions.o -L/usr/lib/tcl8.4/../ - L / u s
r / l i b / t k 8 . 4 / . . / -L/usr/local/lib -L/usr/local/lib -ltk8.4
-ltcl8.4 -lpng -lz -lstdc++ -lm -lfreetype -lz -lstdc++ -lm -o
build/lib.linux-i686-2.4/matplotlib/backends/_tkagg.so
g++: L: No such file or directory
g++: u: No such file or directory
g++: s: No such file or directory
g++: r: No such file or directory
g++: l: No such file or directory
g++: i: No such file or directory
g++: b: No such file or directory
g++: t: No such file or directory
g++: k: No such file or directory
g++: 8: No such file or directory
g++: 4: No such file or directory
g++: -E or -x required when input is from standard input
g++: L: No such file or directory
g++: u: No such file or directory
g++: s: No such file or directory
g++: r: No such file or directory
g++: l: No such file or directory
g++: i: No such file or directory
g++: b: No such file or directory
g++: t: No such file or directory
g++: k: No such file or directory
g++: 8: No such file or directory
g++: 4: No such file or directory
g++: -E or -x required when input is from standard input
error: Command "g++ -pthread -shared build/temp.linux-i686-2.4/src/_tkagg.o
build/temp.linux-i686-2.4/CXX/cxx_extensions.o
build/temp.linux-i686-2.4/CXX/cxxsupport.o
build/temp.linux-i686-2.4/CXX/IndirectPythonInterface.o
build/temp.linux-i686-2.4/CXX/cxxextensions.o -L/usr/lib/tcl8.4/../ - L / u s
r / l i b / t k 8 . 4 / . . / -L/usr/local/lib -L/usr/local/lib -ltk8.4
-ltcl8.4 -lpng -lz -lstdc++ -lm -lfreetype -lz -lstdc++ -lm -o
build/lib.linux-i686-2.4/matplotlib/backends/_tkagg.so" failed with exit
status 1

Antoine Latter wrote:

I tried to build matplot lib (both 0.87 and 0.86.2) on Ubuntu Linux 5.10. The
first set of error messages convinced me to install the Tcl and Tk dev
packages.

The second run of errors is just really weird, and I'm not sure how to fix it.

Second run of errors

g++ -pthread -shared build/temp.linux-i686-2.4/src/_tkagg.o
build/temp.linux-i686-2.4/CXX/cxx_extensions.o
build/temp.linux-i686-2.4/CXX/cxxsupport.o
build/temp.linux-i686-2.4/CXX/IndirectPythonInterface.o
build/temp.linux-i686-2.4/CXX/cxxextensions.o -L/usr/lib/tcl8.4/../ - L / u s
r / l i b / t k 8 . 4 / . . / -L/usr/local/lib -L/usr/local/lib -ltk8.4
-ltcl8.4 -lpng -lz -lstdc++ -lm -lfreetype -lz -lstdc++ -lm -o
build/lib.linux-i686-2.4/matplotlib/backends/_tkagg.so
g++: L: No such file or directory
g++: u: No such file or directory
g++: s: No such file or directory
g++: r: No such file or directory
g++: l: No such file or directory
g++: i: No such file or directory
g++: b: No such file or directory
g++: t: No such file or directory
g++: k: No such file or directory
g++: 8: No such file or directory
g++: 4: No such file or directory
g++: -E or -x required when input is from standard input
g++: L: No such file or directory
g++: u: No such file or directory
g++: s: No such file or directory
g++: r: No such file or directory
g++: l: No such file or directory
g++: i: No such file or directory
g++: b: No such file or directory
g++: t: No such file or directory
g++: k: No such file or directory
g++: 8: No such file or directory
g++: 4: No such file or directory
g++: -E or -x required when input is from standard input
error: Command "g++ -pthread -shared build/temp.linux-i686-2.4/src/_tkagg.o
build/temp.linux-i686-2.4/CXX/cxx_extensions.o
build/temp.linux-i686-2.4/CXX/cxxsupport.o
build/temp.linux-i686-2.4/CXX/IndirectPythonInterface.o
build/temp.linux-i686-2.4/CXX/cxxextensions.o -L/usr/lib/tcl8.4/../ - L / u s
r / l i b / t k 8 . 4 / . . / -L/usr/local/lib -L/usr/local/lib -ltk8.4
-ltcl8.4 -lpng -lz -lstdc++ -lm -lfreetype -lz -lstdc++ -lm -o
build/lib.linux-i686-2.4/matplotlib/backends/_tkagg.so" failed with exit
status 1

Whatever you set to '/usr/lib/tk8.4/../' needs to be a list
['/usr/lib/tk8.4/../'] and not a string.

···

--
Robert Kern
robert.kern@...287...

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
  -- Richard Harter

Hi Antoine,

I had exactly the same problem. I tracked it and found that in the
setupext.py, when I tried to print the module.library_dirs variable after the
command:
module.library_dirs.extend([o.tcl_lib, o.tk_lib])
I got:
['/usr/share/tcl/tcl8.4/../', u'/usr/share/tcl/tk8.4/../']
The string containing the tk library path is a unicode one for some reason I
do not understand. I changed then the line which fills this string. It is in
the function find_tcltk(): of setupext.py:
o.tk_lib = os.path.join(tk.getvar('tk_library'), '../')
I replaced it by:
o.tk_lib = os.path.join(str(tk.getvar('tk_library')), '../')

And that did the trick.
I really don't understand why the tcl library string is not affected by the
same problem anyway...

Emmanuel

···

Le Vendredi 3 Mars 2006 02:48, Antoine Latter a écrit :

I tried to build matplot lib (both 0.87 and 0.86.2) on Ubuntu Linux 5.10.
The first set of error messages convinced me to install the Tcl and Tk dev
packages.

The second run of errors is just really weird, and I'm not sure how to fix
it.

Thanks,
Antoine

First run or errors

src/_tkagg.cpp:28:18: error: tk.h: No such file or directory
src/_tkagg.cpp:36: error: ISO C++ forbids declaration of ‘Tcl_Interp’ with
no type
src/_tkagg.cpp:36: error: expected ‘;’ before ‘*’ token
src/_tkagg.cpp:40: error: ‘ClientData’ was not declared in this scope
src/_tkagg.cpp:40: error: ‘Tcl_Interp’ was not declared in this scope
src/_tkagg.cpp:40: error: ‘interp’ was not declared in this scope
src/_tkagg.cpp:41: error: expected primary-expression before ‘int’
src/_tkagg.cpp:41: error: expected primary-expression before ‘char’
src/_tkagg.cpp:41: error: initializer expression list treated as compound
expression
src/_tkagg.cpp:42: error: expected ‘,’ or ‘;’ before ‘{’ token
src/_tkagg.cpp: In function ‘PyObject* _tkinit(PyObject*, PyObject*)’:
src/_tkagg.cpp:176: error: ‘Tcl_Interp’ was not declared in this scope
src/_tkagg.cpp:176: error: ‘interp’ was not declared in this scope
src/_tkagg.cpp:185: error: expected primary-expression before ‘)’ token
src/_tkagg.cpp:185: error: expected `;' before ‘arg’
src/_tkagg.cpp:190: error: ‘struct TkappObject’ has no member named
‘interp’ src/_tkagg.cpp:196: error: ‘Tcl_CmdProc’ was not declared in this
scope src/_tkagg.cpp:196: error: expected primary-expression before ‘)’
token src/_tkagg.cpp:197: error: ‘ClientData’ was not declared in this
scope src/_tkagg.cpp:197: error: ‘Tcl_CmdDeleteProc’ was not declared in
this scope src/_tkagg.cpp:197: error: expected primary-expression before
‘)’ token src/_tkagg.cpp:197: error: ‘Tcl_CreateCommand’ was not declared
in this scope ./CXX/Extensions.hxx: In constructor
‘Py::PythonExtension<T>::PythonExtension() [with T = BufferRegion]’:

Second run of errors

g++ -pthread -shared build/temp.linux-i686-2.4/src/_tkagg.o
build/temp.linux-i686-2.4/CXX/cxx_extensions.o
build/temp.linux-i686-2.4/CXX/cxxsupport.o
build/temp.linux-i686-2.4/CXX/IndirectPythonInterface.o
build/temp.linux-i686-2.4/CXX/cxxextensions.o -L/usr/lib/tcl8.4/../ - L / u
s r / l i b / t k 8 . 4 / . . / -L/usr/local/lib -L/usr/local/lib -ltk8.4
-ltcl8.4 -lpng -lz -lstdc++ -lm -lfreetype -lz -lstdc++ -lm -o
build/lib.linux-i686-2.4/matplotlib/backends/_tkagg.so
g++: L: No such file or directory
g++: u: No such file or directory
g++: s: No such file or directory
g++: r: No such file or directory
g++: l: No such file or directory
g++: i: No such file or directory
g++: b: No such file or directory
g++: t: No such file or directory
g++: k: No such file or directory
g++: 8: No such file or directory
g++: 4: No such file or directory
g++: -E or -x required when input is from standard input
g++: L: No such file or directory
g++: u: No such file or directory
g++: s: No such file or directory
g++: r: No such file or directory
g++: l: No such file or directory
g++: i: No such file or directory
g++: b: No such file or directory
g++: t: No such file or directory
g++: k: No such file or directory
g++: 8: No such file or directory
g++: 4: No such file or directory
g++: -E or -x required when input is from standard input
error: Command "g++ -pthread -shared build/temp.linux-i686-2.4/src/_tkagg.o
build/temp.linux-i686-2.4/CXX/cxx_extensions.o
build/temp.linux-i686-2.4/CXX/cxxsupport.o
build/temp.linux-i686-2.4/CXX/IndirectPythonInterface.o
build/temp.linux-i686-2.4/CXX/cxxextensions.o -L/usr/lib/tcl8.4/../ - L / u
s r / l i b / t k 8 . 4 / . . / -L/usr/local/lib -L/usr/local/lib -ltk8.4
-ltcl8.4 -lpng -lz -lstdc++ -lm -lfreetype -lz -lstdc++ -lm -o
build/lib.linux-i686-2.4/matplotlib/backends/_tkagg.so" failed with exit
status 1

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live
webcast and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
Emmanuel Pécontal

CRAL - Observatoire de Lyon
9, Av. Charles Andre
F-69561 Saint Genis Laval Cedex

tel (33) (0)4.78.86.83.76 - fax (33) (0)4.78.86.83.86

email : pecontal@...419...
~

Hi Antoine,

I had exactly the same problem. I tracked it and found that in the
setupext.py, when I tried to print the module.library_dirs variable after
the command:
module.library_dirs.extend([o.tcl_lib, o.tk_lib])
I got:
['/usr/share/tcl/tcl8.4/../', u'/usr/share/tcl/tk8.4/../']
The string containing the tk library path is a unicode one for some reason
I do not understand. I changed then the line which fills this string. It is
in the function find_tcltk(): of setupext.py:
o.tk_lib = os.path.join(tk.getvar('tk_library'), '../')
I replaced it by:
o.tk_lib = os.path.join(str(tk.getvar('tk_library')), '../')

And that did the trick.
I really don't understand why the tcl library string is not affected by the
same problem anyway...

But this fix was committed back on Feb 2, and is included in mpl-0.87.

···

On Friday 03 March 2006 3:10 am, Emmanuel Pecontal wrote:

Le Vendredi 3 Mars 2006 02:48, Antoine Latter a écrit :
> I tried to build matplot lib (both 0.87 and 0.86.2) on Ubuntu Linux 5.10.
> The first set of error messages convinced me to install the Tcl and Tk
> dev packages.
>
> The second run of errors is just really weird, and I'm not sure how to
> fix it.
>
> Thanks,
> Antoine
>
>
>
> First run or errors
> ===============
> src/_tkagg.cpp:28:18: error: tk.h: No such file or directory
> src/_tkagg.cpp:36: error: ISO C++ forbids declaration of ‘Tcl_Interp’
> with no type
> src/_tkagg.cpp:36: error: expected ‘;’ before ‘*’ token
> src/_tkagg.cpp:40: error: ‘ClientData’ was not declared in this scope
> src/_tkagg.cpp:40: error: ‘Tcl_Interp’ was not declared in this scope
> src/_tkagg.cpp:40: error: ‘interp’ was not declared in this scope
> src/_tkagg.cpp:41: error: expected primary-expression before ‘int’
> src/_tkagg.cpp:41: error: expected primary-expression before ‘char’
> src/_tkagg.cpp:41: error: initializer expression list treated as compound
> expression
> src/_tkagg.cpp:42: error: expected ‘,’ or ‘;’ before ‘{’ token
> src/_tkagg.cpp: In function ‘PyObject* _tkinit(PyObject*, PyObject*)’:
> src/_tkagg.cpp:176: error: ‘Tcl_Interp’ was not declared in this scope
> src/_tkagg.cpp:176: error: ‘interp’ was not declared in this scope
> src/_tkagg.cpp:185: error: expected primary-expression before ‘)’ token
> src/_tkagg.cpp:185: error: expected `;' before ‘arg’
> src/_tkagg.cpp:190: error: ‘struct TkappObject’ has no member named
> ‘interp’ src/_tkagg.cpp:196: error: ‘Tcl_CmdProc’ was not declared in
> this scope src/_tkagg.cpp:196: error: expected primary-expression before
> ‘)’ token src/_tkagg.cpp:197: error: ‘ClientData’ was not declared in
> this scope src/_tkagg.cpp:197: error: ‘Tcl_CmdDeleteProc’ was not
> declared in this scope src/_tkagg.cpp:197: error: expected
> primary-expression before ‘)’ token src/_tkagg.cpp:197: error:
> ‘Tcl_CreateCommand’ was not declared in this scope ./CXX/Extensions.hxx:
> In constructor
> ‘Py::PythonExtension<T>::PythonExtension() [with T = BufferRegion]’:
> ===============
>
>
>
> Second run of errors
> ===============
> g++ -pthread -shared build/temp.linux-i686-2.4/src/_tkagg.o
> build/temp.linux-i686-2.4/CXX/cxx_extensions.o
> build/temp.linux-i686-2.4/CXX/cxxsupport.o
> build/temp.linux-i686-2.4/CXX/IndirectPythonInterface.o
> build/temp.linux-i686-2.4/CXX/cxxextensions.o -L/usr/lib/tcl8.4/../ - L /
> u s r / l i b / t k 8 . 4 / . . / -L/usr/local/lib -L/usr/local/lib
> -ltk8.4 -ltcl8.4 -lpng -lz -lstdc++ -lm -lfreetype -lz -lstdc++ -lm -o
> build/lib.linux-i686-2.4/matplotlib/backends/_tkagg.so
> g++: L: No such file or directory
> g++: u: No such file or directory
> g++: s: No such file or directory
> g++: r: No such file or directory
> g++: l: No such file or directory
> g++: i: No such file or directory
> g++: b: No such file or directory
> g++: t: No such file or directory
> g++: k: No such file or directory
> g++: 8: No such file or directory
> g++: 4: No such file or directory
> g++: -E or -x required when input is from standard input
> g++: L: No such file or directory
> g++: u: No such file or directory
> g++: s: No such file or directory
> g++: r: No such file or directory
> g++: l: No such file or directory
> g++: i: No such file or directory
> g++: b: No such file or directory
> g++: t: No such file or directory
> g++: k: No such file or directory
> g++: 8: No such file or directory
> g++: 4: No such file or directory
> g++: -E or -x required when input is from standard input
> error: Command "g++ -pthread -shared
> build/temp.linux-i686-2.4/src/_tkagg.o
> build/temp.linux-i686-2.4/CXX/cxx_extensions.o
> build/temp.linux-i686-2.4/CXX/cxxsupport.o
> build/temp.linux-i686-2.4/CXX/IndirectPythonInterface.o
> build/temp.linux-i686-2.4/CXX/cxxextensions.o -L/usr/lib/tcl8.4/../ - L /
> u s r / l i b / t k 8 . 4 / . . / -L/usr/local/lib -L/usr/local/lib
> -ltk8.4 -ltcl8.4 -lpng -lz -lstdc++ -lm -lfreetype -lz -lstdc++ -lm -o
> build/lib.linux-i686-2.4/matplotlib/backends/_tkagg.so" failed with exit
> status 1
> ===============
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting
> language that extends applications into web and mobile media. Attend the
> live webcast and join the prime developer group breaking into this new
> coding territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> matplotlib-users List Signup and Options

--
Darren S. Dale, Ph.D.
dd55@...163...

I came across the same problem, but was able to
overcome it by setting the LANG environment
variable to "C" rather than "en_US.UTF-8"

Cheers,
  Dave