{"id":141,"date":"2010-11-23T14:00:00","date_gmt":"2010-11-23T21:00:00","guid":{"rendered":"http:\/\/www.lothlorien.com\/kf6gpe\/?p=141"},"modified":"2010-11-23T15:08:59","modified_gmt":"2010-11-23T22:08:59","slug":"compiling-qtdbus-for-windows","status":"publish","type":"post","link":"https:\/\/www.lothlorien.com\/kf6gpe\/compiling-qtdbus-for-windows\/","title":{"rendered":"Compiling QtDBus for Windows&#8230;"},"content":{"rendered":"<p>I keep needing to do this. Each time I do, I have to rediscover how to do it. <\/p>\n<p>Worse, I&#8217;m doing it slightly differently each time.  <\/p>\n<p>For interested parties, here&#8217;s what I just did for Qt 4.7.1. Worked for Qt 4.7.0, too.<\/p>\n<p>I&#8217;m using MinGW, cmake, libexpat, and of course Qt. To begin, you need to build dbus itself for Windows, and then you can rebuild <\/p>\n<ol>\n<li>Make sure you have MinGW installed and correctly configured. Its bin directory should be in your path.\n<li>Download <a href=\"http:\/\/www.cmake.org\/cmake\/resources\/software.html\">cmake<\/a>. Install.<\/li>\n<li>Download and install libexpat from\u00c2\u00a0<a href=\"http:\/\/www.winkde.org\/pub\/kde\/ports\/win32\/repository-4.4\/win32libs\/\">http:\/\/www.winkde.org\/pub\/kde\/ports\/win32\/repository-4.4\/win32libs\/<\/a>(as suggested in the dbus documentation). You&#8217;ll want the lib archive. You&#8217;ll need the include directory no matter what for when you build QtDBus. Unpack these zips to <code>C:\\Program Files\\win32libs<\/code>.<\/li>\n<li>Grab dbus from the <a href=\"http:\/\/cgit.freedesktop.org\/dbus\/dbus\/snapshot\/dbus-1.4.0.zip\">repository<\/a>, put it in <code>c:\\dbus-1.4.0<\/code>.<\/li>\n<li>Edit <code>dbus-1.4.0\\cmake\\CMakeLists.txt<\/code>, add\n<pre>\r\nset(LIBEXPAT_LIBRARIES \"C:\/Program Files\/win32libs\/lib\/libexpat.lib\")\r\nset(LIBEXPAT_INCLUDE_DIR \"C:\/Program Files\/win32libs\/include\")\r\nset(LIBEXPAT_FOUND ON)\r\n<\/pre>\n<p>after<br \/>\n<code>project(dbus)<\/code><\/li>\n<li>Start a Windows Command Prompt<\/li>\n<li><code>mdkir c:\\dbus &amp;&amp; cd c:\\dbus<\/code><\/li>\n<li><code>cmake -G \"MinGW Makefiles\" ..\\dbus-1.4.0\\cmake -DDBUS_USE_EXPAT=on<\/code><\/li>\n<li><code>mingw32-make<\/code><\/li>\n<li>Add <code>c:\\dbus\\bin<\/code> to your path.<\/li>\n<li>Edit <code>c:\\qt\\4.7.1\\src\\dbus\\dbus.pro<\/code>:\n<pre>\r\nwin32 {\r\n    wince*:LIBS_PRIVATE += -lws2\r\n    else:LIBS_PRIVATE += -lws2_32 \\\r\n    -ladvapi32 \\\r\n    -lnetapi32 \\\r\n    -luser32\r\n    CONFIG(debug, debug|release):LIBS_PRIVATE += -ldbus-1 -Lc:\/dbus\/bin\r\n    else:LIBS_PRIVATE += -ldbus-1 -Lc:\/dbus\/bin\r\n    INCLUDEPATH += c:\/dbus-1.4.0 c:\/dbus\r\n}\r\n<\/pre>\n<\/li>\n<p>You don&#8217;t need to build QtDBus separately to begin with the way I do here (step 13) &#8212; but it&#8217;s much faster to do that and know it&#8217;s working than it is to start the configure \/ mingw32-make step, walk away, and find out an hour later that it died someplace in the middle because you messed up the path to dbus or something. <\/p>\n<li>Start a Qt Command Shell.<\/li>\n<li><code>cd c:\\qt\\4.7.1\\src\\dbus &amp;&amp; qmake &amp;&amp; mingw32-make<\/code><\/li>\n<li><code>cd ..\\.. &amp;&amp; configure -dbus &amp;&amp; mingw32-make<\/code><\/li>\n<\/ol>\n<p>Your mileage may vary. I seem to remember fixing at least one compilation error in dbus at one point, but don&#8217;t remember precisely where or why. It wasn&#8217;t hard to do, though &#8212; something about a missing argument.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I keep needing to do this. Each time I do, I have to rediscover how to do it. Worse, I&#8217;m doing it slightly differently each time. For interested parties, here&#8217;s what I just did for Qt 4.7.1. Worked for Qt 4.7.0, too. I&#8217;m using MinGW, cmake, libexpat, and of course Qt. To begin, you need &hellip; <a href=\"https:\/\/www.lothlorien.com\/kf6gpe\/compiling-qtdbus-for-windows\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Compiling QtDBus for Windows&#8230;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[20],"class_list":["post-141","post","type-post","status-publish","format-standard","hentry","category-programming","tag-qt"],"_links":{"self":[{"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/posts\/141","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/comments?post=141"}],"version-history":[{"count":40,"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/posts\/141\/revisions"}],"predecessor-version":[{"id":226,"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/posts\/141\/revisions\/226"}],"wp:attachment":[{"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/media?parent=141"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/categories?post=141"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/tags?post=141"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}