[Pythonmac-SIG] _program_name not found: dynamic libraries in Panther's Python

Nicholas Riley njriley at uiuc.edu
Wed Dec 10 03:11:33 EST 2003


On Tue, Dec 09, 2003 at 11:34:00PM -0600, Geoff Ghose wrote:
> [piglet:~/Development/pybliographer-1.0.11/compiled] geoff% 

Why are you using such an old version?  1.2.1 is current.

> The trap happens after an import _recode where recode is a compiled
> Python module named _recodemodule.so

Looks like there is something wrong with your install of GNU recode.
After some investigation, I'm surprised it ever worked for you; GNU
recode is not exactly OS X-friendly.

I guess you didn't install GNU recode with Fink, because the Fink
package is incomplete.  There's no info file for GNU recode in the
10.3 Fink distribution (for a good reason, as I later discovered), but
I tried copying the one from the 10.2-gcc3.3 distribution and it
compiled fine - but it didn't install 'recode.h' or librecode.

I tried compiling recode from source, but GNU recode was so old it
used a version of GNU libtool which didn't recognize Mac OS X.
Running glibtoolize to fix the problem started a chain of events that
led me to needing to patch recode.  Apply the attached patch.

Also, you need to apply the patch on this page, otherwise you get an
error much later, when running the test suite for python-bibtex:

	<http://www.pybliographer.org/help/recode>

After applying the patches, run in the source directory:

 % cp /usr/share/aclocal/libtool.m4 acinclude.m4
 % LIBTOOLIZE=glibtoolize autoreconf --force --install
 % LDFLAGS="-L/sw/lib" CPPFLAGS="-I/sw/include -Dgetopt=rc_getopt -Dopterr=rc_opterr -Doptind=rc_optind -Doptopt=rc_optopt" ./configure

(The LIBTOOLIZE=glibtoolize is a workaround for a bug in autoreconf as
Apple ships it; I filed Radar 3505843 on it.)

The -D parameters came from Fink's recode package; without them, you
get a conflict with libSystem's getopt routines at link time.  But
then there's a link error for "_error", which is in libreco.a which
because of a legitimate, not even Mac OS X-only recode bug, installed.

	<http://www.mail-archive.com/fink-devel@lists.sourceforge.net/msg05694.html>

This also conveniently explains why Fink doesn't have a current
package for recode. :/ I didn't have any more luck massaging libtool
than Ben Hines did in the thread referenced above, so I simply
manually installed and ran ranlib on recode-3.6/lib/libreco.a.

glib2 was also necessary, so I installed that with apt.

python-bibtex had more problems, the first being Fink's fault; there
was a namespace conflict between gettext-dev and libiconv.  Removing
gettext-dev, compiling gettext 0.13 from scratch (slow!), and doing a
'LDFLAGS="-lreco" python setup.py build' fixes the problem.

I didn't bother to compile pybliographer, because it requires all of
GNOME 2, which I do not have and do not wish installed.  You would
probably have to compile gnome-python yourself rather than using Fink,
so it links with the OS X Python rather than the Fink Python.

The moral of the story: GNU recode is old, crufty, broken and
seemingly unmaintained.  BibDesk is sure a lot easier to install.

-- 
=Nicholas Riley <njriley at uiuc.edu> | <http://www.uiuc.edu/ph/www/njriley>
-------------- next part --------------
diff -ur recode-3.6/configure.in recode-3.6+njr/configure.in
--- recode-3.6/configure.in	Wed Jan  3 09:50:54 2001
+++ recode-3.6+njr/configure.in	Wed Dec 10 00:25:33 2003
@@ -32,7 +32,6 @@
 
 jm_FUNC_MALLOC
 jm_FUNC_REALLOC
-AC_SUBST(LIBOBJS)
 
 AC_CANONICAL_HOST
 jm_LANGINFO_CODESET
@@ -40,15 +39,6 @@
 
 AM_WITH_DMALLOC
 fp_WITH_GETTEXT
-
-# This is necessary so that .o files in LIBOBJS are also built via
-# the ANSI2KNR-filtering rules.
-LIBOBJS=`echo $LIBOBJS | sed 's/\.o /\$U.o /g;s/\.o$/\$U.o/'`
-
-LTALLOCA=`echo $ALLOCA | sed 's/\.o/.lo/g'`
-AC_SUBST(LTALLOCA)
-LTLIBOBJS=`echo $LIBOBJS | sed 's/\.o /.lo /g;s/\.o$/.lo/'`
-AC_SUBST(LTLIBOBJS)
 
 AC_OUTPUT(Makefile contrib/Makefile doc/Makefile i18n/Makefile lib/Makefile
 libiconv/Makefile m4/Makefile src/Makefile tests/Makefile tests/atconfig)
diff -ur recode-3.6/m4/gettext.m4 recode-3.6+njr/m4/gettext.m4
--- recode-3.6/m4/gettext.m4	Wed Jan  3 10:37:56 2001
+++ recode-3.6+njr/m4/gettext.m4	Wed Dec 10 00:27:19 2003
@@ -76,7 +76,7 @@
       with_included_gettext=yes
     fi
     if test $with_included_gettext = yes; then
-      LIBOBJS="$LIBOBJS gettext.o"
+      AC_LIBOBJ([gettext])
       AC_DEFINE(HAVE_GETTEXT)
       AC_DEFINE(HAVE_DCGETTEXT)
     else
diff -ur recode-3.6/m4/malloc.m4 recode-3.6+njr/m4/malloc.m4
--- recode-3.6/m4/malloc.m4	Wed Aug  2 20:21:13 2000
+++ recode-3.6+njr/m4/malloc.m4	Wed Dec 10 00:26:53 2003
@@ -27,8 +27,7 @@
 	 jm_cv_func_working_malloc=no)
   ])
   if test $jm_cv_func_working_malloc = no; then
-    AC_SUBST(LIBOBJS)
-    LIBOBJS="$LIBOBJS malloc.$ac_objext"
+    AC_LIBOBJ([malloc])
     AC_DEFINE_UNQUOTED(malloc, rpl_malloc,
       [Define to rpl_malloc if the replacement function should be used.])
   fi
diff -ur recode-3.6/m4/realloc.m4 recode-3.6+njr/m4/realloc.m4
--- recode-3.6/m4/realloc.m4	Wed Aug  2 20:21:13 2000
+++ recode-3.6+njr/m4/realloc.m4	Wed Dec 10 00:26:42 2003
@@ -27,8 +27,7 @@
 	 jm_cv_func_working_realloc=no)
   ])
   if test $jm_cv_func_working_realloc = no; then
-    AC_SUBST(LIBOBJS)
-    LIBOBJS="$LIBOBJS realloc.$ac_objext"
+    AC_LIBOBJ([realloc])
     AC_DEFINE_UNQUOTED(realloc, rpl_realloc,
       [Define to rpl_realloc if the replacement function should be used.])
   fi


More information about the Pythonmac-SIG mailing list