[Pythonmac-SIG] python library missing _environ symbol

Amos Anderson nitroamos at gmail.com
Wed May 5 09:43:21 CEST 2010


i'm having trouble with my non-standard way of building python. what I
want to do is bundle Python-2.6.5.tar.bz2 with my software, so that
the version i want can be built along with my code, which might happen
on osx or linux etc. part of my software includes C++ extensions w/
boost, so my build system needs to link to the correct local version
of python. here's (one of) the problem i've run into.

./configure --enable-universalsdk --with-universal-archs=intel

then building my project I get:

Undefined symbols:
  "_environ", referenced from:
      _initposix in libpython2.6.dylib(posixmodule.o)
     (maybe you meant: cstring=ignore_environment)
ld: symbol(s) not found
collect2: ld returned 1 exit status
...failed darwin.link.dll
boost/boost_1_42_0/bin.v2/libs/python/build/darwin-4.2.1/release-triad/libboost_python.dylib...

and sure enough:
> nm libpython2.6.a | grep environ
nm: no name list
                 U _environ


now, i can get _environ if I do it this way:
./configure --enable-framework --enable-universalsdk
--with-universal-archs=intel

> nm libpython2.6.a | grep environ
nm: no name list
0000000000025768 b _environ


so it appears to be the case that the _environ symbol is included if
--enable-framework is added to the configure options, but is undefined
if --enable-framework is not added. now, if I were actually planning
on installing this in /Library/Frameworks/ then this behavior would be
ok. however, because i want to treat my python install in an OS
agnostic way, I don't want to use the --enable-framework option.

is there another way to do this? i'm not enthusiastic about monkeying
around in Python-2.6.5.tar.bz2 and then zipping it back up again, but
if that's the only way then so be it... it seems to be the case that
configure has some setting that's triggered with frameworks, so if
someone could help me figure out how to trigger that setting in a more
general context, then that might be the easiest thing to do.


thanks!

amos.


More information about the Pythonmac-SIG mailing list