Paste number 155946: cross compile qt smokegen smokeqt commonqt

Paste number 155946: cross compile qt smokegen smokeqt commonqt
Pasted by: smokeink
When:3 years, 5 months ago
Share:Tweet this! |
Paste contents:
Raw Source | XML | Display As
-- How to cross compile qt, smokegen, smokeqt, commonqt --

We will use this great project for cross compilation:

git clone
cd mxe
before running the next command, you should check out ./src/ . If you want you can remove the no-phonon and the rest of no-whatsoever parameters, this way phonon and qwt would get compiled automatically. But for simplicity, if this is your first attempt, leave it as it is, you can later redo the entire process if you need these extra components. 
make qt qtsvg MXE_TARGETS='x86_64-w64-mingw32.shared'
edit .bashrc
export PATH=~/mxe/usr/bin:$PATH
export PKG_CONFIG_PATH_x86_64_w64_mingw32_shared=~/mxe/usr/lib/pkgconfig:~/mxe/usr/x86_64-w64-mingw32.shared/qt/lib/pkgconfig/


git clone
or better wget

(don't use this version git:// . Shinmera's version has a patch for x86_64)

cd smokegen
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=~/mxe/usr/x86_64-w64-mingw32.shared/share/cmake/mxe-conf.cmake -DCMAKE_INSTALL_PREFIX:PATH=/home/username/mxe/usr/x86_64-w64-mingw32.shared/ -H.. -B.
make && make install

sudo pacman -S lib32-ncurses mpg123 # on archlinux, needed for wine

sudo apt-get install wine # on ubuntu

Run this, to copy qt dlls to a place where wine can detect them:
find ~/mxe/usr/x86_64-w64-mingw32.shared/qt/lib/ -name "*dll" -print0 | xargs -0 -I {} cp {} ~/.wine/drive_c/windows/system32

git clone
or better

cd smokeqt
mkdir build && cd build

Create a new file ~/cache.cmake and inser this content
set( qtdefines_run 
     CACHE STRING "Result from TRY_RUN" FORCE)

set( qtdefines_run__TRYRUN_OUTPUT 
     "Could not run executable (qtdefines_run__TRYRUN_OUTPUT)"
     CACHE STRING "Output from TRY_RUN" FORCE)

Some people in  #qt freenode said that QAccessibleBridgePlugin class is not part of the Windows build, and not part of Mac build either (so it's only for X11). Same for QWS and QPA.
To fix this, we have to delete this line smokeqt/qtgui/smokeconfig.xml:66:        <class>QAccessibleBridgePlugin</class>

After that we can run cmake:
cmake -C ~/cache.txt -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/username/mxe/usr/x86_64-w64-mingw32.shared/ -DCMAKE_TOOLCHAIN_FILE=~/mxe/usr/x86_64-w64-mingw32.shared/share/cmake/mxe-conf.cmake -DCMAKE_MODULE_PATH=~/smokegen/cmake -DSmoke_DIR=~/smokegen/cmake -DSMOKE_BASE_LIBRARY=~/smokegen/build/bin/smokebase.dll -H.. -B.

or with QThread support (not working...):
cmake -C ~/cache.txt -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/username/mxe/usr/x86_64-w64-mingw32.shared/ -DCMAKE_TOOLCHAIN_FILE=~/mxe/usr/x86_64-w64-mingw32.shared/share/cmake/mxe-conf.cmake -DCMAKE_MODULE_PATH=~/smokegen/cmake -DSmoke_DIR=~/smokegen/cmake -DSMOKE_BASE_LIBRARY=~/smokegen/build/bin/smokebase.dll -DQT_THREAD_SUPPORT=1 -H.. -B.

Then we start building:

If your system doesn't run windows exe with wine by default (as it does on ubuntu), u'll get this

[  1%] Generating smokedata.cpp, x_1.cpp, x_2.cpp, x_3.cpp, x_4.cpp, x_5.cpp, x_6.cpp, x_7.cpp, x_8.cpp, x_9.cpp, x_10.cpp, x_11.cpp, x_12.cpp, x_13.cpp, x_14.cpp, x_15.cpp, x_16.cpp, x_17.cpp, x_18.cpp, x_19.cpp, x_20.cpp
/bin/sh: /home/username/mxe/usr/x86_64-w64-mingw32.shared/bin/smokegen.exe: cannot execute binary file: ?�煼琛屾??煎??��
qtcore/CMakeFiles/smokeqtcore.dir/build.make:54: recipe for target 'qtcore/smokedata.cpp' failed

Check here the section "Using Wine as an interpreter for Win16/Win32 binaries"

git clone

cd libcommonqt
edit commonqt.cpp and apply this patch:
line 265: const char *strings_ = (const char *)strings;
          QMetaObject tmp = { { parent, strings_, data, 0 } };

/home/username/mxe/usr/bin/x86_64-w64-mingw32.shared-g++ commonqt.cpp -fmax-errors=5 -I/home/username/mxe/usr/x86_64-w64-mingw32.shared/include/ -I/home/username/mxe/usr/x86_64-w64-mingw32.shared/qt/include/ -I/home/username/mxe/usr/x86_64-w64-mingw32.shared/qt/include/QtCore -I/home/username/mxe/usr/x86_64-w64-mingw32.shared/qt/include/QtGui -c

/home/username/mxe/usr/bin/x86_64-w64-mingw32.shared-g++ -shared -o commonqt.dll commonqt.o -Wl,--out-implib,libcommonqt.a -lsmokeqtcore -lsmokebase -L/home/username/mxe/usr/x86_64-w64-mingw32.shared/qt/lib/ -lQtCore4 -lQtGui4

That's it, you now have all the libs compiled: the advantage of this method is that you don't have to mess up with virtual machines & visual studio. Also, libs compiled with visual studio 2012 won't run on windows xp (there is a patch for this, though). Cross compiling makes this process somewhat smoother.

You can now code in lisp qt applications that run on windows. EnJOY ! :)

References:  How to compile these stuff using Visual Studio  Intro to GUIs in lisp using Qtools

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.