From michael at possibleworlds.com Sat Jan 21 21:25:52 2012 From: michael at possibleworlds.com (michael ferraro) Date: Sat, 21 Jan 2012 15:25:52 -0500 Subject: [Pythonmac-SIG] compiling python extension In-Reply-To: <26EDF7B8-1D0F-4672-BA91-8F0167A24E35@mac.com> References: <18296397-A273-4538-A9C0-DB43D3D4BDA5@roontoon.com> <26EDF7B8-1D0F-4672-BA91-8F0167A24E35@mac.com> Message-ID: I am trying to compile a python extension that uses Quicktime Video Output Components as shown in the Mac Developers Library SimpleVideoOutXcode.xodeproj i am building the extension using the setup.py script attached below I need to run python in 32-bit because Quicktime has not been upgraded to 64-bit I am running 10.7.2 and the Apple installed python 2.7.1 /usr/bin/python: Mach-O universal binary with 2 architectures /usr/bin/python (for architecture x86_64): Mach-O 64-bit executable x86_64 /usr/bin/python (for architecture i386): Mach-O executable i386 this is an excerpt of the output i am getting when I try to build the extension NOTE: this line KVoutModule.c:44: error: expected specifier-qualifier-list before ?QTVideoOutputComponent? seems to indicate that I am not including the Quicktime/QuicktimeComponents.h header (which I am) as shown in the excerpt from the KVout.c source. relavent setup.py line: include_dirs = ['.', '/System/Library/Frameworks/Quicktime.framework/Headers/'] ------------------------------------ -----------------> output from : arch -i386 /usr/bin/python setup.py build ----------------------------------- running build running build_ext building 'KVout' extension creating build creating build/temp.macosx-10.7-intel-2.7 llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -DMAJOR_VERSION=1 -DMINOR_VERSION=0 -I. -I/System/Library/Frameworks/Quicktime.framework/Headers/ -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c KVoutModule.c -o build/temp.macosx-10.7-intel-2.7/KVoutModule.o -m32 -framework Quicktime KVoutModule.c: In function ?KVout_Begin?: KVoutModule.c:197: warning: ?ComponentFunctionImplemented? is deprecated (declared at /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Components.h:1216) KVoutModule.c: At top level: KVoutModule.c:537: warning: initialization from incompatible pointer type i686-apple-darwin11-llvm-gcc-4.2: -framework: linker input file unused because linking not done i686-apple-darwin11-llvm-gcc-4.2: Quicktime: linker input file unused because linking not done KVoutModule.c:44: error: expected specifier-qualifier-list before ?QTVideoOutputComponent? KVoutModule.c:91: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?KVoutComponent_GetInstance? KVoutModule.c:93: error: expected ?)? before ?container? KVoutModule.c:94: error: expected declaration specifiers or ?...? before ?QTAtom? KVoutModule.c:94: error: expected declaration specifiers or ?...? before ?QTAtomContainer? KVoutModule.c: In function ?KVout_Open?: KVoutModule.c:142: warning: implicit declaration of function ?KVoutComponent_GetInstance? KVoutModule.c:142: warning: assignment makes pointer from integer without a cast KVoutModule.c:148: warning: implicit declaration of function ?QTVideoOutputSetClientName? KVoutModule.c:151: warning: implicit declaration of function ?QTVideoOutputSetDisplayMode? KVoutModule.c: In function ?KVout_Begin?: KVoutModule.c:188: warning: assignment makes pointer from integer without a cast KVoutModule.c:191: warning: implicit declaration of function ?QTVideoOutputBegin? KVoutModule.c:197: warning: implicit declaration of function ?ComponentFunctionImplemented? KVoutModule.c:197: error: ?kQTVideoOutputSetEchoPortSelect? undeclared (first use in this function) KVoutModule.c:197: error: (Each undeclared identifier is reported only once KVoutModule.c:197: error: for each function it appears in.) KVoutModule.c:201: warning: implicit declaration of function ?QTVideoOutputGetGWorld? QUESTION: Is there something more I need to do (or am I doing something wrong) that is keeping this from compiling ------------------------------------ -----------------> excerpt from my KVout.c ----------------------------------- #include #include #include #include #include #include static PyObject *ErrorObject; /* loacal exceptions */ #define ErrorExit(msg) \ { PyErr_SetString (ErrorObject, msg); return NULL; } extern void initKVout(void); static int kMaxNumberOfComponents = 10; typedef struct { long width, height; // pixels of the display Fixed hRes, vRes; // pixels per inch Fixed refreshRate; // refresh rate OSType pixelType; // type of pixel used by display format: // 1,2,4,8,16,24,32 :: standard bit depths // 33,34,36,40 :: gray-scale pixel depths // of 1,2,4,8 char name[50]; // name of display mode } DisplayModeAtomRecord, *DisplayModeAtomPtr; typedef struct { Handle hName; OSType subType; UInt8 numberOfModes; DisplayModeAtomPtr pDisplayModeList; } ComponentListRecord, *ComponentListPtr; typedef struct { Component component; QTVideoOutputComponent componentInstance; ComponentListPtr componentList; UInt8 totalNumOfComponents; UInt8 whichComponentIndex; UInt8 whichModeIndex; } KVoutComponent, *KVoutComponentPtr; ------------------------------------ -----------------> my setup.py ----------------------------------- from distutils.core import setup, Extension module1 = Extension('KVout', define_macros = [('MAJOR_VERSION', '1'), ('MINOR_VERSION', '0')], extra_compile_args = ['-m32', '-framework', 'Quicktime'], include_dirs = ['.', '/System/Library/Frameworks/Quicktime.framework/Headers/'], libraries = [], library_dirs = [], sources = ['KVoutModule.c']) setup (name = 'KVout', version = '1.0', description = 'Output Kabuki to Quicktime Video Component', author = 'Michael Ferraro', author_email = 'michael at possibleworlds.com', url = 'http://www.python.org/doc/current/ext/building.html', long_description = ''' This is really just a demo package. ''', ext_modules = [module1]) From mk0423 at towb.de Sun Jan 29 20:32:38 2012 From: mk0423 at towb.de (mk0423 at towb.de) Date: Sun, 29 Jan 2012 20:32:38 +0100 Subject: [Pythonmac-SIG] locale module missing function Message-ID: I need locale.bindtextdomain (to influence PyGTK) but in the Python supplied with Snow Leopard it doesn't exist!? From njriley at illinois.edu Sun Jan 29 21:05:41 2012 From: njriley at illinois.edu (Nicholas Riley) Date: Sun, 29 Jan 2012 15:05:41 -0500 Subject: [Pythonmac-SIG] locale module missing function In-Reply-To: References: Message-ID: <20120129200541.GA25281@illinois.edu> On Sun, Jan 29, 2012 at 08:32:38PM +0100, mk0423 at towb.de wrote: > I need locale.bindtextdomain (to influence PyGTK) but in the Python supplied with Snow Leopard it doesn't exist!? OS X does not provide gettext. You'll need to compile your own Python against the version of gettext PyGTK is using, or use another method of calling bindtextdomain (e.g. ctypes). -- Nicholas Riley