Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross-compiling #21

Closed
nightsky30 opened this issue Sep 30, 2019 · 8 comments
Closed

Cross-compiling #21

nightsky30 opened this issue Sep 30, 2019 · 8 comments
Assignees
Labels
enhancement New feature or request research Look into solutions

Comments

@nightsky30
Copy link
Owner

nightsky30 commented Sep 30, 2019

Cross-compile g++

Windows:
https://stackoverflow.com/questions/2033997/how-to-compile-for-windows-on-linux-with-gcc-g

MacOS:
https://stackoverflow.com/questions/693952/how-to-compile-for-os-x-in-linux-or-windows

Good Info:
https://wiki.qt.io/Building_Qt_5_from_Git
https://forum.qt.io/topic/94742/cross-compile-and-deploy-from-linux-to-windows/9

Have to build qt5 for Windows using mingw to satisfy the qt5 deps before building koikoi for Windows with said qt5 deps.

From Delphi251189:

Simply You can use mxe for cross compilation from linux to Windows targets (not only qt, its supports the wide range of varios open-source libraries and tools like qt, sdl, wxwidgets, cryptopp and others)
Just type:
git clone https://github.com/mxe/mxe.git
cd mxe
make qt qt5 MXE_TARGETS='x86_64-w64-mingw32.shared i686-w64-mingw32.shared x86_64-w64-mingw32.static i686-w64-mingw32.static'

Cross toolchain building process may take up to 10 hours (on my cor i5-2350 laptop) but it will download and build qt4.8.7 and the latest (5.11.1 in my case) qt versions (and dependencies also ) for mingw 32 and 64 bit static and shared respectively. After You can add new kit in QtCreator assuming the path of mingw compiler and qmake executable (mxe builds compiler too, no need to install mingw seperatly) .
That's all, u can compile existing qt project into MS Windows exe file.

About running windows exe-s in Linux - just install WINE

Other junks:
https://mesonbuild.com/Cross-compilation.html
https://github.com/pololu/nixcrpkgs
https://packages.ubuntu.com/search?mode=filename&suite=eoan&section=all&arch=any&keywords=mingw+gcc&searchon=contents

@nightsky30 nightsky30 added the enhancement New feature or request label Oct 6, 2019
@nightsky30
Copy link
Owner Author

nightsky30 commented Oct 7, 2019

Meson might allow this...
https://mesonbuild.com/Cross-compilation.html

@nightsky30
Copy link
Owner Author

meson srcdir builddir --cross-file cross_file.txt

@nightsky30
Copy link
Owner Author

nightsky30 commented Oct 8, 2019

Files added: commit 026a807
Paths/binaries fixed: commit dddca5c

@nightsky30
Copy link
Owner Author

nightsky30 commented Oct 8, 2019

sudo apt install mingw-w64 mingw-w64-tools

meson koikoi koikoi/builddir_x64 --cross-file koikoi/misc/meson.cross.win.x64

Build type: cross build
Project name: koikoi
Project version: undefined
C++ compiler for the build machine: c++ (gcc 9.2.1 "c++ (Ubuntu 9.2.1-8ubuntu1) 9.2.1 20190909")
C++ compiler for the host machine: /usr/bin/x86_64-w64-mingw32-g++ (gcc 9.2.0 "x86_64-w64-mingw32-g++ (GCC) 9.2-win32 20190909")
Host machine cpu family: x86_64
Host machine cpu: i686
Target machine cpu family: x86_64
Target machine cpu: i686
Build machine cpu family: x86_64
Build machine cpu: x86_64
WARNING: rcc dependencies will not work reliably until this upstream issue is fixed: https://bugreports.qt.io/browse/QTBUG-45460
Found pkg-config: /usr/bin/x86_64-w64-mingw32-pkg-config (1.6.3)
Found qmake: /usr/bin/qmake (5.12.4)
Run-time dependency qt5 (modules: Widgets) found: NO (tried pkgconfig, qmake-qt5 and qmake)

meson.build:7:0: ERROR: Dependency "qt5" not found, tried pkgconfig, qmake-qt5 and qmake

@nightsky30 nightsky30 added the research Look into solutions label Oct 13, 2019
@nightsky30 nightsky30 self-assigned this Oct 13, 2019
@nightsky30
Copy link
Owner Author

nightsky30 commented Oct 15, 2019

See #11 (comment) on tools...

@nightsky30
Copy link
Owner Author

nightsky30 commented Oct 15, 2019

sudo apt install
autoconf
automake
autopoint
bash
bison
bzip2
flex
g++
g++-multilib
gettext
git
gperf
intltool
libc6-dev-i386
libgdk-pixbuf2.0-dev
libltdl-dev
libssl-dev
libtool-bin
libxml-parser-perl
lzip
make
openssl
p7zip-full
patch
perl
pkg-config
python
ruby
sed
unzip
wget
xz-utils

sudo apt-mark auto
autoconf
automake
autopoint
bash
bison
bzip2
flex
g++
g++-multilib
gettext
git
gperf
intltool
libc6-dev-i386
libgdk-pixbuf2.0-dev
libltdl-dev
libssl-dev
libtool-bin
libxml-parser-perl
lzip
make
openssl
p7zip-full
patch
perl
pkg-config
python
ruby
sed
unzip
wget
xz-utils

https://github.com/mxe/mxe

mkdir mxe_build
cd mxe_build
git clone git@github.com:mxe/mxe.git
cd mxe
make qt5 MXE_TARGETS='x86_64-w64-mingw32.shared i686-w64-mingw32.shared x86_64-w64-mingw32.static i686-w64-mingw32.static'

Ref: https://mxe.cc/#tutorial

@nightsky30
Copy link
Owner Author

Compiling .exe files, but not certain it is linking properly...

@nightsky30
Copy link
Owner Author

In liu of cross-compiling, just installed Qt in Win10 VM and compiled there...

Looking into Qt Installer Framework. Maybe revisit this later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request research Look into solutions
Projects
None yet
Development

No branches or pull requests

1 participant