Difference between revisions of "Compiling Inkscape on Windows 64-bit"

From Inkscape Wiki
Jump to navigation Jump to search
Line 16: Line 16:
 
A matching build based on GCC 5.3 can be downloaded [https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/5.3.0/threads-win32/seh/ here]. The exact version used for building the inkscape-devlibs64 is [https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/5.3.0/threads-win32/seh/x86_64-5.3.0-release-win32-seh-rt_v4-rev0.7z/download MinGW-w64 x86_64-5.3.0-release-win32-seh-rt_v4-rev0.7z].
 
A matching build based on GCC 5.3 can be downloaded [https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/5.3.0/threads-win32/seh/ here]. The exact version used for building the inkscape-devlibs64 is [https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/5.3.0/threads-win32/seh/x86_64-5.3.0-release-win32-seh-rt_v4-rev0.7z/download MinGW-w64 x86_64-5.3.0-release-win32-seh-rt_v4-rev0.7z].
  
=== CMake ===
+
=== Development libraries for Windows 64-bit ===
 
 
CMake is a Cross-Platform buildsystem generator similar to autotools. It generates '''makefiles''' to be processed by '''make'''.
 
Get CMake from the [https://cmake.org/ official website cmake.org]. As of writing [https://cmake.org/files/v3.5/cmake-3.5.2-win32-x86.msi version 3.5.2] is the most recent version.
 
 
 
=== Inkscape development libraries for Windows 64-bit ===
 
  
 
Get the [https://code.launchpad.net/inkscape-devlibs64 inkscape-devlibs64] which include pre-compiled binaries of all Inkscape dependencies.
 
Get the [https://code.launchpad.net/inkscape-devlibs64 inkscape-devlibs64] which include pre-compiled binaries of all Inkscape dependencies.
Line 39: Line 34:
  
 
See also additional information on [[Compiling_Inkscape_on_Windows#Obtaining_Inkscape_source_code|obtaining Inkscape source code]] and [[Working with Bazaar|working with Bazaar]].
 
See also additional information on [[Compiling_Inkscape_on_Windows#Obtaining_Inkscape_source_code|obtaining Inkscape source code]] and [[Working with Bazaar|working with Bazaar]].
 +
 +
=== CMake ===
 +
 +
CMake is a Cross-Platform buildsystem generator similar to autotools. It generates '''makefiles''' to be processed by '''make'''.
 +
Get CMake from the [https://cmake.org/ official website cmake.org]. As of writing [https://cmake.org/files/v3.5/cmake-3.5.2-win32-x86.msi version 3.5.2] is the most recent version.
  
 
== Building ==
 
== Building ==
  
 
=== Environment variables ===
 
=== Environment variables ===
 +
Edit the file <code>mingwenv.bat</code> in the root directory of the Inkscape source to match you local paths. Most importantly the two lines:
  
Edit the file <code>mingwenv.bat</code> in the root directory of the Inkscape source to match you local paths. Most importantly the two lines
 
 
<pre>
 
<pre>
IF "%DEVLIBS_PATH%"=="" set DEVLIBS_PATH=c:\devlibs64
+
# Path to the Inkscape development libraries.
IF "%MINGW_PATH%"=="" set MINGW_PATH=C:\mingw64
+
if "%DEVLIBS_PATH%"=="" set DEVLIBS_PATH=c:\devlibs64
 +
 
 +
# Path to the MinGW installation. Note: MinGW does not work with white spaces in the path name.
 +
if "%MINGW_PATH%"=="" set MINGW_PATH=c:\mingw64
 
</pre>
 
</pre>
 +
 
should point to the folders containing MinGW-w64 and the inkscape-devlibs64.
 
should point to the folders containing MinGW-w64 and the inkscape-devlibs64.
  
Whenever you want to build Inkscape open a command prompt (<code>cmd.exe</code>), change into the root directory of the Inkscape source and execute <code>mingwenv.bat</code> to set environment variables.
+
Whenever you want to build Inkscape open a command prompt (<code>cmd.exe</code>), change into the root directory of the Inkscape source and set the environment variables with the following command:
  
=== Compiling build tool ===
+
<pre>
 +
mingwenv.bat
 +
</pre>
 +
 
 +
=== Compiling Inkscape using CMake ===
 +
Go to source code directory and create the build output directory. In example:
 +
 
 +
<pre>
 +
mkdir build
 +
cd build
 +
</pre>
 +
 
 +
You can also create an out of source build anywhere else in your file system. Just make sure that you pass the correct path to the source code directory in the next step. Create the makefiles using CMake:
  
Compile <code>btool</code> (the command line tool that handles the actual build) using
+
<pre>
<pre>g++ buildtool.cpp -o btool -fopenmp</pre>
+
# Pass the path to the source code directory as a parameter.
 +
cmake -G "MinGW Makefiles" ..
 +
</pre>
 +
 
 +
Start the build proccess. The compiled Inkscape.exe will be in bin directory afterwards:
  
=== Compiling Inkscape ===
+
<pre>
 +
# 2 is the number of parallel threads to use for compiling. Increase the number to utiliize more of your available CPU cores.
 +
mingw32-make -j 2
 +
</pre>
  
Use <code>btool</code> to compile Inkscape compile  and create the distribution directory:
+
Collect all the needed files and create a selfcontaing directory:
<pre>btool -file build-x64.xml -j 2</pre>
 
The file <code>build-x64.xml</code> contains the necessary instructions for creating a standard 64-bit build.<br>
 
If you want to make a GTK+ 3 build use <code>build-x64-gtk3.xml</code> instead (please note that GTK+ 3 builds are experimental and not ready for production yet).
 
  
The <code>-j</code> switch allows to instruct btool to use multiple parallel threads to speed up compilation (e.g. 2 in the example above).
+
<pre>
 +
mingw32-make DESTDIR=mydir install
 +
</pre>
  
=== Compiling Inkscape using CMake ===
+
See [http://stackoverflow.com/questions/11307465/destdir-and-prefix-of-make this article] in stackoverflow about the difference in DESTDIR and PREFIX of make. After this step we have a *mydir/Program Files/inkscape/* where everything ''should'' be.
  
Go to source code directory.
+
As cmake hides the actual compiler calls, here is a way how to see what make is doing.
  
Create the output directory, where the intermediate output goes to.
 
 
<pre>
 
<pre>
mkdir build
+
mingw32-make VERBOSE=1 -j 2
cd build
 
 
</pre>
 
</pre>
  
Create the makefiles using CMake.
+
=== Compiling Inkscape using btool (deprecated) ===
<pre>cmake .. -G "MinGW Makefiles"</pre>
+
 
 +
Compile <code>btool</code> (the command line tool that handles the actual build) using
 +
<pre>
 +
g++ buildtool.cpp -o btool -fopenmp
 +
</pre>
  
Start the build proccess. The INkscape.exe will be in build/bin directory afterwards.
+
Use <code>btool</code> to compile Inkscape compile  and create the distribution directory:
<pre>mingw32-make -j 2</pre>
 
  
Collect all the needed files and create a selfcontaing directory. ''This currently does not work as with btool.''
+
<pre>
<pre>mingw32-make DESTDIR=mydir install</pre>
+
btool -file build-x64.xml -j 2
See [http://stackoverflow.com/questions/11307465/destdir-and-prefix-of-make this article] in stackoverflow about the difference in DESTDIR and PREFIX of make.
+
</pre>
After this step we have a *mydir/Program Files/inkscape/* where everything ''should'' be.
 
  
 +
The file <code>build-x64.xml</code> contains the necessary instructions for creating a standard 64-bit build.<br>
 +
If you want to make a GTK+ 3 build use <code>build-x64-gtk3.xml</code> instead (please note that GTK+ 3 builds are experimental and not ready for production yet).
  
As cmake hides the actual compiler calls, here is a way how to see what make is doing.
+
The <code>-j</code> switch allows to instruct btool to use multiple parallel threads to speed up compilation (e.g. 2 in the example above).
<pre>mingw32-make -j 2 VERBOSE=1</pre>
 

Revision as of 06:55, 7 July 2016

For 32 bit: see Compiling Inkscape on Windows


Compiling Inkscape on Windows 64-bit works similar to compiling Inkscape on Windows 32-bit where you can find additional information.

This page only describes the basic steps that are required while highlighting the differences compared to a 32-bit build.

Requirements

MinGW-w64

Get MinGW-w64 which contains the necessary GNU developer tools to build Inkscape on Windows.

You have to download a version that is configured for building native win64 applications with win32 threading model and SEH exception handling, to ensure compatibility with the inkscape-devlibs64.

A matching build based on GCC 5.3 can be downloaded here. The exact version used for building the inkscape-devlibs64 is MinGW-w64 x86_64-5.3.0-release-win32-seh-rt_v4-rev0.7z.

Development libraries for Windows 64-bit

Get the inkscape-devlibs64 which include pre-compiled binaries of all Inkscape dependencies.

To checkout via Bazaar use the command

bzr checkout --lightweight lp:inkscape-devlibs64 C:\devlibs64

The --lightweight switch ensures that you only have to download the latest version of all binaries, C:\devlibs64 is the folder you want them to be downloaded to.

See also Inkscape Devlibs 64-bit (only relevant if you want to update the development libraries)

Inkscape source code

Get the Inkscape source code from launchpad

To checkout via Bazaar use the command

bzr checkout lp:inkscape C:\inkscape

See also additional information on obtaining Inkscape source code and working with Bazaar.

CMake

CMake is a Cross-Platform buildsystem generator similar to autotools. It generates makefiles to be processed by make. Get CMake from the official website cmake.org. As of writing version 3.5.2 is the most recent version.

Building

Environment variables

Edit the file mingwenv.bat in the root directory of the Inkscape source to match you local paths. Most importantly the two lines:

# Path to the Inkscape development libraries.
if "%DEVLIBS_PATH%"=="" set DEVLIBS_PATH=c:\devlibs64

# Path to the MinGW installation. Note: MinGW does not work with white spaces in the path name.
if "%MINGW_PATH%"=="" set MINGW_PATH=c:\mingw64

should point to the folders containing MinGW-w64 and the inkscape-devlibs64.

Whenever you want to build Inkscape open a command prompt (cmd.exe), change into the root directory of the Inkscape source and set the environment variables with the following command:

mingwenv.bat

Compiling Inkscape using CMake

Go to source code directory and create the build output directory. In example:

mkdir build
cd build

You can also create an out of source build anywhere else in your file system. Just make sure that you pass the correct path to the source code directory in the next step. Create the makefiles using CMake:

# Pass the path to the source code directory as a parameter.
cmake -G "MinGW Makefiles" ..

Start the build proccess. The compiled Inkscape.exe will be in bin directory afterwards:

# 2 is the number of parallel threads to use for compiling. Increase the number to utiliize more of your available CPU cores.
mingw32-make -j 2

Collect all the needed files and create a selfcontaing directory:

mingw32-make DESTDIR=mydir install

See this article in stackoverflow about the difference in DESTDIR and PREFIX of make. After this step we have a *mydir/Program Files/inkscape/* where everything should be.

As cmake hides the actual compiler calls, here is a way how to see what make is doing.

mingw32-make VERBOSE=1 -j 2

Compiling Inkscape using btool (deprecated)

Compile btool (the command line tool that handles the actual build) using

g++ buildtool.cpp -o btool -fopenmp

Use btool to compile Inkscape compile and create the distribution directory:

btool -file build-x64.xml -j 2

The file build-x64.xml contains the necessary instructions for creating a standard 64-bit build.
If you want to make a GTK+ 3 build use build-x64-gtk3.xml instead (please note that GTK+ 3 builds are experimental and not ready for production yet).

The -j switch allows to instruct btool to use multiple parallel threads to speed up compilation (e.g. 2 in the example above).