Crosscompilation on Mac: Unterschied zwischen den Versionen

Aus ARTECO Wiki
Zur Navigation springen Zur Suche springen
Zeile 54: Zeile 54:
 
### diff -u src-5.4.2/qtbase/src/network/access/qhttpnetworkconnection.cpp src-5.4.2/qtbase/src/network/access/qhttpnetworkconnection.cpp.new > ./network.patch
 
### diff -u src-5.4.2/qtbase/src/network/access/qhttpnetworkconnection.cpp src-5.4.2/qtbase/src/network/access/qhttpnetworkconnection.cpp.new > ./network.patch
 
<pre>
 
<pre>
 +
--- a/src/network/access/qhttpnetworkconnection.cpp 2015-04-06 22:55:41.000000000 +0200
 +
+++ b/src/network/access/qhttpnetworkconnection.cpp 2015-04-06 23:04:54.000000000 +0200
 +
@@ -60,7 +60,7 @@
 +
 +
QT_BEGIN_NAMESPACE
 +
 +
-const int QHttpNetworkConnectionPrivate::defaultHttpChannelCount = 6;
 +
+const int QHttpNetworkConnectionPrivate::defaultHttpChannelCount = 10;
 +
 +
// The pipeline length. So there will be 4 requests in flight.
 +
const int QHttpNetworkConnectionPrivate::defaultPipelineLength = 3;
 +
 
--- a/src/printsupport/kernel/qpaintengine_alpha.cpp 2015-02-17 05:56:38.000000000 +0100
 
--- a/src/printsupport/kernel/qpaintengine_alpha.cpp 2015-02-17 05:56:38.000000000 +0100
+++ b/src/printsupport/kernel/qpaintengine_alpha_new.cpp 2015-03-24 15:25:17.000000000 +0100
+
+++ b/src/printsupport/kernel/qpaintengine_alpha.cpp 2015-03-24 15:25:17.000000000 +0100
 
@@ -351,10 +351,7 @@
 
@@ -351,10 +351,7 @@
 
         d->m_picpainter->setOpacity(painter()->opacity());
 
         d->m_picpainter->setOpacity(painter()->opacity());
Zeile 70: Zeile 82:
 
   
 
   
  
-- a/mkspecs/win32-g++/qmake.conf 2015-01-09 15:53:39.000000000 +0100
+
--- a/mkspecs/win32-g++/qmake.conf 2015-01-09 15:53:39.000000000 +0100
 
+++ b/mkspecs/win32-g++/qmake.conf 2015-01-09 15:49:32.000000000 +0100
 
+++ b/mkspecs/win32-g++/qmake.conf 2015-01-09 15:49:32.000000000 +0100
 
@@ -29,7 +29,7 @@
 
@@ -29,7 +29,7 @@
Zeile 95: Zeile 107:
 
  QMAKE_LFLAGS_WINDOWS    = -Wl,-subsystem,windows
 
  QMAKE_LFLAGS_WINDOWS    = -Wl,-subsystem,windows
 
   
 
   
  </pre>
+
   
 +
</pre>
 
# prepare win32 build
 
# prepare win32 build
 
## check buildscript for correct paths (found in osc svn)
 
## check buildscript for correct paths (found in osc svn)

Version vom 21. Juli 2015, 16:40 Uhr

  1. install xcode: http://itunes.apple.com/us/app/xcode/id497799835
    1. install xcode command line tools: xcode-select --install
    2. agree to Xcode license in Terminal: sudo xcodebuild -license
  2. install macports
    1. https://www.macports.org/install.php
  3. sudo port install glib2 intltool p5-xml-parser gpatch scons wget xz
  4. clone repo
    1. git clone https://github.com/mxe/mxe.git
    2. git checkout to https://github.com/mxe/mxe/commit/7b610fddfaabbe15c797a7473ac12647f3190b3a
    3. libgpg fix https://github.com/mxe/mxe/commit/cdbe8f2abf992cf9878c9d91f059dc69d3159b4f
  5. make build-requirements from within mxe dir
  6. change settings.mk for desired targets
### This is a template of configuration file for MXE. See
# index.html for more extensive documentations.

# This variable controls the number of compilation processes
# within one package ("intra-package parallelism").
JOBS := 4

# This variable controls the targets that will build.
MXE_TARGETS :=  i686-w64-mingw32.shared
#MXE_TARGETS :=  i686-w64-mingw32.static i686-w64-mingw32.shared  x86_64-w64-mingw32.static x86_64-w64-mingw32.shared

