Opened 13 years ago

Last modified 13 years ago

#28703 closed defect

Python 2.6 (Universal) does not honor 'arch -i386' command at runtime — at Version 1

Reported by: tcwan (TC Wan) Owned by: mcalhoun@…
Priority: Normal Milestone:
Component: ports Version: 1.9.2
Keywords: Cc:
Port: python26

Description (last modified by jmroot (Joshua Root))

I have built Python 2.6 and 2.7 with +universal. I need to execute 32-bit Python for a specific module.

tcmac$ file /opt/local/bin/python2.*
/opt/local/bin/python2.6:        Mach-O universal binary with 2 architectures
/opt/local/bin/python2.6 (for architecture x86_64):	Mach-O 64-bit executable x86_64
/opt/local/bin/python2.6 (for architecture i386):	Mach-O executable i386
/opt/local/bin/python2.6-config: a /opt/local/Library/Frameworks/P script text executable
/opt/local/bin/python2.7:        Mach-O universal binary with 2 architectures
/opt/local/bin/python2.7 (for architecture x86_64):	Mach-O 64-bit executable x86_64
/opt/local/bin/python2.7 (for architecture i386):	Mach-O executable i386
/opt/local/bin/python2.7-config: a /opt/local/Library/Frameworks/P script text executable

However, when using the arch command to specify the runtime architecture, only Python 2.7 honors this, it does not work with Python 2.6.

tcmac$ arch -i386 /opt/local/bin/python2.6 
Python 2.6.6 (r266:84292, Mar  4 2011, 09:28:43) 
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.maxsize
9223372036854775807
>>> 
tcmac$ arch -i386 /opt/local/bin/python2.7 
Python 2.7.1 (r271:86832, Mar  1 2011, 09:22:53) 
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.maxsize
2147483647
>>> 

Change History (1)

comment:1 Changed 13 years ago by jmroot (Joshua Root)

Description: modified (diff)
Owner: changed from macports-tickets@… to mcalhoun@…
Port: python26 added

Please remember to preview and use WikiFormatting, fill in the Port field, and cc the maintainer.

This isn't a problem specific to the port; the official binaries behave the same. So I doubt it's going to be fixed. Run python like this: arch -i386 /opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python

Note: See TracTickets for help on using tickets.