Qt shadow builds: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
m (It is not true that this is not available for windows)
 
(12 intermediate revisions by 5 users not shown)
Line 1: Line 1:
== How to set up shadow builds on OS X and Linux ==
Qt has a wonderful option: you can build Qt depending on your need from the same source code in many different flavors.
Qt has a wonderful option: you can build Qt depending on your need from the same source code in many different flavors.


Line 5: Line 7:
This way you build different versions of Qt on your development machine from the same source code.
This way you build different versions of Qt on your development machine from the same source code.


Unfortunately, this option is not available on Windows.
== How to set up shadow builds on Windows ==
 
= How to set up shadow builds on Windows =


While developing for Windows you might want to compile a version of Qt for several different platforms and SDKs. In order to create those different builds of Qt you do not have to copy the whole Qt package or the Qt source. You are able to create multiple Qt builds from a single source tree. Such builds are called shadow builds.
While developing for Windows you might want to compile a version of Qt for several different platforms and SDKs. In order to create those different builds of Qt you do not have to copy the whole Qt package or the Qt source. You are able to create multiple Qt builds from a single source tree. Such builds are called shadow builds.
Line 13: Line 13:
Basically a shadow build is created by calling configure.exe from a different directory.
Basically a shadow build is created by calling configure.exe from a different directory.


