[PyQt] pyqtdeploy: compiler and linker errors fixed, but .exe won't run.

Jacob Kanev j_kanev at arcor.de
Thu Oct 25 12:25:23 BST 2018


Hi everybody, I've fixed the missing expat symbol error. The symbol __Expat_LoadLibrary is defined in the code, in loadlibrary.c, and is expected by the linker to be in an .obj (or .lib) file. That code never gets compiled. It turned out that expat/loadlibrary.c didn't end up in the makefile, because it was not in the .pro file. This is strange, because is *does* appear in the .pdy file. Adding a line with loadlibrary.c to the .pro file fixes the linker error. Would this be a problem of pyqtdeploy-build, or is there anything I've misunderstood?

This does lead to another error (NMDH undefined), which can be fixed by editing loadlibrary.c itself (see below [1]). Not sure whether there's a better way. I also didn't find any way to exclude expat from the project. (I don't need xml parsing, but probably it's necessary for qt?)

Unfortunately, after compilation, I get an .exe file that doesn't do anything. When executing, nothing happens. Nothing at all. This is independent of whether I use an entry point or a main script file in the GUI of pyqtdeploy. What could have gone wrong? Does anyone have any idea? (Broken xml parser maybe? :)) (Below [1] is a list of what I've done to compile, if necessary I can send logs from build, nmake and sysroot or the sysroot.json file).

Any help would be really appreciated. Or a pointer to where I could look further. 
All the best, Jacob.

[1] Here's what I've done:

-- building the sysroot for Win-32 --
..........................................................................
* Download qt5 and select sources, select 5.11.2 MSVC 2015 32 bit and
  sources (otherwise qmake won't be present, also MinGW doesn't work since
  nmake is hard-coded into pyqtdeploy)
* Download and install Microsoft Visual Studio 2017, community edition
* Make sure python 3.7.0 or later is installed
* Download the python sources for *exactly* the same version as the
  installed version (3.7.0 or later)
* Download source code for sip, 4.19.13 or later (otherwise you'll get the
  error: "Please use SIP v4.19.13 or later")
* Make sure pyqt5 is installed (use pip)
* Make sure pyqtdeploy is installed (use pip)
* patch pyqtdeploy to fix the "dlls_dir"-undefined error by adding the line
    dlls_dir = sysroot.target_lib_dir
  after line 275 in
  ...\Lib\site-packages\pyqtdeploy\sysroot\plugins\python\python.py.
* on the command line, run:
    pyqtdeploy-sysroot --verbose sysroot.json > sysroot.log
  Fix all missing file error messages by searching for the file, then
  adding the path either to the "INCLUDE" environment variable (for header
  files), or the "LIB" variable (for .lib files). Use the 32-bit versions if
  multiple files are found.

-- building the project --
..........................................................................
* on the command line, run:
    pyqtdeploy-build --verbose treetime.pdy > build.log
  If there are errors, run "pyqtdeploy treetime.pdy" and fix them.

-- compiling the application -- 
..........................................................................
* on the command line, cd to the build directory
* open the file treetime pro, copy the line with "xmltok.c" and replace
  "xmltok.c" with "loadlibrary.c". For some reason, loadlibrary.c is missing
  when the .pro file is created, leading to linker errors.
* find the file
  "\sysroot-win-32\src\Python-3.7.0\Modules\expat\loadlibrary.c", and add
  the line
    typedef void *NMHDR;
  at the top, before the "#include <windows.h>" statement. This because in
  psth.h and richedit.h (both part of windows SDK) this type is first
  referred to, but defined later.
* run:
    qmake treetime.pro
  this creates a Makefile. Add qmake.exe to the Path if necessary.
* on the command line, run
    nmake release > ..\nmake.log
  As before, add missing headers and libs to the environment, until it works.


   ______________________________________
   Jacob Kanev
   Pungenday, 6th of The Aftermath, 3184
      email: jkanev at zoho.com  |  threema: PPJ6E4FY
      instagram: j_kanev | twitter: @j_kanev  | jabber: jkanev at jabber.ccc.de
      web: http://jkanev.info  |  blog: http://jacobkanev.wordpress.com







More information about the PyQt mailing list