{"id":60,"date":"2007-12-16T18:02:40","date_gmt":"2007-12-16T17:02:40","guid":{"rendered":"http:\/\/www.instruyete.org\/?p=60"},"modified":"2007-12-16T18:02:40","modified_gmt":"2007-12-16T17:02:40","slug":"qt-programme-als-universal-binaries-erstellen","status":"publish","type":"post","link":"https:\/\/www.instruyete.org\/?p=60","title":{"rendered":"Qt Programme als Universal Binaries erstellen"},"content":{"rendered":"<p>Nat\u00fcrlich ist es kein Problem auch Qt Programme als <strong>UB<\/strong>&#8217;s (<em>Universal Binaries<\/em>) zu erstellen. Allerdings ist es unter Qt 4.x wesentlich  einfacher als unter Qt 3.x, weswegen ich die Vorgehensweise kurz getrennt darstelle<\/p>\n<h3> UB&#8217;s mit Qt 3.3<\/h3>\n<p>Rein theoretisch kann man auch hier beide Zielplattformen (<strong>ppc<\/strong> und <strong>i386<\/strong>) auf einer Maschine erstellen, was aber zus\u00e4tzlichen Aufwand erfordert. Einfacher ist es binaries f\u00fcr die beiden Plattformen auf einer passenden Maschine zu erstellen und sp\u00e4ter zusammenzuf\u00fcgen. die 64bit Targets (ppc64 bzw. x86_64) spielen hier \u00fcbrigens keine Rolle, da Mac OS X 10.4 sowieso keine 64bit GUI Programme unterst\u00fctzt.<\/p>\n<p>Das Hauptproblem bei Qt 3.3 ist, dass die Qt Library selber nicht als UB vorliegt oder out-of-the-box erstellt wreden kann. Daher muss man auf jeder Zielplattform diese Library erstellen.<\/p>\n<p>Danach erstellt man sein Programm und\/oder seine Libraries\/Frameworks auf jeder Maschine. Am Schluss legt man auf jeder Maschine ein Build-Verzeichnis i386 und ppc an, kopiert die Binaries rein und f\u00fchrt Sie mit dem lipo Befehl zusammen, bspw:<\/p>\n<pre>lipo -create  build\/i386\/test build\/ppc\/test -output test.app\/Contents\/MacOS\/test<\/pre>\n<p>mit dem file Kommando sieht man, dass das neue test Binary nun 2 Plattformen unterst\u00fctzt:<\/p>\n<pre>file  test.app\/Contents\/MacOS\/test<\/pre>\n<p><em>test.app\/Contents\/MacOS\/test: Mach-O universal binary with 2 architectures <\/em><\/p>\n<p><em>test.app\/Contents\/MacOS\/test (for architecture i386):   Mach-O executable i386<br \/>\ntest.app\/Contents\/MacOS\/test (for architecture ppc):    Mach-O executable ppc<\/em><\/p>\n<h3>  UB&#8217;s mit Qt 4.x<\/h3>\n<p>Hier ist das Sache wesentlich einfacher. Wenn man das Toolkit mit dem <strong>-universal<\/strong> Flag \u00fcbersetzt hat man ein UB f\u00e4higes Qt Framework. In seinem .pro File muss man dann nur noch<\/p>\n<pre>QMAKE_MAC_SDK=\/path\/to\/MacOSX10.4u.sdk\nCONFIG+=x86 ppc<\/pre>\n<p>angeben um ein fertiges Binary zu erzeugen. Im Hintergrund schleusst Qt einfach die <strong>-arch<\/strong> Flags an den g++ Compiler weiter.<\/p>\n<p>weitere Hinweise:<\/p>\n<p><strong>gfortran<\/strong> unterst\u00fctzt in der eigentlichen Fassung diese -arch Flags noch nicht. Hier gibt es allerdings einen weiteren experimentellen Fork der das schon kann:<\/p>\n<p><a href=\"http:\/\/r.research.att.com\/tools\/\" title=\"http:\/\/r.research.att.com\/tools\/\">http:\/\/r.research.att.com\/tools\/<\/a><\/p>\n<p>Um die Qt Bibliothek mit dem eigenen Programm auszuliefern muss der <em>install_name<\/em> (Linux: soname) ge\u00e4ndert werden, dies ist hier am Bsp. von Qt 3.3 dargestellt:<\/p>\n<p>..f\u00fcr die Qt Library selber<\/p>\n<pre> install_name_tool id @executable_path\/..\/Frameworks\/libqt.3.dylib \ndemo.app\/Contents\/Frameworks\/libqt.3.dylib<\/pre>\n<p>und f\u00fcr das Programm:<\/p>\n<pre>install_name_tool -change libqt.3.dylib \n@executable_path\/..\/Frameworks\/libqt.3.dylib \ntest.app\/Contents\/MacOS\/test<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Nat\u00fcrlich ist es kein Problem auch Qt Programme als UB&#8217;s (Universal Binaries) zu erstellen. Allerdings ist es unter Qt 4.x wesentlich einfacher als unter Qt 3.x, weswegen ich die Vorgehensweise kurz getrennt darstelle UB&#8217;s mit Qt 3.3 Rein theoretisch kann man auch hier beide Zielplattformen (ppc und i386) auf einer Maschine erstellen, was aber zus\u00e4tzlichen &hellip; <a href=\"https:\/\/www.instruyete.org\/?p=60\" class=\"more-link\"><span class=\"screen-reader-text\">Qt Programme als Universal Binaries erstellen<\/span> weiterlesen<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,7],"tags":[],"class_list":["post-60","post","type-post","status-publish","format-standard","hentry","category-macos","category-unix"],"_links":{"self":[{"href":"https:\/\/www.instruyete.org\/index.php?rest_route=\/wp\/v2\/posts\/60","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.instruyete.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.instruyete.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.instruyete.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.instruyete.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=60"}],"version-history":[{"count":0,"href":"https:\/\/www.instruyete.org\/index.php?rest_route=\/wp\/v2\/posts\/60\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.instruyete.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=60"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.instruyete.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=60"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.instruyete.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=60"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}