hello -- i'm trying to embed python in my software so that i don't
have to worry about which version clients have installed. this is
causing lots of random errors on OSX 10.6.3, but appears to work just
fine on linux... here's as far as I've gotten...

1) I added this to my Jamroot:

using python
      : 2.6
      : python/bin/python2.6
      : python/include/python2.6
      : python/lib/python2.6/config
      :
      ;

2) I downloaded python 2.6.5 .tar.bz2 and put it in my source tree.
I've added these steps to my Makefile:
 tar -xjf $(PYTHON_DIR)/Python-2.6.5.tar.bz2 -C $(PYTHON_DIR)
./configure --prefix=$(CURDIR)/$(PYTHON_DIR)
make && make install
cp $(PYTHON_DIR)/lib/python2.6/config/libpython2.6.a
$(PYTHON_DIR)/lib/python2.6/config/libpython2.6.dylib

where the last step seemed necessary because OSX requires a dynamic
library, and if it doesn't find one, it will link to the system's
framework version instead, which is a different version of python.

3) Patched my python according to this bug (because _environ wasn't
being included if i'm not building a framework, thanks Ronald for
finding this for me)
http://bugs.python.org/issue1602133

4) Compiles & links with no errors or warnings. Paths all appear to be
ok when I do bjam -d2

5) Inspecting my build (to make sure everything is 64 bit):
> lipo -detailed_info libboost_python.dylib
input file libboost_python.dylib is not a fat file
Non-fat file: libboost_python.dylib is architecture: x86_64

> lipo -detailed_info libpython2.6.dylib
input file libpython2.6.dylib is not a fat file
Non-fat file: libpython2.6.dylib is architecture: x86_64

> lipo -detailed_info python
input file python is not a fat file
Non-fat file: python is architecture: x86_64

> otool -L libboost_python.dylib
libboost_python.dylib:
        libboost_python.dylib (compatibility version 0.0.0, current version 
0.0.0)
        /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current 
version 7.9.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 125.0.1)

(should I see libpython2.6.dylib listed here????)

6) Running my code:
$trunk/src/python/bin/python -v myscript.py
....
Fatal Python error: Interpreter not initialized (version mismatch?)
../triad.sh: line 19: 56200 Abort trap
$trunk/src/python/bin/python -v $@

7) Trying to force load my library:
setenv DYLD_INSERT_LIBRARIES
/Users/amos/triad/trunk/src/python/lib/python2.6/config/libpython2.6.dylib
$trunk/src/python/bin/python -v myscript.py
dyld: could not load inserted library:
/Users/amos/triad/trunk/src/python/lib/python2.6/config/libpython2.6.dylib

Trace/BPT trap


8) I tried this:
./configure --enable-universalsdk --with-universal-archs=intel
--prefix=$(CURDIR)/$(PYTHON_DIR)
and it didn't work either. next up, i'll figure out the framework issue here:
http://bugs.python.org/issue3646
so i can try that option too.





amos.
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG

Reply via email to