{"id":470,"date":"2007-02-23T14:52:10","date_gmt":"2007-02-23T21:52:10","guid":{"rendered":"http:\/\/www.gubatron.com\/blog\/2007\/02\/23\/how-to-build-pyqt4-for-windows\/"},"modified":"2007-02-23T14:52:10","modified_gmt":"2007-02-23T21:52:10","slug":"how-to-build-pyqt4-for-windows","status":"publish","type":"post","link":"https:\/\/www.gubatron.com\/blog\/how-to-build-pyqt4-for-windows\/","title":{"rendered":"How to build PyQt4 for Windows"},"content":{"rendered":"<p>&#8211; Make sure you don&#8217;t have cygwin or C:devkitPromsysbin in your path,<br \/>\nor else your make files can end up trying to run the Makefile using &#8216;sh&#8217; and all<br \/>\nthe makefile we&#8217;re about to use are meant to run from the windows command line. <\/p>\n<p>If for some odd reason you type &#8216;sh&#8217; on your windows command line and you see something like:<\/p>\n<p>     sh-2.04$<\/p>\n<p>You&#8217;re likely to find this later on:<\/p>\n<p>     \/bin\/sh: -c: line 2: syntax error: unexpected end of file<\/p>\n<p>&#8211; Install Qt open source, with the exe installer, this will attempt to install<br \/>\n  ming if you don&#8217;t have it installed, say yes, mingw rocks.<\/p>\n<p>&#8211; Make sure you have the following Windows environment variables set:<\/p>\n<p>      QTDIR = c:Qt4.2.2<br \/>\n      QTMAKESPEC = win32-g++<\/p>\n<p>&#8211; Make sure you have Python2.5, Qt bin and Mingw bin folders on your path<\/p>\n<p>  PATH = %PATH%;c:Mingwbin;c:Mingwlibexecgccmingw323.4.2;c:python25bin;c:Qt4.2.2bin<\/p>\n<p>&#8211; Get pexports just in case the Qt doesn&#8217;t have libQtCore4.a on its lib\/<br \/>\n  folder.<\/p>\n<p>  You can download pexports at:<br \/>\n  http:\/\/www.emmestech.com\/software\/cygwin\/pexports-043\/download_pexports.html<\/p>\n<p>  If you don&#8217;t have that libQtCore4.a you won&#8217;t be able to build PyQt.<\/p>\n<p>  So you&#8217;ll need to do this, go to your Qt bin folder, say:<br \/>\n  c:Qt4.2.2bin<\/p>\n<p>  And run this:<\/p>\n<p>  pexports QtCore4.dll > Qt4Core4.def<br \/>\n  dlltool -dllname QtCore4.dll &#8211;def QtCore4.def &#8211;output-lib libQtCore4.a<\/p>\n<p>  Move the resulting file, libQtCore4.a, to c:Qt4.2.2lib<\/p>\n<p>COMPILING SIP:<br \/>\n&#8211; PyQt needs &#8220;sip&#8221; to be able to bind the Qt libraries, sip will generate the necessary C++ code.<br \/>\nTo install sip, get its source code, extract it to a folder say:<\/p>\n<p>  c:sip-4.5.2<\/p>\n<p>  Once inside run it&#8217;s configure.py like this:<\/p>\n<p>  python configure.py -p win32-g++<\/p>\n<p>  That will create the Makefiles, then you will make it using<\/p>\n<p>  mingw32-make<\/p>\n<p>  and<\/p>\n<p>  mingw32-make install<\/p>\n<p>  Now, I&#8217;m not sure what&#8217;s the environment variable of Mingw library path,<br \/>\nand I was having errors from the compilation of PyQt, telling me it couldn&#8217;t<br \/>\nfind the sip libraries, so this is what I did:<\/p>\n<p>   &#8211; Copy all the .o files from c:sip-4.5.2siplib to c:mingwlib<br \/>\n   &#8211; Copy all the .h files from c:sip-4.5.2siplib to c:mingwincludes<\/p>\n<p>&#8211; Now it&#8217;s finally time to compile PyQt.<br \/>\nUncompress the PyQt zip with the source (not the binary, if not we wouldn&#8217;t be doing this),<br \/>\ndo it at the root of your hardrive (C:), you&#8217;ll end up with a folder named similar to this:<\/p>\n<p>c:PyQt-win-gpl-4.1.1<\/p>\n<p>Go in there and do this:<br \/>\n  python configure.py<br \/>\n  mingw32-make   (this will take a long time, it will wrap every Qt C++ library on a new .cpp file which will be then compiled to exist as a python binding)<br \/>\n  mingw32-make install<\/p>\n<p>If you have any errors write me a comment on this post<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8211; Make sure you don&#8217;t have cygwin or C:devkitPromsysbin in your path, or else your make files can end up trying to run the Makefile using &#8216;sh&#8217; and all the makefile we&#8217;re about to use are meant to run from the windows command line. If for some odd reason you type &#8216;sh&#8217; on your windows [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[15,30,66],"tags":[],"class_list":["post-470","post","type-post","status-publish","format-standard","hentry","category-code","category-geeklife","category-qt4"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5Unzf-7A","jetpack-related-posts":[{"id":3241,"url":"https:\/\/www.gubatron.com\/blog\/setting-up-eclipse-as-your-ide-for-bitcoin-c-development-on-macosx\/","url_meta":{"origin":470,"position":0},"title":"Setting up Eclipse as your IDE for Bitcoin C++ development on MacOSX.","author":"gubatron","date":"February 9, 2014","format":false,"excerpt":"If you are a Java developer used to the productivity levels achieved by working with eclipse's code navigation, code completion and refactoring tools, it's worth your time staying in eclipse for any sort of C++ development. This post refers specifically to getting your eclipse environment to work with a particular\u2026","rel":"","context":"In &quot;BitCoin&quot;","block_context":{"text":"BitCoin","link":"https:\/\/www.gubatron.com\/blog\/category\/bitcoin-2\/"},"img":{"alt_text":"Screen Shot 2014-02-09 at 1.09.39 PM","src":"https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2014\/02\/Screen-Shot-2014-02-09-at-1.09.39-PM.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2014\/02\/Screen-Shot-2014-02-09-at-1.09.39-PM.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2014\/02\/Screen-Shot-2014-02-09-at-1.09.39-PM.png?resize=525%2C300 1.5x"},"classes":[]},{"id":3195,"url":"https:\/\/www.gubatron.com\/blog\/how-to-import-a-backed-up-wallet-in-bitcoin-qt\/","url_meta":{"origin":470,"position":1},"title":"How to import a backed up wallet in Bitcoin-Qt","author":"gubatron","date":"November 20, 2013","format":false,"excerpt":"The Bitcoin-Qt client has an export feature, but not an import feature, importing a wallet is a bit of a manual process and it can be quite scary for the non-computer saavy since you need to do this kind of stuff because you got a new computer or your old\u2026","rel":"","context":"In &quot;BitCoin&quot;","block_context":{"text":"BitCoin","link":"https:\/\/www.gubatron.com\/blog\/category\/bitcoin-2\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3236,"url":"https:\/\/www.gubatron.com\/blog\/how-to-actually-build-bitcoin-on-mac-osx-10-9-1\/","url_meta":{"origin":470,"position":2},"title":"How to actually build bitcoin on Mac OSX 10.9.1","author":"gubatron","date":"February 3, 2014","format":false,"excerpt":"First of all, if you have Macports, do yourself a favor and get rid of it. Then make sure you have Homebrew installed and all the packages installed by it up to date. 1. Let's install all the dependencies for Bitcoin hacking. brew install autoconf automake berkeley-db4 boost miniupnpc openssl\u2026","rel":"","context":"In &quot;BitCoin&quot;","block_context":{"text":"BitCoin","link":"https:\/\/www.gubatron.com\/blog\/category\/bitcoin-2\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3453,"url":"https:\/\/www.gubatron.com\/blog\/command-line-speed-test-see-how-fast-is-your-servers-connection\/","url_meta":{"origin":470,"position":3},"title":"command line speed test, see how fast is your server&#8217;s connection","author":"gubatron","date":"January 6, 2016","format":false,"excerpt":"Save the following script in a file called speed_test #!\/bin\/bash # Requirements # sudo apt-get install lftp iperf lftp -e 'pget http:\/\/releases.ubuntu.com\/14.04.3\/ubuntu-14.04.3-desktop-amd64.iso; exit; ' make sure the file is executable: sudo chmod +x speed_test Once you have installed lftp and iperf make sure you have the script somewhere in your\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2016\/01\/Fiber-optics.jpg?fit=892%2C538&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2016\/01\/Fiber-optics.jpg?fit=892%2C538&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2016\/01\/Fiber-optics.jpg?fit=892%2C538&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2016\/01\/Fiber-optics.jpg?fit=892%2C538&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":3383,"url":"https:\/\/www.gubatron.com\/blog\/things-to-remember-when-compilinglinking-cc-software\/","url_meta":{"origin":470,"position":4},"title":"# Things to remember when compiling\/linking C\/C++ software","author":"gubatron","date":"March 18, 2015","format":false,"excerpt":"by Angel Leon. March 17, 2015. Include Paths On the compilation phase, you will usually need to specify the different include paths so that the interfaces (.h, .hpp) which define structs, classes, constans, and functions can be found. With gcc and llvm include paths are passed with -I\/path\/to\/includes, you can\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2015\/03\/make-all-executables.png?fit=680%2C510&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2015\/03\/make-all-executables.png?fit=680%2C510&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2015\/03\/make-all-executables.png?fit=680%2C510&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":788,"url":"https:\/\/www.gubatron.com\/blog\/blooploader-06-is-hardy-compatible\/","url_meta":{"origin":470,"position":5},"title":"Blooploader 0.6 is Hardy compatible","author":"gubatron","date":"April 26, 2008","format":false,"excerpt":"Blooploader 0.6 running on Hardy. Currently available only via subversion. For our Linux users, you can safely update to Ubuntu Hardy if the one thing holding your breath was compatibility with the Blooploader. Currently we run the Blooploader in Linux from source, you just need to have installed, Qt4, sip4,\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts\/470","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/comments?post=470"}],"version-history":[{"count":0,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts\/470\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/media?parent=470"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/categories?post=470"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/tags?post=470"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}