[PyQt] Correct build architecture for static libs on iOS simulator?

Patrick Stinson patrickkidd at gmail.com
Sun Feb 5 15:01:38 GMT 2017


After a lot of hacking, I figured out that you can make an iPhone simulator sys root by configuring using the ios-64 target in pyqtdeploycli, and then before the “make” step in each project, just go and edit all the qmake-generated Makefiles to change the following line:

####### Custom Variables                                                                                
EXPORT_VALID_ARCHS = armv7 arm64

to:

####### Custom Variables                                                                                
EXPORT_VALID_ARCHS = i386 x86_64

Then also change the SDK path from iPhoneOS to iPhoneSimulator in CFLAGS and CXXFLAGS at the top of each Makefile. So change both instances of:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk

to:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk

Take notice that there is a separate Makefile for each PyQt5 package. The easiest way to search and replace in all of them is to use Xcode, create a workspace in the PyQt src root dir, then drag all of the dir contents into the workspace pane on the left of the Xcode window selecting ‘make references to folders’ (or something similar), and then choose search and replace in workspace from the Edit menu.

After that you should be all set to make and make install in each source package as described in the pyqtdeploy documentation: 

http://pyqt.sourceforge.net/Docs/pyqtdeploy/static_builds.html <http://pyqt.sourceforge.net/Docs/pyqtdeploy/static_builds.html>

I’ve bene out of touch with PyQt5 for a while, but man it’s great to be able to deploy it to iOS!

Good luck!
-P



