Opened 10 years ago

Closed 10 years ago

#44086 closed defect (fixed)

py-sip @4.16.1 installs files with wrong target architecture

Reported by: dliessi (Davide Liessi) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: phw@…, michaelld (Michael Dickens), cooljeanius (Eric Gallager)
Port: py-sip

Description

I installed MacPorts from source in /opt/macports-i386 following the instructions in the guide. I changed the CPU architecture target to build_arch i386 in macports.conf, then I installed py27-sip.

The file sip.so installed by py27-sip appears to have x86_64 as target architecture:

$ file /opt/macports-i386/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sip.so
/opt/macports-i386/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sip.so: Mach-O 64-bit x86_64 bundle

Importing sip in Python results in this error:

$ /opt/macports-i386/bin/python2.7
Python 2.7.7 (default, Jun 18 2014, 14:59:35) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sip
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/opt/macports-i386/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sip.so, 2): no suitable image found.  Did find:
	/opt/macports-i386/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sip.so: mach-o, but wrong architecture
>>> ^D

Attachments (2)

py27-sip_log.txt.bz2 (5.5 KB) - added by dliessi (Davide Liessi) 10 years ago.
see comment:2
py-sip_Portfile.diff (1.3 KB) - added by michaelld (Michael Dickens) 10 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 10 years ago by dliessi (Davide Liessi)

Forgot to say: I'm running Snow Leopard on a 64 bit capable CPU (Intel Core 2 Duo) with 32 bit kernel.

$ uname -mprsv
Darwin 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386 i386

comment:2 Changed 10 years ago by michaelld (Michael Dickens)

The SIP build system is probably not honoring environment flags, which is not a big surprise given that it uses Python for all parts of the build. Will you do the following:

sudo port clean py27-sip
sudo port destroot py27-sip
cp `port logfile py27-sip` ~/Desktop/py27-sip_log.txt
bzip2 ~/Desktop/py27-sip_log.txt

then attach the compressed logfile to this ticket. I doubt I'll be able to replicate your issue on my OS (10.8 and 10.9) -- SIP builds as +universal correctly for me as far as I can tell (just checked the actual binary files, and they are indeed "fat"). But, maybe the logfile will help.

Changed 10 years ago by dliessi (Davide Liessi)

Attachment: py27-sip_log.txt.bz2 added

see comment:2

comment:3 in reply to:  2 Changed 10 years ago by dliessi (Davide Liessi)

Replying to michaelld@…:

then attach the compressed logfile to this ticket.

Done.

comment:4 Changed 10 years ago by michaelld (Michael Dickens)

Thanks. I know the issue and have a fix. I'm attaching it as a patch here until I can get it checked in (Trac is not letting me do so right now). Here's how you apply it (I'll assume you've downloaded it to "~/Downloads/py-sip_Portfile.diff")

cd `port dir py-sip`
patch -p0 < ~/Downloads/py-sip_Portfile.diff
sudo port clean py*sip
sudo port -f uninstall `port installed py27-sip | sed -e 1d -e "s@(active)@@"`
sudo port install py27-sip

and, this time the build arch should (will!) be honored. It won't hurt to have SIP installed in this manner; when the update comes through "port selfupdate" should be smart enough to merge them correctly. You can always do:

cd `port dir py-sip`
patch -R -p0 < ~/Downloads/py-sip_Portfile.diff

to revert back to the original Portfile before doing a selfupdate.

Changed 10 years ago by michaelld (Michael Dickens)

Attachment: py-sip_Portfile.diff added

comment:5 Changed 10 years ago by dliessi (Davide Liessi)

I confirm that your patch works for me:

$ file /opt/macports-i386/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sip.so
/opt/macports-i386/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sip.so: Mach-O i386 bundle
$ /opt/macports-i386/bin/python2.7
Python 2.7.7 (default, Jun 18 2014, 14:59:35) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sip
>>>

Thanks!

comment:6 Changed 10 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

comment:7 Changed 10 years ago by michaelld (Michael Dickens)

Resolution: fixed
Status: newclosed

Great! Committed in r121203.

Note: See TracTickets for help on using tickets.