To make sure that the shadow build compiles correctly it is important that you following these guidelines:<br />* Required Build tools : Get &amp; Install either MSYS or [[MSYS2]] shell (do not use both, unless you know what you are doing).<br />'''''' Toolchains/Compilers : Either get Visual Studio, or, MinGW, or, &quot;MinGW-w64&amp;quot;:https://wiki.qt.io/MinGW-64-bit toolchains, (or get all of them, based on your need &amp; target), separately from their official websites &amp; install, or, get &amp; Install MinGW-w64 (64bit &amp; 32bit) toolchains inside MSYS2-shell. And add their directory location in the PATH environment variable.<br />'''''' Option-A : Either get Perl, Ruby, Python, msysgit, 7zip separately from their official site and install into separate directories, and add each separate directories into the PATH. (&quot;ActivePerl&amp;quot;:http://www.activestate.com/Products/activeperl/index.mhtml , &quot;StrawberryPerl&amp;quot;:http://strawberryperl.com/ , etc are a popular distribution of Perl on Windows).<br />'''''' Option-B : or, get &amp; install Perl, Ruby, Python, git, 7pzip, etc inside [[MSYS2]]-shell with just one command and add just one directory location in PATH.<br />'''''' Get &amp; install other build related tools, SDKs, dependencies, etc which you need for your target platform(s). And add their directory location in PATH and also add other build related environment variables (like INCLUDE, LIB, LIBPATH, DEV, QTDIR, etc). See Qt build related other articles. For example, you may need support for &quot;OpenSSL&amp;quot;:, &quot;ICU&amp;quot;:https://wiki.qt.io/Compiling-ICU (Unicode), etc.<br />'''* Bring &amp;#37;SystemRoot&amp;amp;#37; location (its $SYSTEMROOT inside cygwin/bash/msys2) in beginning of PATH:<br />''' If you are using Cmd-Shell, run this command:<br /><code><br />set PATH=&amp;#37;SystemRoot&amp;amp;#37;;&amp;#37;SystemRoot&amp;amp;#37;32;&amp;#37;PATH&amp;amp;#37;<br /></code><br />'''''' If you are using [[MSYS2]]-Shell, run this command:<br /><code><br />windows2unix() &amp;#123; local pathPcs=() split pathTmp IFS=&amp;#92;&amp;#59;&amp;#59; read -ra split &amp;#60;&amp;#60;&amp;#60; &amp;#34;&amp;#36;'''&amp;#34;&amp;#59; for pathTmp in &amp;#34;&amp;#36;&amp;#123;split&amp;amp;#91;</code>&amp;#93;,&amp;#125;&amp;#34;&amp;#59; do pathPcs&amp;amp;#43;=( &amp;#34;&amp;#47;&amp;#36;&amp;#123;pathTmp&amp;amp;#47;&amp;#47;&amp;#43;(&amp;#91;:&amp;#92;&amp;#92;&amp;#93;)&amp;#47;&amp;#47;&amp;#125;&amp;#34; )&amp;#59; done&amp;amp;#59; echo &quot;&amp;#36;&amp;#123;pathPcs&amp;amp;#91;'''&amp;#93;&amp;#125;&amp;#34;&amp;#59; &amp;#125;&amp;#59; systemrootP=&amp;#36;(windows2unix &amp;#34;&amp;#36;SYSTEMROOT&amp;amp;#34;)&amp;#59; export PATH=&quot;&amp;#36;systemrootP:&amp;#36;systemrootP/system32:&amp;#36;PATH&amp;quot;<br /><code><br />'''* If you are using jom, fart, etc tools then:<br />''' If you are using Cmd-Shell, run this command:<br /></code><br />set PATH=C:;C:;&amp;#37;PATH&amp;amp;#37;<br /><code><br />'''''' If you are using [[MSYS2]]-Shell, run this command:<br /></code><br />export PATH=&quot;/c/Qt/tools/jom:/c/Qt/tools/fart:&amp;#36;PATH&amp;quot;<br /><code><br />'''* set the PATH<br />''' If you are using Cmd-shell, then adjust &amp; run/execute below command:<br /></code><br />set PATH=C:-w64\64bit\bin;C:-perl\64bit\perl\bin;C:-perl\64bit\c\bin;C:<s>perl\64bit\c\x86_64-w64-mingw32\bin;C:27;C:64bit\bin;&amp;#37;PATH&amp;amp;#37;<br /><code><br />'''''' If you are using MSYS2-shell (or MSYS-shell), then adjust &amp; run/execute below command:<br /></code><br />export PATH=&quot;/c/msys2/mingw64/bin:/c/msys2/usr/bin:&amp;#36;PATH&amp;quot;<br /><code><br />* The original Qt source package must be left untouched</s> the &quot;configure&amp;quot; must never have been run inside the source tree directory.<br />'''''' For example, lets assume, we are handling with Qt version number &amp;#37;VERSION&amp;amp;#37;, where &amp;#37;VERSION&amp;amp;#37; variable contains version number 5. So we will place our source files in this directory: C:&amp;#37;VERSION&amp;amp;#37;_src which means C:5_src (/c/Qt/Qt5_src).<br />'''* To set version number run/execute below command, for Cmd-shell:<br /></code><br />set VERSION=5<br /><code><br />'''* To set version number run/execute below command, for MSYS2-shell:<br /></code><br />export VERSION=5<br /><code><br />'''* If you are using windows Cmd-shell, then you need to run/execute similar commands<br /></code><br />mkdir C:mkdir C:&amp;#37;VERSION&amp;amp;#37;_src<br /><code><br />'''* If you are using [[MSYS2]]-shell or MSYS shell, then you need to run/execute similar commands<br /></code><br />mkdir /c/Qt<br />mkdir /c/Qt/Qt&amp;amp;#36;{VERSION}_src<br /><code><br />* With Qt5, the code has to be checked out of the git repository, otherwise the out of source build will fail as syncqt is not executed.<br />* Avoid using &quot;release&amp;quot; and &quot;debug&amp;quot; in the path to the shadow build directory. (This is an internal limitation of the build system.)<br />* So lets assume you have installed Qt in C:&amp;#37;VERSION&amp;amp;#37;_src and you want to create a shadow build in C:-Qt5-shadow:<br />'''''' Make sure the environment variables for your build &amp; target platform related compiler/toolchains, tools, dependencies, etc are set.<br />'''* For example, in Cmd-shell:<br /></code><br />set LANG=en<br /><code><br />'''* For example, in MSYS2-shell:<br /></code><br />export LANG=en<br /><code><br />'''* Visual Studio includes vcvars32.bat for that purpose - or simply use the &quot;Visual Studio Command Prompt&amp;quot; from the Start menu.<br />* Now navigate and GO INSIDE into your shadow build directory and run the &quot;configure&amp;quot;:<br />''' If you are using Cmd-shell:<br /></code><br />cd C:-Qt5-shadow<br />C:&amp;#37;VERSION&amp;amp;#37;_src\configure.exe -xplatform wincewm50pocket-msvc2005 -prefix &amp;#37;INSTALLDIR&amp;amp;#37;<br /><code><br /> Adjust above command for your target platform, above is for building Qt5 for Windows CE platform.<br />'''''' If you are using MSYS2-shell (or MSYS-shell) :<br /></code><br />cd /c/Qt/mobile-Qt5-shadow<br />/c/Qt/Qt&amp;amp;#36;{VERSION}_src\configure.exe -xplatform wincewm50pocket-msvc2005 -prefix &amp;#36;INSTALLDIR<br /><code><br /> Adjust above command for your target platform, above is for building Qt5 for Windows CE platform.<br />* Finally, to build the shadow build, you may use nmake or jom or mingw32-make. In below example, we are showing command for nmake only:<br /></code><br />nmake<br /><code><br />* That's all. You have successfully created a shadow build of Qt inside C:-Qt5-shadow.<br />* Now you can call &quot;nmake install&amp;quot; and get a clean installation of Qt inside INSTALLDIR.
To make sure that the shadow build compiles correctly it is important that you following these guidelines:
* When using GCC toolchains on Windows (MinGW, Android NDK, etc.) take into account that there is a restrictions on a build path prefix length [https://bugreports.qt.io/browse/QTBUG-52242 QTBUG-52242].
* Required Build tools : Get & Install either MSYS or [[MSYS2]] shell (do not use both, unless you know what you are doing).
* Toolchains/Compilers : Either get Visual Studio, or, MinGW, or, [https://wiki.qt.io/MinGW-64-bit MinGW-w64] toolchains, (or get all of them, based on your need & target), separately from their official websites & install, or, get & Install MinGW-w64 (64bit & 32bit) toolchains inside MSYS2-shell. And add their directory location in the PATH environment variable.
* Option-A : Either get Perl, Ruby, Python, msysgit, 7zip separately from their official site and install into separate directories, and add each separate directories into the PATH. ([http://www.activestate.com/Products/activeperl/index.mhtml ActivePerl] , [http://strawberryperl.com/ StrawberryPerl] , etc are a popular distribution of Perl on Windows).
* Option-B : or, get & install Perl, Ruby, Python, git, 7pzip, etc inside [[MSYS2]]-shell with just one command and add just one directory location in PATH.
* Get & install other build related tools, SDKs, dependencies, etc which you need for your target platform(s). And add their directory location in PATH and also add other build related environment variables (like INCLUDE, LIB, LIBPATH, DEV, QTDIR, etc). See Qt build related other articles. For example, you may need support for "OpenSSL":, [https://wiki.qt.io/Compiling-ICU ICU] (Unicode), etc.
* Bring %SystemRoot% location (its $SYSTEMROOT inside cygwin/bash/msys2) in beginning of PATH:
* If you are using Cmd-Shell, run this command:
<code>
set PATH=%SystemRoot%;%SystemRoot%32;%PATH%
</code>
* If you are using [[MSYS2]]-Shell, run this command:
<code>
windows2unix() { local pathPcs=() split pathTmp IFS=\;; read -ra split <<< "$'''"; for pathTmp in "${split[@],}"; do pathPcs+=( "/${pathTmp//+([:\\])//}" ); done; echo "${pathPcs[''']}"; }; systemrootP=$(windows2unix "$SYSTEMROOT"); export PATH="$systemrootP:$systemrootP/system32:$PATH"
</code>
* If you are using jom, fart, etc tools then:
* If you are using Cmd-Shell, run this command:
<code>
set PATH=C:;C:;%PATH%
</code>
* If you are using [[MSYS2]]-Shell, run this command:
<code>
export PATH="/c/Qt/tools/jom:/c/Qt/tools/fart:$PATH"
</code>
* set the PATH
* If you are using Cmd-shell, then adjust & run/execute below command:
<code>
set PATH=C:-w64\64bit\bin;C:-perl\64bit\perl\bin;C:-perl\64bit\c\bin;C:-perl\64bit\c\x86_64-w64-mingw32\bin;C:27;C:64bit\bin;%PATH%
</code>
* If you are using MSYS2-shell (or MSYS-shell), then adjust & run/execute below command:
<code>
export PATH="/c/msys2/mingw64/bin:/c/msys2/usr/bin:$PATH"
</code>
* The original Qt source package must be left untouched- the "configure" must never have been run inside the source tree directory.
* For example, lets assume, we are handling with Qt version number %VERSION%, where %VERSION% variable contains version number 5. So we will place our source files in this directory: C:%VERSION%_src which means C:5_src (/c/Qt/Qt5_src).
* To set version number run/execute below command, for Cmd-shell:
<code>
set VERSION=5
</code>
* To set version number run/execute below command, for MSYS2-shell:
<code>
export VERSION=5
</code>
* If you are using windows Cmd-shell, then you need to run/execute similar commands
<code>
mkdir C:mkdir C:%VERSION%_src
</code>
* If you are using [[MSYS2]]-shell or MSYS shell, then you need to run/execute similar commands
<code>
mkdir /c/Qt
mkdir /c/Qt/Qt${VERSION}_src
</code>
* With Qt5, the code has to be checked out of the git repository, otherwise the out of source build will fail as syncqt is not executed.
* Avoid using "release" and "debug" in the path to the shadow build directory. (This is an internal limitation of the build system.)
* So lets assume you have installed Qt in C:%VERSION%_src and you want to create a shadow build in C:-Qt5-shadow:
* Make sure the environment variables for your build & target platform related compiler/toolchains, tools, dependencies, etc are set.
* For example, in Cmd-shell:
<code>
set LANG=en
</code>
* For example, in MSYS2-shell:
<code>
export LANG=en
</code>
* Visual Studio includes vcvars32.bat for that purpose - or simply use the "Visual Studio Command Prompt" from the Start menu.
* Now navigate and GO INSIDE into your shadow build directory and run the "configure":
* If you are using Cmd-shell:
<code>
cd C:-Qt5-shadow
C:%VERSION%_src\configure.exe -xplatform wincewm50pocket-msvc2005 -prefix %INSTALLDIR%
</code>
Adjust above command for your target platform, above is for building Qt5 for Windows CE platform.
* If you are using MSYS2-shell (or MSYS-shell) :
<code>
cd /c/Qt/mobile-Qt5-shadow
/c/Qt/Qt${VERSION}_src\configure.exe -xplatform wincewm50pocket-msvc2005 -prefix $INSTALLDIR
</code>
* Adjust above command for your target platform, above is for building Qt5 for Windows CE platform.
* Finally, to build the shadow build, you may use nmake or jom or mingw32-make. In below example, we are showing command for nmake only:
<code>
nmake
</code>
* That's all. You have successfully created a shadow build of Qt inside C:-Qt5-shadow.
* Now you can call "nmake install" and get a clean installation of Qt inside INSTALLDIR.


[[Category:HowTo]]
[[Category:HowTo]]

Latest revision as of 06:24, 12 March 2017

How to set up shadow builds on OS X and Linux

Qt has a wonderful option: you can build Qt depending on your need from the same source code in many different flavors.

It come with a -prefix option in its configure script, which will allow you to install Qt in a directory of your choice. E.g. if you want to build a different version of Qt with or without webkit, you can do so by using the -no-webkit option in configure and by defining a different installation path using -prefix.

This way you build different versions of Qt on your development machine from the same source code.

How to set up shadow builds on Windows

While developing for Windows you might want to compile a version of Qt for several different platforms and SDKs. In order to create those different builds of Qt you do not have to copy the whole Qt package or the Qt source. You are able to create multiple Qt builds from a single source tree. Such builds are called shadow builds.

Basically a shadow build is created by calling configure.exe from a different directory.

To make sure that the shadow build compiles correctly it is important that you following these guidelines:

  • When using GCC toolchains on Windows (MinGW, Android NDK, etc.) take into account that there is a restrictions on a build path prefix length QTBUG-52242.
  • Required Build tools : Get & Install either MSYS or MSYS2 shell (do not use both, unless you know what you are doing).
  • Toolchains/Compilers : Either get Visual Studio, or, MinGW, or, MinGW-w64 toolchains, (or get all of them, based on your need & target), separately from their official websites & install, or, get & Install MinGW-w64 (64bit & 32bit) toolchains inside MSYS2-shell. And add their directory location in the PATH environment variable.
  • Option-A : Either get Perl, Ruby, Python, msysgit, 7zip separately from their official site and install into separate directories, and add each separate directories into the PATH. (ActivePerl , StrawberryPerl , etc are a popular distribution of Perl on Windows).
  • Option-B : or, get & install Perl, Ruby, Python, git, 7pzip, etc inside MSYS2-shell with just one command and add just one directory location in PATH.
  • Get & install other build related tools, SDKs, dependencies, etc which you need for your target platform(s). And add their directory location in PATH and also add other build related environment variables (like INCLUDE, LIB, LIBPATH, DEV, QTDIR, etc). See Qt build related other articles. For example, you may need support for "OpenSSL":, ICU (Unicode), etc.
  • Bring %SystemRoot% location (its $SYSTEMROOT inside cygwin/bash/msys2) in beginning of PATH:
  • If you are using Cmd-Shell, run this command:
set PATH=%SystemRoot%;%SystemRoot%32;%PATH%
  • If you are using MSYS2-Shell, run this command:
windows2unix() { local pathPcs=() split pathTmp IFS=\;; read -ra split <<< "$'''"; for pathTmp in "${split[@],}"; do pathPcs+=( "/${pathTmp//+([:\\])//}" ); done; echo "${pathPcs[''']}"; }; systemrootP=$(windows2unix "$SYSTEMROOT"); export PATH="$systemrootP:$systemrootP/system32:$PATH"
  • If you are using jom, fart, etc tools then:
  • If you are using Cmd-Shell, run this command:
set PATH=C:;C:;%PATH%
  • If you are using MSYS2-Shell, run this command:
export PATH="/c/Qt/tools/jom:/c/Qt/tools/fart:$PATH"
  • set the PATH
  • If you are using Cmd-shell, then adjust & run/execute below command:
set PATH=C:-w64\64bit\bin;C:-perl\64bit\perl\bin;C:-perl\64bit\c\bin;C:-perl\64bit\c\x86_64-w64-mingw32\bin;C:27;C:64bit\bin;%PATH%
  • If you are using MSYS2-shell (or MSYS-shell), then adjust & run/execute below command:
export PATH="/c/msys2/mingw64/bin:/c/msys2/usr/bin:$PATH"
  • The original Qt source package must be left untouched- the "configure" must never have been run inside the source tree directory.
  • For example, lets assume, we are handling with Qt version number %VERSION%, where %VERSION% variable contains version number 5. So we will place our source files in this directory: C:%VERSION%_src which means C:5_src (/c/Qt/Qt5_src).
  • To set version number run/execute below command, for Cmd-shell:
set VERSION=5
  • To set version number run/execute below command, for MSYS2-shell:
export VERSION=5
  • If you are using windows Cmd-shell, then you need to run/execute similar commands
mkdir C:mkdir C:%VERSION%_src
  • If you are using MSYS2-shell or MSYS shell, then you need to run/execute similar commands
mkdir /c/Qt
mkdir /c/Qt/Qt${VERSION}_src
  • With Qt5, the code has to be checked out of the git repository, otherwise the out of source build will fail as syncqt is not executed.
  • Avoid using "release" and "debug" in the path to the shadow build directory. (This is an internal limitation of the build system.)
  • So lets assume you have installed Qt in C:%VERSION%_src and you want to create a shadow build in C:-Qt5-shadow:
  • Make sure the environment variables for your build & target platform related compiler/toolchains, tools, dependencies, etc are set.
  • For example, in Cmd-shell:
set LANG=en
  • For example, in MSYS2-shell:
export LANG=en
  • Visual Studio includes vcvars32.bat for that purpose - or simply use the "Visual Studio Command Prompt" from the Start menu.
  • Now navigate and GO INSIDE into your shadow build directory and run the "configure":
  • If you are using Cmd-shell:
cd C:-Qt5-shadow
C:%VERSION%_src\configure.exe -xplatform wincewm50pocket-msvc2005 -prefix %INSTALLDIR%
Adjust above command for your target platform, above is for building Qt5 for Windows CE platform.
  • If you are using MSYS2-shell (or MSYS-shell) :
cd /c/Qt/mobile-Qt5-shadow
/c/Qt/Qt${VERSION}_src\configure.exe -xplatform wincewm50pocket-msvc2005 -prefix $INSTALLDIR
  • Adjust above command for your target platform, above is for building Qt5 for Windows CE platform.
  • Finally, to build the shadow build, you may use nmake or jom or mingw32-make. In below example, we are showing command for nmake only:
nmake
  • That's all. You have successfully created a shadow build of Qt inside C:-Qt5-shadow.
  • Now you can call "nmake install" and get a clean installation of Qt inside INSTALLDIR.