On Tue, Jan 5, 2010 at 7:33 AM, Krzysztof Kobus <kk720...@yahoo.com> wrote: > Hi, > > I have a problem with linking python module with my application on mac in > order to make the module available in "embedded python". > > My python module is contained in j3kmodule.cxx file and module > initialization function is exported in j3kmodule.h > > j3kmodule.h: > ------------ > PyMODINIT_FUNC PyInit_j3k(void); > > > j3kmodule.cxx: > -------------- > PyMODINIT_FUNC > PyInit_j3k(void) > { > PyObject *m = NULL; > > if ((m = PyModule_Create(&j3k_module)) == NULL) > return NULL; > > return m; > } > > > Then in my application in KkPython.cxx file I have: > > KkPython.cxx: > ------------- > > #include "j3kmodule.h" > > /* Add a builtin module, before Py_Initialize */ > PyImport_AppendInittab("j3k", PyInit_j3k); > > > I link my application with the module and get following linking error on mac > although on open suse linux exactly the same procedure works fine: > > g++ -headerpad_max_install_names -o > ../../bin/render.app/Contents/MacOS/render main.o KkPython.o -lkkbase > -L/Users/kk/dev/J3K/trunk/j3ksrc/examples/render/../../lib/ > -lQtSolutions_PropertyBrowser-2.5 -lpython3.1 > /Users/kk/dev/J3K/trunk/j3ksrc/python/modules/build/lib.macosx-10.3-i386-3.1/j3k.so > -framework OpenGL -framework AGL > ld: warning in > /Users/kk/dev/J3K/trunk/j3ksrc/python/modules/build/lib.macosx-10.3-i386-3.1/j3k.so, > file is not of required architecture > Undefined symbols: > "_PyInit_j3k", referenced from: > _PyInit_j3k$non_lazy_ptr in KkPython.o > ld: symbol(s) not found > collect2: ld returned 1 exit status > make: *** [../../bin/render.app/Contents/MacOS/render] Error 1 > > > I appreciate any hints, > > best greetings, > > Krzysztof Kobus >
Well, it seems that one of your files is a different architecture than the others. Based on the location, I'd say it's i386 while the rest of it would be PowerPC. You can cross-compile but you can't link an i386 library to a PowerPC library. -- http://mail.python.org/mailman/listinfo/python-list