> On Feb 3, 2017, at 3:12 AM, Patrick Stinson <patrickstinson.lists at gmail.com> wrote:
> 
> Well, I suppose this question is somehow off-topic? Just for future reference...
> 
> Thanks!
> 
> On Tue, Jan 31, 2017 at 7:27 PM, Patrick Stinson <patrickkidd at gmail.com> wrote:
>> What is the correct way to build a SYSROOT for the iOS simulator using pyqtdeploy? When I try to “make iphonsimulator” in “./build” using my ios-64 SYSROOT I get the following unresolved symbols (and I imagine more from the other libraries once I resolve these):
>> 
>> Undefined symbols for architecture x86_64:
>>  "_PyEval_GetBuiltins", referenced from:
>>      qrcimporter_load_module(_object*, _object*) in pdytools_module.o
>>  "_PyObject_CallFunction", referenced from:
>>      qrcimporter_load_module(_object*, _object*) in pdytools_module.o
>>  "_PyImport_AddModuleObject", referenced from:
>>      qrcimporter_load_module(_object*, _object*) in pdytools_module.o
>>  "_PyModule_GetDict", referenced from:
>>      qrcimporter_load_module(_object*, _object*) in pdytools_module.o
>>  "_PyDict_SetItemString", referenced from:
>>      qrcimporter_load_module(_object*, _object*) in pdytools_module.o
>>  "_PyImport_ExecCodeModuleObject", referenced from:
>>      qrcimporter_load_module(_object*, _object*) in pdytools_module.o
>>  "_PyImport_ImportModule", referenced from:
>>      qrcimporter_find_loader(_object*, _object*) in pdytools_module.o
>>      qrcimporter_load_module(_object*, _object*) in pdytools_module.o
>>  "_PyObject_CallObject", referenced from:
>>      qrcimporter_find_loader(_object*, _object*) in pdytools_module.o
>>  "_PyErr_SetString", referenced from:
>>      qrcimporter_init(_object*, _object*, _object*) in pdytools_module.o
>>  "_PyType_Ready", referenced from:
>>      _PyInit_pdytools in pdytools_module.o
>>  "_PyModule_Create2", referenced from:
>>      _PyInit_pdytools in pdytools_module.o
>>  "_PyList_Append", referenced from:
>>      append_path_dirs(_object*, char const**) in pyqtdeploy_start.o
>>  "_PyInit_sip", referenced from:
>>      extension_modules in pyqtdeploy_main.o
>>  "_PyErr_ExceptionMatches", referenced from:
>>      handle_exception() in pyqtdeploy_start.o
>>  "_PyMarshal_ReadObjectFromString", referenced from:
>>      get_code_object(QString const&) in pdytools_module.o
>>  "_Py_BuildValue", referenced from:
>>      qrcimporter_find_loader(_object*, _object*) in pdytools_module.o
>>      qrcimporter_load_module(_object*, _object*) in pdytools_module.o
>>  "_PyErr_NormalizeException", referenced from:
>>      handle_exception() in pyqtdeploy_start.o
>>  "_PyInit_QtWidgets", referenced from:
>>      extension_modules in pyqtdeploy_main.o
>>  "__Py_NoneStruct", referenced from:
>>      handle_exception() in pyqtdeploy_start.o
>>      pdytools_init_executable_dir(QString const&) in pdytools_module.o
>>      qrcimporter_find_loader(_object*, _object*) in pdytools_module.o
>>      qrcimporter_find_module(_object*, _object*) in pdytools_module.o
>>      qrcimporter_get_code(_object*, _object*) in pdytools_module.o
>>      qrcimporter_get_source(_object*, _object*) in pdytools_module.o
>>  "_PyUnicode_FromString", referenced from:
>>      pyqtdeploy_start(int, char**, _inittab*, char const*, char const*, char const**) in pyqtdeploy_start.o
>>  "_PyErr_Clear", referenced from:
>>      handle_exception() in pyqtdeploy_start.o
>>  "_PyErr_Print", referenced from:
>>      handle_exception() in pyqtdeploy_start.o
>>  "_PyLong_AsLong", referenced from:
>>      handle_exception() in pyqtdeploy_start.o
>>  "__Py_FalseStruct", referenced from:
>>      qrcimporter_is_package(_object*, _object*) in pdytools_module.o
>>  "_Py_OptimizeFlag", referenced from:
>>      pyqtdeploy_start(int, char**, _inittab*, char const*, char const*, char const**) in pyqtdeploy_start.o
>>  "_Py_SetProgramName", referenced from:
>>      pyqtdeploy_start(int, char**, _inittab*, char const*, char const*, char const**) in pyqtdeploy_start.o
>>  "_Py_FileSystemDefaultEncoding", referenced from:
>>      pyqtdeploy_start(int, char**, _inittab*, char const*, char const*, char const**) in pyqtdeploy_start.o
>>  "_PyModule_AddObject", referenced from:
>>      _PyInit_pdytools in pdytools_module.o
>>  "_PyImport_AppendInittab", referenced from:
>>      pyqtdeploy_start(int, char**, _inittab*, char const*, char const*, char const**) in pyqtdeploy_start.o
>>  "_Py_NoSiteFlag", referenced from:
>>      pyqtdeploy_start(int, char**, _inittab*, char const*, char const*, char const**) in pyqtdeploy_start.o
>>  "__PyArg_NoKeywords", referenced from:
>>      qrcimporter_init(_object*, _object*, _object*) in pdytools_module.o
>>  "_Py_HasFileSystemDefaultEncoding", referenced from:
>>      pyqtdeploy_start(int, char**, _inittab*, char const*, char const*, char const**) in pyqtdeploy_start.o
>>  "_PyObject_GetAttrString", referenced from:
>>      handle_exception() in pyqtdeploy_start.o
>>      qrcimporter_find_loader(_object*, _object*) in pdytools_module.o
>>      qrcimporter_load_module(_object*, _object*) in pdytools_module.o
>>  "_PyUnicode_FromStringAndSize", referenced from:
>>      append_path_dirs(_object*, char const**) in pyqtdeploy_start.o
>>  "_PyImport_Inittab", referenced from:
>>      qrcimporter_find_module(_object*, _object*) in pdytools_module.o
>>  "_PyExc_ImportError", referenced from:
>>      qrcimporter_init(_object*, _object*, _object*) in pdytools_module.o
>>      raise_import_error(QString const&) in pdytools_module.o
>>      read_data(QString const&, QByteArray&) in pdytools_module.o
>>  "_PyArg_ParseTuple", referenced from:
>>      qrcimporter_init(_object*, _object*, _object*) in pdytools_module.o
>>      qrcimporter_find_loader(_object*, _object*) in pdytools_module.o
>>      qrcimporter_find_module(_object*, _object*) in pdytools_module.o
>>      qrcimporter_get_code(_object*, _object*) in pdytools_module.o
>>      qrcimporter_get_data(_object*, _object*) in pdytools_module.o
>>      qrcimporter_is_package(_object*, _object*) in pdytools_module.o
>>      qrcimporter_load_module(_object*, _object*) in pdytools_module.o
>>      ...
>>  "_PyImport_ExtendInittab", referenced from:
>>      pyqtdeploy_start(int, char**, _inittab*, char const*, char const*, char const**) in pyqtdeploy_start.o
>>  "_Py_Initialize", referenced from:
>>      pyqtdeploy_start(int, char**, _inittab*, char const*, char const*, char const**) in pyqtdeploy_start.o
>>  "_PyUnicode_FSDecoder", referenced from:
>>      qrcimporter_init(_object*, _object*, _object*) in pdytools_module.o
>>  "_Py_FrozenFlag", referenced from:
>>      pyqtdeploy_start(int, char**, _inittab*, char const*, char const*, char const**) in pyqtdeploy_start.o
>>  "_PySys_GetObject", referenced from:
>>      pyqtdeploy_start(int, char**, _inittab*, char const*, char const*, char const**) in pyqtdeploy_start.o
>>      pdytools_init_executable_dir(QString const&) in pdytools_module.o
>>  "_PyInit_Qt", referenced from:
>>      extension_modules in pyqtdeploy_main.o
>>  "_PyErr_Format", referenced from:
>>      raise_import_error(QString const&) in pdytools_module.o
>>      read_data(QString const&, QByteArray&) in pdytools_module.o
>>  "_PyImport_Import", referenced from:
>>      pyqtdeploy_start(int, char**, _inittab*, char const*, char const*, char const**) in pyqtdeploy_start.o
>>  "_PyObject_CallMethod", referenced from:
>>      pyqtdeploy_start(int, char**, _inittab*, char const*, char const*, char const**) in pyqtdeploy_start.o
>>  "_Py_IgnoreEnvironmentFlag", referenced from:
>>      pyqtdeploy_start(int, char**, _inittab*, char const*, char const*, char const**) in pyqtdeploy_start.o
>>  "_PySys_SetObject", referenced from:
>>      pyqtdeploy_start(int, char**, _inittab*, char const*, char const*, char const**) in pyqtdeploy_start.o
>>  "_Py_Finalize", referenced from:
>>      pyqtdeploy_start(int, char**, _inittab*, char const*, char const*, char const**) in pyqtdeploy_start.o
>>      handle_exception() in pyqtdeploy_start.o
>>  "_PyUnicode_FromKindAndData", referenced from:
>>      qstring_to_str(QString const&) in pdytools_module.o
>>  "__Py_TrueStruct", referenced from:
>>      pyqtdeploy_start(int, char**, _inittab*, char const*, char const*, char const**) in pyqtdeploy_start.o
>>      qrcimporter_is_package(_object*, _object*) in pdytools_module.o
>>  "_PyExc_SystemExit", referenced from:
>>      handle_exception() in pyqtdeploy_start.o
>>  "_PyInit_QtGui", referenced from:
>>      extension_modules in pyqtdeploy_main.o
>>  "_PyImport_FrozenModules", referenced from:
>>      pyqtdeploy_start(int, char**, _inittab*, char const*, char const*, char const**) in pyqtdeploy_start.o
>>  "_PyType_GenericNew", referenced from:
>>      _PyInit_pdytools in pdytools_module.o
>>  "_PySys_SetArgvEx", referenced from:
>>      pyqtdeploy_start(int, char**, _inittab*, char const*, char const*, char const**) in pyqtdeploy_start.o
>>  "_PyBytes_FromStringAndSize", referenced from:
>>      qrcimporter_get_data(_object*, _object*) in pdytools_module.o
>>  "_PyModule_AddIntConstant", referenced from:
>>      _PyInit_pdytools in pdytools_module.o
>>  "_PyErr_Fetch", referenced from:
>>      handle_exception() in pyqtdeploy_start.o
>>  "_PyErr_Restore", referenced from:
>>      handle_exception() in pyqtdeploy_start.o
>>  "_PyDict_GetItemString", referenced from:
>>      qrcimporter_load_module(_object*, _object*) in pdytools_module.o
>>  "_PyInit_QtCore", referenced from:
>>      extension_modules in pyqtdeploy_main.o
>> ld: symbol(s) not found for architecture x86_64
>> clang: error: linker command failed with exit code 1 (use -v to see invocation)
>> 
>> 
>>> On Jan 31, 2017, at 10:47 AM, Patrick Stinson <patrickkidd at gmail.com> wrote:
>>> 
>>> When building the sip python and PYQT libraries, what is the correct build architecture to use for linking with pyqtdeploy -generated targets? When using osx-64, I am getting unresolved symbol errors for symbols defined in the python library upon linking using the makefiles generated by pyqtdeploy.
>>> 
>>> If it helps, looking back up in the log there's all these warnings from ld saying that the x86_64 architecture is going to be deprecated for the iPhone simulator.
>>> 
>>> Thoughts? Thanks!
>> 
>> _______________________________________________
>> PyQt mailing list    PyQt at riverbankcomputing.com
>> https://www.riverbankcomputing.com/mailman/listinfo/pyqt

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170205/662e190d/attachment-0001.html>


More information about the PyQt mailing list