[Pythonmac-SIG] python library missing _environ symbol
Ronald Oussoren
ronaldoussoren at mac.com
Wed May 5 22:15:11 CEST 2010
On 5 May, 2010, at 9:43, Amos Anderson wrote:
> 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.
This is probably related to <http://bugs.python.org/issue1602133>. There is no _environ symbol on MacOSX, it just happens to work with a framework build if you force single-level namespaces because Modules/posixmodule.c defines a local "environ" variable for framework builds.
Ronald
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3567 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20100505/b2949048/attachment.bin>
More information about the Pythonmac-SIG
mailing list