[tor-commits] [tor-browser-bundle/master] Force 32-bit Python 2.6 on Mac.

mikeperry at torproject.org mikeperry at torproject.org
Tue Jan 21 04:47:04 UTC 2014


commit 360ee669bb080bdf53c16d105d781232c09e267c
Author: David Fifield <david at bamsoftware.com>
Date:   Fri Nov 15 07:18:04 2013 +0000

    Force 32-bit Python 2.6 on Mac.
    
    It appears that we must use a Python that is compatible with the
    compiled Python modules we provide. Apple's custom python binary
    provides environment variables to control the version and word length:
    	VERSIONER_PYTHON_VERSION=2.6
    	VERSIONER_PYTHON_PREFER_32_BIT=yes
    See python(1).
    
    With neither of these variables set, on OS X 10.9, importing a module
    results in:
    
    ImportError: dlopen(TorBrowserBundle_en-US.app/Tor/Crypto/Cipher/_AES.so, 2): no suitable image found.  Did find:
            /Users/david/TorBrowserBundle_en-US.app/Tor/Crypto/Cipher/_AES.so: mach-o, but wrong architecture
    
    The same happens if VERSIONER_PYTHON_VERSION=2.6 but
    VERSIONER_PYTHON_PREFER_32_BIT is unset.
    
    Setting VERSIONER_PYTHON_PREFER_32_BIT=yes without setting
    VERSIONER_PYTHON_VERSION causes this message in the terminal along with
    a popup offering to send a crash report:
    
    Fatal Python error: Interpreter not initialized (version mismatch?)
    Abort trap: 6
    
    Setting both variables seems to work.
    
    This issue may be a manifestation of that our compiled modules are
    i386-only:
    
    $ file Crypto/Cipher/_AES.so
    Crypto/Cipher/_AES.so: Mach-O dynamically linked shared library i386
    
    Whereas /usr/bin/python is both 32-bit and 64-bit. The 2.x series of PT
    bundles used fat shared objects and didn't show this problem.
---
 Bundle-Data/mac-tor.sh |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/Bundle-Data/mac-tor.sh b/Bundle-Data/mac-tor.sh
index 5f7c099..fb9c4f4 100755
--- a/Bundle-Data/mac-tor.sh
+++ b/Bundle-Data/mac-tor.sh
@@ -1,4 +1,7 @@
 #!/bin/sh
+# Compiled Python modules require a compatible Python, which means 32-bit 2.6.
+export VERSIONER_PYTHON_VERSION=2.6
+export VERSIONER_PYTHON_PREFER_32_BIT=yes
 # Set the current working directory to the directory containing this executable,
 # so that pluggable transport executables can be given with relative paths. This
 # works around a change in OS X 10.9, where the current working directory is





More information about the tor-commits mailing list