getting the lovely zope environment (python, postgresql, mysql) working on Leopard
I switched to Leopard on the very first day,… Finally I managed to get the lovely dev environment working :)
1.) Python: vanilla python didn’t build on Leopard
run configure
add “#define SETPGRP_HAVE_ARG 1″ to pyconfig.h
Note: on two of our machines we got a strange error. I didn’t manage to fix it :( (Probably someone knows what’s going on?)
>>> a=5
>>> round(a)
Bus error
2.) PostgreSQL: postgresql82 in MacPorts didn’t build as well. the patch at the macports trac helped:
— Portfile.orig 2007-10-30 11:49:08.000000000 +1100
+++ Portfile 2007-11-17 00:42:45.000000000 +1100
@@ -50,6 +50,7 @@
configure.cppflags-append “-I${worksrcpath}/src/interfaces/libpq”build.type gnu
+build.cmd “unset LD_PREBIND LD_PREBIND_ALLOW_OVERLAP && ${build.cmd}”
build.targettest.run yes
@@ -63,7 +64,7 @@post-build {
foreach contrib ${contribs} {
- system “cd ${worksrcpath}/contrib/${contrib}/ && ${build.cmd}”
+ system “cd ${worksrcpath}/contrib/${contrib}/ && unset LD_PREBIND LD_PREBIND_ALLOW_OVERLAP && make”
}
}@@ -71,7 +72,7 @@
foreach contrib ${contribs} {
system “echo contrib: \”${contrib}\”"
system “cd ${worksrcpath}/contrib/${contrib}/ && \
- ${build.cmd} install ${destroot.destdir} && touch DONE”
+ make install ${destroot.destdir} && touch DONE”
}
system “cd ${destroot}${prefix}/bin && ln -sf ${libdir}/bin/psql psql82″
file delete -force ${destroot}${prefix}/share/doc/${name} \
3) MySQLdb: had some troubles as well. The sourceforge tracker helped (patched tarball):
— _mysql.c.orig 2007-11-16 22:32:38.000000000 +0100
+++ _mysql.c 2007-11-16 22:33:42.000000000 +0100
@@ -34,9 +34,6 @@
#else
#include “my_config.h”
#endif
-#ifndef uint
-#define uint unsigned int
-#endif
#include “mysql.h”
#include “mysqld_error.h”
#include “errmsg.h”
@@ -481,8 +478,8 @@
#endif
char *host = NULL, *user = NULL, *passwd = NULL,
*db = NULL, *unix_socket = NULL;
- uint port = MYSQL_PORT;
- uint client_flag = 0;
+ unsigned int port = MYSQL_PORT;
+ unsigned int client_flag = 0;
static char *kwlist[] = { “host”, “user”, “passwd”, “db”, “port”,
“unix_socket”, “conv”,
“connect_timeout”, “compress”,
Hi,
Leopard has been a nightmare for me when it comes to python development. I get random crashes of python under Zope (albeit I’m using Zope 2.10.4/Plone 3.0.3, not pure Zope 3 as you guys).
I recompiled the whole macports stack, and that did not help. The same
behavior is confirmed on all our company’s macs (2 MB Pro, 2 MB).
mcdonc on #plone also has the same problems.
The problem occurs for example if you get unicode errors and try to print the offending value in pdb (crash), or if you get a infinite recursion (crash), or …
During my recompile-it-all sessions, I also got one case where “import sys; print sys.path” would crash with a bus error.
So, I’d very much like to know if you got the same errors, or see strange
stuff, or …
Stefan.
I use MacPorts for my Python install on Leopard (there’s a downloadable Leopard version that isn’t mentioned on their front page right now), and haven’t had any crash problems. Currently I’m using MacPorts for Python, and the rest using buildout.
I’ve been having similar sorts of experiences with Python 2.4.4. Simply stepping into pdb will cause a bus error.
The MacPorts build and vanilla build (with SETPGRP_HAVE_ARG fix) are both troubled for me.
The ‘Bus error’ thing has to do with your version of readline - the second line on the interactive prompt will die. I fixed it by updating MacPorts and then installing readline first and then python2.4. I’ve not had any problems since.
Yep, I can confirm Martin’s analysis: The random crashes on the interpreter are due to a faulty readline build in Leopard. The solution is to build your own readline with MacPorts and tell the Python build process about it. Andreas Jung has written down how: http://blog.zopyx.com/blog_ajung/archive/2007/11/02/compiling-readline-support-for-python-on-macosx
Thanks to Martin and Philipp. Installing the MacPorts readline then reinstalling the MacPorts python24 have solved the 2.4.4 bus error problem on Leopard for me.
I had the same problem with python2.4 and they also got resolved when installing the readline module first and then reinstalling python. However, I still receive ‘Bus errors’ (exactly as described in the post) when inserting a breakpoint into zope, so I basically cannot debug zope now. I also did a ‘make clean’, ‘configure’, ‘make’, ‘make install’ for zope after reinstalling python but that did not help either. Can somebody give me a clue what could still be wrong? Thank you.
balint, it sounds like you need to reinstall Zope using the correct version of python. Something like this should do the trick: configure –with-python=[path to the python that is working].