It doesn't seem to be possible to do cross compilation, at least from Linux:
$ GOOS=windows GOARCH=386 go build main.go
main.go:6:2: no buildable Go source files in /home/mixedcase/.go/src/github.com/therecipe/qt/core
main.go:7:2: no buildable Go source files in /home/mixedcase/.go/src/github.com/therecipe/qt/widgets
There are cgo files for the GOOS and GOARCH I try to compile to in both the "core" and "widgets" directory. Am I missing anything?
Hey
Yes, it's currently not supported by qtdeploy and I haven't done it myself.
But it should be possible with the raw go build tool, if you got a cross compiler and the qt libs + headers for the target os.
gen2brain did statically cross compile from linux to windows here: https://github.com/therecipe/qt/issues/55#issuecomment-250145672
But it's probably easier to just use a virtual machine.
@therecipe how about cross compiling to linux from Mac OS X?
@renannprado https://github.com/therecipe/qt/issues/63
It's now possible to cross compile for Windows on Debian/Ubuntu with MXE, which does provide prebuilt Qt packages + prebuilt cross compiler. https://github.com/therecipe/qt#linux-1
@renannprado I'm currently looking for a cross compiler or cross compile environment which also does provide prebuilt Qt packages for macOS. Otherwise it's necessary to compile Qt on your own, as I'm not sure if I can use the official prebuilt packages for cross compiling.
Or maybe I will have to create extra repos, where I can provide the prebuilt Qt packages + prebuilt cross compiler.
@therecipe
Or maybe I will have to create extra repos, where I can provide the prebuilt Qt packages + prebuilt cross compiler.
This sounds a better solution, you can name an organisation with these repositories like qt-pkg
@kataras
Thanks, that's a great Idea.
I will create an organisation once I start providing prebuilt packages.
I downloaded the main Dockerfile and subfolders. It seemed to get pretty far downloading everything then:
Processing triggers for libc-bin (2.19-0ubuntu6.9) ...
---> 28776f3e5e01
Removing intermediate container 354f5a02d0b8
Step 9 : RUN rm /usr/bin/gcc; sudo ln -s /usr/bin/gcc-5 /usr/bin/gcc
---> Running in 1eb8fdcfd230
---> 4ddce78aeb81
Removing intermediate container 1eb8fdcfd230
Step 10 : RUN rm /usr/bin/g++; sudo ln -s /usr/bin/g++-5 /usr/bin/g++
---> Running in eb4db60e42b5
---> c3da56bae79a
Removing intermediate container eb4db60e42b5
Step 11 : ENV QT qt-opensource-linux-x64-android-5.7.0.run
---> Running in 65eb25e4fef6
---> d41483003e50
Removing intermediate container 65eb25e4fef6
Step 12 : ENV QT_SCRIPT iscript.qs
---> Running in 4b8aeff87b5c
---> a3ae3c864ebc
Removing intermediate container 4b8aeff87b5c
Step 13 : ENV QT_QPA_PLATFORM minimal
---> Running in 3b901fbd15c8
---> eceaab6fa91e
Removing intermediate container 3b901fbd15c8
Step 14 : RUN curl -sL --retry 10 --retry-delay 10 -o /tmp/$QT https://download.qt.io/official_releases/qt/5.7/5.7.0/$QT && chmod +x /tmp/$QT && curl -sL --retry 10 --retry-delay 10 -o /tmp/$QT_SCRIPT https://raw.githubusercontent.com/therecipe/qt/master/internal/ci/iscript.qs && /tmp/$QT --script /tmp/$QT_SCRIPT && rm -f /tmp/$QT && rm -f /tmp/$QT_SCRIPT
---> Running in ad3f424c20ba
Killed
The command '/bin/sh -c curl -sL --retry 10 --retry-delay 10 -o /tmp/$QT https://download.qt.io/official_releases/qt/5.7/5.7.0/$QT && chmod +x /tmp/$QT && curl -sL --retry 10 --retry-delay 10 -o /tmp/$QT_SCRIPT https://raw.githubusercontent.com/therecipe/qt/master/internal/ci/iscript.qs && /tmp/$QT --script /tmp/$QT_SCRIPT && rm -f /tmp/$QT && rm -f /tmp/$QT_SCRIPT' returned a non-zero code: 137
localhost:/docker-qt#
Host OS Alpine 64-bit 3.4.2
localhost:/docker-qt# docker version
Client:
Version: 1.12.1
API version: 1.24
Go version: go1.7.1
Git commit: v1.12.1
Built:
OS/Arch: linux/amd64
Server:
Version: 1.12.1
API version: 1.24
Go version: go1.7.1
Git commit: v1.12.1
Built:
OS/Arch: linux/amd64
@5k3105
Maybe the download timed out, could you try it again?
Alternatively you can get the current image with docker pull therecipe/qt:base
Also docker pull therecipe/qt:base_android for android dev and
docker pull therecipe/qt:base_windows for windows dev
But I'm currently working on the images and the integration into qtdeploy, so everything is still buggy. I will update the readme, once I'm sure it won't crash immediately :)
Yes. It ran the second time, sorry.
So I understand - the base image is linux dev only? The base windows is windows dev only?
Thanks again tr.
Hijacking on @5k3105 request for information... Which Qt distribution is the Android one? The Linux+Android distrib?
I planned to use the following scheme:
docker pull therecipe/qt:base for linux development
docker pull therecipe/qt:base_android for android development (+ linux development)
docker pull therecipe/qt:base_windows for windows development (+ linux development)
In the end you will just need to pull the needed image and then invoke
qtdeploy build linux path/to/project docker
or
qtdeploy build android path/to/project docker
or
qtdeploy build windows path/to/project docker
from your host system.
Or simply use docker run ... and then qtdeploy inside the container.
You will also be able to test all the example with
setup.sh linux-docker
or
setup.sh android-docker
or
setup.sh windows-docker
from your host system.
But I'm currently working on this and therefore it may or may not work.
Sounds great. Please let us know when it's ready to test :)
Docker Images are currently being built https://hub.docker.com/r/therecipe/qt/tags/ :)
And I also updated the readme https://github.com/therecipe/qt#docker
It should work but I did only test it on macOS, so I would appreciate feedback if it works on Windows and Linux as well.
I'm closing this for now, as it's mainly solved with the Docker images.
@renannprado cross compilation for macOS on Linux is on my todo list.
Hi @therecipe! Thanks a lot for your work!
Do you have an any progress in cross compilation for macOS on Linux?
@mordvinov
Hey, thank you :)
No, unfortunately I haven't made any progress in that direction so far.
But I looked into the options, and it might be possible to use:
https://github.com/tpoechtrager/osxcross
But I had no time to test it yet.
And this would also require you have at least access to a macOS system at some point, to extract the Xcode SDKs.
I will try to look into it this month.
Most helpful comment
I'm closing this for now, as it's mainly solved with the Docker images.
@renannprado cross compilation for macOS on Linux is on my todo list.