Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if a library is 32bit/64bit built on Mac OS X?

I'm having some trouble in using PyQt/SIP. I guess the SIP is compiled into 64bit, but Python has some problem with finding it.

  File "qtdemo.py", line 46, in 
    import sip
ImportError: dlopen(/Library/Python/2.6/site-packages/sip.so, 2): no suitable image found.  Did find:
        /Library/Python/2.6/site-packages/sip.so: mach-o, but wrong architecture
  • How do I know if a library (so/dylib) is 32bit or 64bit?
  • How do I know if my Python is 32bit or 64bit?
like image 342
prosseek Avatar asked Jul 08 '10 19:07

prosseek


People also ask

How do I know if a program is 32 or 64-bit Mac?

To check if an app is 32-bit or 64-bit, from the Apple menu, choose About This Mac, then click the System Report button. From the system report, scroll down to Software in the sidebar, then select Applications. When you select an individual application, you will see a field titled 64-bit (Intel).

Is Mac Book 64-bit?

All Macs since 2007 have had 64-bit processors.


2 Answers

The file tool can be used to identify executables.

Example:

> file /Applications/TextEdit.app/Contents/MacOS/TextEdit 
/Applications/TextEdit.app/Contents/MacOS/TextEdit: Mach-O universal binary with 2 architectures
/Applications/TextEdit.app/Contents/MacOS/TextEdit (for architecture x86_64):   Mach-O 64-bit executable x86_64
/Applications/TextEdit.app/Contents/MacOS/TextEdit (for architecture i386): Mach-O executable i386
like image 180
Nikolai Ruhe Avatar answered Oct 04 '22 19:10

Nikolai Ruhe


lipo -info target/libexample-df07142d9bfd950a.a
input file target/libexample-df07142d9bfd950a.a is not a fat file
Non-fat file: target/libexample-df07142d9bfd950a.a is architecture: x86_64

or

lipo -info `which python`
Non-fat file: /usr/local/bin/python is architecture: x86_64

Don't use file.

like image 44
Doug Avatar answered Oct 04 '22 18:10

Doug