# This variable controls the download mirror for SourceForge,
# when it is used. Enabling the value below means auto.
#SOURCEFORGE_MIRROR := downloads.sourceforge.net

# The three lines below makes `make` build these "local
# packages" instead of all packages.
#LOCAL_PKG_LIST := boost curl file flac lzo pthreads vorbis wxwidgets
#.DEFAULT local-pkg-list:
#local-pkg-list: $(LOCAL_PKG_LIST)

  1. build gcc first time
    1. make gcc winpthreads
    2. http://stackoverflow.com/questions/24417906/mingw-vs-mingw-w64-vs-msvc-vc-in-cross-compiling
  2. change gcc.mk
    1. --enable-threads=posix
    2. add winpthreads to "$(PKG)_DEPS :="
  3. create patch for qtbase modul
    1. change mkspec for win32-g++ to add build-id and remove debug strip in release
      1. cp src-5.4.2/qtbase/mkspecs/win32-g++/qmake.conf src-5.4.2/qtbase/mkspecs/win32-g++/qmake.conf.new
      2. nano src-5.4.2/qtbase/mkspecs/win32-g++/qmake.conf.new
      3. diff -u src-5.4.2/qtbase/mkspecs/win32-g++/qmake.conf src-5.4.2/qtbase/mkspecs/win32-g++/qmake.conf.new > ./mkspec.patch
    2. fix printing
      1. cp src-5.4.2/qtbase/src/printsupport/kernel/qpaintengine_alpha.cpp src-5.4.2/qtbase/src/printsupport/kernel/qpaintengine_alpha.cpp.new
      2. nano src-5.4.2/qtbase/src/printsupport/kernel/qpaintengine_alpha.cpp.new
      3. diff -u src-5.4.2/qtbase/mkspecs/win32-g++/qmake.conf src-5.4.2/qtbase/mkspecs/win32-g++/qmake.conf.new > ./print.patch
    3. increase concurrent connections
      1. cp src-5.4.2/qtbase/src/network/access/qhttpnetworkconnection.cpp src-5.4.2/qtbase/src/network/access/qhttpnetworkconnection.cpp.new
      2. nano src-5.4.2/qtbase/src/network/access/qhttpnetworkconnection.cpp.new
      3. diff -u src-5.4.2/qtbase/src/network/access/qhttpnetworkconnection.cpp src-5.4.2/qtbase/src/network/access/qhttpnetworkconnection.cpp.new > ./network.patch
--- a/src/network/access/qhttpnetworkconnection.cpp	2015-04-06 22:55:41.000000000 +0200
+++ b/src/network/access/qhttpnetworkconnection.cpp	2015-04-06 23:04:54.000000000 +0200
@@ -60,7 +60,7 @@
 
 QT_BEGIN_NAMESPACE
 
-const int QHttpNetworkConnectionPrivate::defaultHttpChannelCount = 6;
+const int QHttpNetworkConnectionPrivate::defaultHttpChannelCount = 10;
 
 // The pipeline length. So there will be 4 requests in flight.
 const int QHttpNetworkConnectionPrivate::defaultPipelineLength = 3;

--- a/src/printsupport/kernel/qpaintengine_alpha.cpp	2015-02-17 05:56:38.000000000 +0100
+++ b/src/printsupport/kernel/qpaintengine_alpha.cpp	2015-03-24 15:25:17.000000000 +0100
@@ -351,10 +351,7 @@
         d->m_picpainter->setOpacity(painter()->opacity());
         d->m_picpainter->setTransform(painter()->combinedTransform());
         d->m_picengine->syncState();
-        QPainterState &state = *d->m_picpainter->d_func()->state;
-        QPainter *oldPainter = state.painter;
-        state = *painter()->d_func()->state;
-        state.painter = oldPainter;
+        *d->m_picpainter->d_func()->state = *painter()->d_func()->state;
     }
 }
 
 

--- a/mkspecs/win32-g++/qmake.conf	2015-01-09 15:53:39.000000000 +0100
+++ b/mkspecs/win32-g++/qmake.conf	2015-01-09 15:49:32.000000000 +0100
@@ -29,7 +29,7 @@
 QMAKE_CFLAGS_DEPS       = -M
 QMAKE_CFLAGS_WARN_ON    = -Wall -Wextra
 QMAKE_CFLAGS_WARN_OFF   = -w
-QMAKE_CFLAGS_RELEASE    = -O2
+QMAKE_CFLAGS_RELEASE    = -O2 -g
 QMAKE_CFLAGS_DEBUG      = -g
 QMAKE_CFLAGS_YACC       = -Wno-unused -Wno-parentheses
 QMAKE_CFLAGS_SPLIT_SECTIONS = -ffunction-sections
@@ -67,10 +67,10 @@
 
 QMAKE_LINK              = $${CROSS_COMPILE}g++
 QMAKE_LINK_C            = $${CROSS_COMPILE}gcc
-QMAKE_LFLAGS            =
+QMAKE_LFLAGS            = -Wl,--build-id
 QMAKE_LFLAGS_EXCEPTIONS_ON = -mthreads
 QMAKE_LFLAGS_EXCEPTIONS_OFF =
-QMAKE_LFLAGS_RELEASE    = -Wl,-s
+QMAKE_LFLAGS_RELEASE    = 
 QMAKE_LFLAGS_DEBUG      =
 QMAKE_LFLAGS_CONSOLE    = -Wl,-subsystem,console
 QMAKE_LFLAGS_WINDOWS    = -Wl,-subsystem,windows
 
 
  1. prepare win32 build
    1. check buildscript for correct paths (found in osc svn)
    2. check mkspec in mxe qt for correct anti strip and debug settings
  2. build it
    1. make qtbase qtwebkit qtsensors qtserialport qtmultimedia qtlocation -j4
  3. prepare native mac build
    1. download qt source (http://www.qt.io/download/)
    2. update openssl port (port selfupdate & port install openssl)
    3. build qt
    4. OPENSSL_LIBS='-L/opt/local/lib -lssl -lcrypto' ./configure -prefix /Users/tommy/projekte/Qt/selfbin-5.4.0 -debug-and-release -force-debug-info -opensource -openssl-linked -continue -sdk macosx10.10 -nomake examples -pch
  4. build osc
    1. watch your folder structure, ther are some longlasting bugs in qmake when ur src dir is at same lvl as ur build dir.
      1. https://bugreports.qt.io/browse/QTCREATORBUG-12422
      2. https://bugreports.qt.io/browse/QTBUG-35431
      3. https://bugreports.qt.io/browse/QTBUG-21267
    2. if ur app bundle lacks an icon try moving your src folder down or up a level

Breakpad

  1. ensure your building with build-id, debug enabled and dwarf symbols (64bit TODO)
  2. git clone -b pecoff-dwarf-on-svn-rev-1434 https://github.com/jon-turney/google-breakpad.git
    1. ./fetch-svn-externals
    2. autoreconf -fvi
    3. ./configure && make
  3. you can now use the tools to analyze dumps
src/processor/minidump_stackwalk
usage: src/processor/minidump_stackwalk [-m|-s] <minidump-file> [symbol-path ...]
-m : Output in machine-readable format
-s : Output stack contents


Notes

  • http://qt-project.org/wiki/MinGW-64-bit
  • http://sourceforge.net/p/mingw-w64/bugs/344/
  • http://wiki.dwarfstd.org/index.php?title=Exception_Handling
    • Relationship with DWARF
      Although the C++ ABI data in the .eh_frame section uses the data format described by the DWARF Standard (with some extensions), this section (and other sections used by exception handling, such as .eh_frame_hdr and .gcc_except_table) are not defined by the DWARF Standard. The DWARF Standard does not describe the extensions to support exception handling nor the routines which must be called by a program to use this data. The DWARF Debugging Format Committee does not specify the contents of these sections or the functionality which must be provided by the language run time system to support exception handling.
      The .eh_frame section is not used for debugging. Whether it is generated or not is independent of whether DWARF debug data is generated. All DWARF data is contained in sections with names starting with .debug, which may be removed from a program without affecting the program's normal execution. It is common practice to "strip" debugging sections from a program before putting it into production, either to reduce the program size, make reverse engineering more difficult, or both.
      Removing the .eh_frame section (whether the DWARF .debug sections are left in place or not) has a high likelihood of adversely affecting a program's behaviour, especially when it encounters an unexpected condition.
      Unfortunately, it has been a common shorthand to refer to the C++ ABI exception handling methodology using .eh_frame with "DWARF exception handling," or similar phrases. Perhaps this because it is easier to say this than the unwieldy "C++ exception handling using the DWARF Call Frame Information format with extensions", or the misleading "C++ ABI for IA-64" or "SVR4 ABI AMD64 Processor Supplement", especially when discussing a processor other than Itanium or AMD-64. This leads to occasional confusion, where people may look at the DWARF Specification for a description of the C++ ABI exception handling method, or where vulnerabilities in the EH scheme are incorrectly characterized as DWARF vulnerabilities, as in the otherwise excellent paper mentioned below.

Stuff

Why doesn't mingw-w64 gcc support Dwarf-2 Exception Handling?

The Dwarf-2 EH implementation for Windows is not designed at all to work under 64-bit Windows applications. In win32 mode, the exception unwind handler cannot propagate through non-dw2 aware code, this means that any exception going through any non-dw2 aware "foreign frames" code will fail, including Windows system DLLs and DLLs built with Visual Studio. Dwarf-2 unwinding code in gcc inspects the x86 unwinding assembly and is unable to proceed without other dwarf-2 unwind information.

The SetJump LongJump method of exception handling works for most cases on both win32 and win64, except for general protection faults. Structured exception handling support in gcc is being developed to overcome the weaknesses of dw2 and sjlj. On win64, the unwind-information are placed in xdata-section and there is the .pdata (function descriptor table) instead of the stack. For win32, the chain of handlers are on stack and need to be saved/restored by real executed code.


qt-project.org/wiki/MinGW-64-bit

SJLJ (setjmp/longjmp): – available for 32 bit and 64 bit – not “zero-cost”: even if an exception isn’t thrown, it incurs a minor performance penalty (~15% in exception heavy code) – allows exceptions to traverse through e.g. windows callbacks

DWARF (DW2, dwarf-2) – available for 32 bit only – no permanent runtime overhead – needs whole call stack to be dwarf-enabled, which means exceptions cannot be thrown over e.g. Windows system DLLs.

SEH (zero overhead exception) – will be available for 64-bit GCC 4.8.

Native Mac

configure output

Configure summary

Build type: macx-clang (x86_64, CPU features: cx16 mmx sse sse2 sse3 ssse3)

Build options:

 Configuration .......... absolute_library_soname accessibility audio-backend avx avx2 build_all c++11 compile_examples concurrent corewlan cups debug debug_and_release force_debug_info freetype full-config getaddrinfo getifaddrs harfbuzz iconv ipv6ifname large-config largefile medium-config minimal-config nis no-pkg-config opengl openssl-linked pcre png precompile_header qpa qpa qt_framework reduce_exports release rpath shared small-config sse2 sse3 sse4_1 sse4_2 ssse3 system-zlib
 Build parts ............ libs tools
 Mode ................... debug and release (with debug info); default link: debug
 Using C++11 ............ yes
 Using gold linker....... no
 Using PCH .............. yes
 Target compiler supports:
   SSE2/SSE3/SSSE3 ...... yes/yes/yes
   SSE4.1/SSE4.2 ........ yes/yes
   AVX/AVX2 ............. yes/yes

Qt modules and options:

 Qt D-Bus ............... runtime
 Qt Concurrent .......... yes
 Qt GUI ................. yes
 Qt Widgets ............. yes
 Large File ............. yes
 QML debugging .......... yes
 Use system proxies ..... no

Support enabled for:

 Accessibility .......... yes
 ALSA ................... no
 CUPS ................... yes
 Evdev .................. no
 FontConfig ............. no
 FreeType ............... yes (bundled copy)
 Glib ................... no
 GTK theme .............. no
 HarfBuzz ............... yes (bundled copy)
 Iconv .................. yes
 ICU .................... no
 Image formats:
   GIF .................. yes (plugin, using bundled copy)
   JPEG ................. yes (plugin, using bundled copy)
   PNG .................. yes (in QtGui, using bundled copy)
 journald ............... no
 mtdev .................. no
 Networking:
   CoreWlan ............. yes
   getaddrinfo .......... yes
   getifaddrs ........... yes
   IPv6 ifname .......... yes
   OpenSSL .............. yes (linked to the libraries)
 NIS .................... yes
 OpenGL / OpenVG:
   EGL .................. no
   OpenGL ............... desktop
   OpenVG ............... no
 PCRE ................... yes (bundled copy)
 pkg-config ............. no
 PulseAudio ............. no
 QPA backends:
   DirectFB ............. no
   EGLFS ................ no
   KMS .................. no
   LinuxFB .............. no
   XCB .................. no
 Session management ..... yes
 SQL drivers:
   DB2 .................. no
   InterBase ............ no
   MySQL ................ no
   OCI .................. no
   ODBC ................. no
   PostgreSQL ........... no
   SQLite 2 ............. no
   SQLite ............... yes (plugin, using bundled copy)
   TDS .................. no
 udev ................... no
 xkbcommon .............. no
 zlib ................... yes (system library)