-
Notifications
You must be signed in to change notification settings - Fork 75
Compiling KVIrc on Windows
#temp dump
This paper describes how to successfully compile a working copy of KVIrc 4.x under Microsoft Windows operating systems.
-
A Microsoft Windows operating system
[Needed to run KVIrc into, mandatory]
- XP or 2003 server, preferably with at least service pack 2
- Vista, preferably not :p
- Seven or 2008 server
Notice: DOS-based Windows operating systems (95,98,se,me) are not officially supported by KVIrc. Anyway, if you're still using such an old OS then you have worst problems than this...
Notice: Windows 2000 may work, but is not officially supported anymore. Differences in its network stack and the difficulty to retrieve packages of KVIrc dependencies still working on win2000 make compiling KVIrc an overkill job.
-
CMake from Kitware
[Configuration tool; needed to compile KVIrc, mandatory]
Download the tool from http://www.cmake.org. The package you want is called "Windows (Win32 Installer) cmake--win32-x86.exe" (version may vary).
You need at least version 2.6.4 to compile KVirc. Avoid version 2.8.0; use version 2.8.2 instead.
Recent versions of the cmake installer will ask if you want to add cmake to the system PATH: you don't need it.
-
Qt 4 from Nokia
[Graphic library, mandatory]
You need at least Qt 4.6.0 upwards fo get a fully working KVIrc. We suggest you to get the "Qt SDK for Open Source C++ development on Windows" you can get here: http://qt.nokia.com/downloads/sdk-windows-cpp
The Qt SDK includes the Qt libraries and a working mingw environment, so you won't need to install one manually.
-
MinGW from the MinGW team
[Compiler; needed to compile KVIrc, mandatory]
If you installed the Qt SDK >= 4.6.0, you already have MinGW installed and you can jump to the next requisite. Otherwise you need to install MinGW manually: refer to http://www.mingw.org/wiki/InstallationHOWTOforMinGW Please note that you need to install gcc4 (gcc3 could work but is not supported).
-
Perl for Win32
[Programming language; needed for documentation creation; optionally can be used for scripting support; may also be used to compile OpenSSL by yourself (see the related paragraph below)]
Any win32 version will work; We advice you to use the distribution provided by ActiveState. It's called ActivePerl and you can find at http://www.activestate.com/activeperl/downloads/ You want the "Free Community Edition" package.
Perl is needed to extract documentation from the source files and generate help files for KVIrc.
Some perl releases misses dmake; if you get a strange error at compilation time, run the following command from cmd prompt (start->run->cmd):
-
Zlib compiled for Win32
[Compression library; needed for many stuffs, mandatory]
MinGW offers a zlib package: You'll need to download from http://sourceforge.net/projects/mingw/ the packages:
libz-1.2.3-1-mingw32-dll-1.tar.gz libz-1.2.3-1-mingw32-dev-1.tar.gz
Search them on the MinGW project files download page.
Install the lib somewhere (like C:\zlib) and remember its path.
-
OpenSSL compiled for Win32
[Enc/Decrypt library; needed to secure your irc sessions, optional]
To compile KVIrc for your own use you can download a precompiled package from http://www.slproweb.com/products/Win32OpenSSL.html The package you want is called "Win32 OpenSSL v0.9.8l" (version number may vary; there should be a notice like "Recommended for software developers" in the package description). Any recent version should work; general rule: more recent usually means more secure.
Newer OpenSSL versions from www.slproweb.com need a specific version of Microsoft Visual Studio 2008 runtimes to work (this sucks): so if you plan to create a redistributable KVIrc package, our advice is to compile OpenSSL by yourself using MinGW/MSYS and then use your libs.
To compile OpenSSL by yourself:
- download the latest source from http://www.openssl.org
- move it somewhere inside the msys root directory (C:\MinGW\msys\1.0)
- open the MinGW shell and locate the package
- unpack the package (you need to do it from the MinGW shell since it contains symlinks)
- enter in the created directory
- run "./config shared"
- run "make" and then "make install"
- grab the entire installation directory (e.g. C:\MinGW\msys\1.0\local\ssl) and copy it in a more accessible path (like C:\OpenSSL)
Whatever way you choose, install OpenSSL somewhere (like C:\OpenSSL) and remember the path.
-
Python for Win32
[Programming language; optional scripting support]
Any win32 version will work; We advice you to use the version you can find at http://www.activestate.com/activepython/downloads/ . You want the "Free Community Edition" package.
Please note that we are currently supporting the 2.x version of python (currently 2.6). Python3000 (aka python3k) is not backwards compatible and supported by now.
-
GNU GetText for Win32
[Localization tools; needed to translate KVIrc interface into your own language; required if you're building a redistributable package, otherwise optional]
We advice you to use the version you can find at http://gnuwin32.sourceforge.net/packages/gettext.htm, follow the "Setup program" link. Install the package somewhere (like C:\gettext) and remember the path.
-
GNU Sed for Win32
[Tool; needed to tidy KVIrc translation files, optional]
We advice you to use the version you can find at http://gnuwin32.sourceforge.net/packages/sed.htm, follow the "Setup program" link.
Install the package somewhere (like C:\sed) and remember the path.
-
Git for windows
[Git; needed for cmake to automatically set the correct revision number in KVIrc build; can be overridden (see below). Also required to obtain the latest source code revisions of KVIrc]
Git can be obtained via https://git-scm.com/download/win. Git is also included within MinGW which may be obtained here http://www.mingw.org/
If you don't want to install the Git cli or Gui, you can just force the correct Git revision by passing the -DMANUAL_REVISION=xxxx parameter to cmake.
-
Nullsoft scriptable install system (NSIS)
[Installer packages creator; needed if you want to create an installer package for KVIrc]
Get it at http://nsis.sourceforge.net/Download ; the package you want is called "nsis-2.46-setup.exe" (version numbers may vary).
-
GNU Debugger (gdb) for Win32:
[Dev Tool: Debugger; optional]
Download it from the MinGW website.
-
StraceNT (aka strace for Win32)
[Dev Tool: tracer; optional]
Download it from http://www.intellectualheaven.com/ .
Download KVIrc sources from KVIrc's website, a mirror or using Git (see instructions on KVIrc website about how to do that). From now on I'll assume that you have saved the sources in C:\KVIrc
Go to the C:\KVIrc directory an create a "build" folder in it. This may be done either via Windows explorer or via a command prompt in the following way:
Now copy the win32_run_cmake.bat script from the C:\KVIrc\doc directory to the build directory
Now edit the file you just copied by filling in the paths (you did write them down, don't you? :).
Run the win32_run_cmake.bat script.
This should invoke the cmake executable and configure KVIrc for you.
If it complains about missing libraries then you haven't properly edited the paths in the win32_run_cmake.bat file. Check again. Note that the "bin" subdirectories generally aren't included in the path.
You may also try to use the CMake gui for the compilation. Just be aware of the %PATH% variable defined in the win32_run_cmake.bat script. If you screw up %PATH% CMake may refuse to start or the mingw make may crash. Note also that you must tell the graphical configuration that you want the "MinGW Makefiles" as output.
Once cmake did its job (it will tell you that it's ready to compile KVIrc) you can just run the mingw make program.
The compilation may spit out some warnings: just ignore them (unless you're a cool developer.. in that case: fix them!). If it runs without errors then you can also run make install:
This should create a working KVIrc executable for you in the build\release directory. With some experience you may also get mingw to create a debug build.
Simply running KVIrc from that directory should work :) . If instead it's complaining of some missing dlls, you may need to copy those dlls into KVIrc binary directory (in our example: C:\KVirc\build\release) or to get those dlls recognized and loaded automatically from your OS.
If you want to create an installer package, you need to:
- fill the binary directory (in our example: C:\KVIrc\build\release) with all the files that cmake doesn't create:
-
needed dlls: - Qt: QtCore4, QtGui4 (mandatory); QtNetwork4, QtSvg4, QtWebkit4, QtXml, QtXmlPatterns (used in objects module); - Zlib: libz.dll (aka libz-1.dll, zlib.dll, ...); - Openssl: libeay32.dll, libssl32.dll (names may vary); - MinGW: mingwm10.dll, libgcc_s_dw2-1.dll - Perl: perl512.dll (version number may vary); - Python: python26.dll (version number may vary); - Amip: ac.dll / ac.ini (adds plug'n'play support for amip) Choose the right dlls depending on your build options: for a debug build you'll need debug version of Qt libraries (e.g. QtCored4)
-
qt plugins: These have to be placed in a subdirectory named qt-plugins (in our example: C:\KVirc\build\release\qt-plugins). Currently KVIrc can use 4 types of plugins: codecs, imageformats, phonon_backend, sqldrivers. Create a subdirectory and name it with the type name of the plugins you'll place inside it; (e.g. C:\KVirc\build\release\qt-plugins\imageformats\qjpeg4.dll) You can find them inside the "plugins" directory in the Qt Sdk. Choose the right dlls depending on your build options: for a debug build you'll need debug version of Qt plugins (e.g. qjpegd4.dll)
-
locale translations: If you did not install or disabled gettext, your release folder misses the "locale" folder typically containing translation files. This means KVIrc won't be able to translate its user interface. As a workaround, you can get translation files somewhere, create the "locale" folder and manually place translations inside it.
-
help file: If you did not install or disabled perl, your release folder misses the "help" folder typically containing user help. This means KVIrc internal help will contain no help pages. As a workaround, you can get help files somewhere, create the "help/en" folder and manually place help files inside it.
- run the KVIrc.nsi script from the build directory (C:\kvirc\build in our example) . Just compile it using nsis and an installer package will be generated.
-
C:\kvirctrunk\src\modules\clock\libkviclock.cpp:242: warning:
KVIrc_module_info' initialized and declared
extern'This is a simple warning, it doesn't block compilation or affects any functionality.
-
C:/kvirctrunk/src/kvilib/system/kvi_time.h:0: Warning: No relevant classes found. No output generated.
In the compilation we call qt's moc to parse headers files and expand qt macros; that warning simply means that moc found nothing to expand in that header file. We can fix this removing headers that doesn't need to be moc-ed from the lists in CMakeLists.txt.
-
- Windows Vista and 7 Users * If you have UAC enabled (default setting) and KVIrc is installed in the Program Files folder and you have opted to use the portable setting, then KVIrc's data files will be found in the VirtualStore folder, typically: C:\Users[UserName]\AppData\Local\VirtualStore\Program Files\KVIrc\ If you plan on using the portable setting, it is recommended that you install KVIrc in a non UAC protected folder.
KVIrc4 win64 compiling howto by Cizzle based on wodim's guide at https://thacid.wordpress.com/2010/10/18/compiling-kvirc-64-bits-from-svn-using-visual-studio-2008/ and DarthGandalf's appveyor buildinstructions
This paper describes how to successfully compile a working copy of KVIrc 4.3.x under Microsoft Windows operating systems. For own compilations we assume a root-directory C:\kvirccomp\ being used.
-
A 64-bit Microsoft Windows operating system. Should work at least on 7
-
Microsoft Visual Studio 2013 (Community Edition). Get it from https://www.visualstudio.com/nl-nl/products/visual-studio-community-vs Install in default location with default options, though you can slim it down a lot if wanted.
-
CMake. Get it from http://www.cmake.org/download/ Install in default location with default options and choose "Add CMake to command path for all users".
-
GIT client. Get one from https://git-for-windows.github.io/ Git bash should be enough.
-
Qt. Get it from https://www.qt.io/download-open-source/ Version 5 should work. Get the online installer and be sure to mark MSVS 2013 64bit version. Install in default location with default options.
-
Perl. Get it from http://www.activestate.com/activeperl/downloads Get the 64-bit version, use 5.20.x (newer versions don't have dmake yet in the repo). Install in default location with default options.
If you want scripting support, you will also have to do this: Go to C:\Perl64\lib\CORE, make the file config.h not read-only and open it for editing. Find the line that starts with "#define PERL_STATIC_INLINE" and put "/*" in front of it (so it's commented). And of course save the file.
Some perl releases miss dmake at install time; if you get a strange error at compilation time, run the following command from cmdline: ppm install dmake
-
zlib. Get it from http://zlib.net/ Get the source as we need to compile it ourselves (until a 64bit dll is provided). Compiling (replace versions with what you have): Unpack in C:\kvirccomp; then open a VS x64 Native CMD Prompt and run: cd C:\kvirccomp\zlib-1.2.8 "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x64 nmake -f win32/Makefile.msc AS=ml64 LOC="-DASMV -DASMINF -I." OBJA="inffasx64.obj gvmat64.obj inffas8664.obj"
-
OpenSSL. Get it from http://www.openssl.org/source/ to compile yourself or get the non-Light Win64 package from http://slproweb.com/products/Win32OpenSSL.html Compiling (replace versions with what you have): Unpack in C:\kvirccomp; then open a VS x64 Native CMD Prompt and run: perl Configure VC-WIN64A ms\do_win64a nmake -f ms\ntdll.mak cd out32dll ..\ms\test All of the tests should run flawlessly.
Then run the following as a batch-script in the ${OPENSSL_INCLUDE_DIR}/openssl/: @echo off setlocal enabledelayedexpansion for %%f in (*.h) do ( set /P linkn= < %%f set linkn=!linkn:/=\! ren %%f %%f.ori copy !linkn! %%f )
-
Python. Optional for scripting purposes Get it from http://www.activestate.com/activepython/downloads/ Get the 64-bit 2.x version as 3.x is not backwards compatible and supported by now. Install in default location with default options.
-
Enchant. Optional for spellchecking support Get it from https://ci.appveyor.com/api/buildjobs/kf2efxpaes6uugwg/artifacts/enchant.7z Unpack in C:\kvirccomp and edit enchant-inst\include\enchant\enchant.h adding under line "#include <sys/types.h>" (l35): #include <BaseTsd.h> typedef SSIZE_T ssize_t; and edit enchant-inst\include\glib-2.0\glibconfig.h adding under lines "#define G_CAN_INLINE 1; #endif" (l120): #undef G_CAN_INLINE You can get dictionaries from http://extensions.libreoffice.org/extension-center/
-
Phonon4Qt5. Optional audio backend Get it from https://projects.kde.org/projects/kdesupport/phonon/phonon/repository We need to compile this ourselves, but we first need the extra-cmake-modules: Get this from https://projects.kde.org/projects/kdesupport/extra-cmake-modules/repository Unpack ECM in C:\kvirccomp, then open a VS x64 Native CMD Prompt and run: md build cd build cmake .. -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX=C:\Qt\5.4\msvc2013_64 nmake install Then unpack phonon in C:\kvirccomp, and in a VS x64 Native CMD Prompt run: md build cd build cmake .. -G "NMake Makefiles" -DPHONON_BUILD_PHONON4QT5=ON -DCMAKE_INSTALL_PREFIX=C:\Qt\5.4\msvc2013_64 -DCMAKE_PREFIX_PATH=C:\Qt\5.4\msvc2013_64 -DPHONON_INSTALL_QT_EXTENSIONS_INTO_SYSTEM_QT=ON -Wno-dev nmake nmake install
-
GNU GetText for Win32. Required if you're building a redistributable package, needed to translate KVIrc interface into your own language. Get it from http://gnuwin32.sourceforge.net/packages/gettext.htm Install in default location with default options.
-
GNU Sed for Win32. Optional for translation file cleanup Get it from http://gnuwin32.sourceforge.net/packages/sed.htm Install in default location with default options.
-
Get the KVIrc source code Using GIT bash: cd /c/kvirccomp/ git clone https://github.com/kvirc/kvirc.git
-
Compile KVIrc Open a Visual Studio x64 Native command prompt. Before starting, we have to set some environment variables. Replace with your respective versions and install paths. The Perl and Python paths might already be set. set PATH=%PATH%;C:\kvirccomp\zlib-1.2.8;C:\Qt\5.4\msvc2013_64\bin;C:\Perl64\bin;C:\Perl64\site\bin;C:\Python27;C:\Program Files (x86)\GnuWin32\bin set CMAKE_INCLUDE_PATH=%CMAKE_INCLUDE_PATH%;C:\kvirccomp\openssl-1.0.2d\include;C:\kvirccomp\zlib-1.2.8 set CMAKE_LIBRARY_PATH=%CMAKE_LIBRARY_PATH%;C:\kvirccomp\openssl-1.0.2d\out32dll;C:\kvirccomp\zlib-1.2.8;C:\Qt\5.4\msvc2013_64\lib
If you compiled OpenSSL yourself and want to use this during compilation, and have the package from SLProWeb installed in it's default location, you need to rename the SLProWeb installationpath first. CMake will look at those default paths first.
Next, go to the KVIrc source dir and create a build directory and its Makefiles using cmake and compile. We use the "release" build-type as "debug" seems to have incompatibilities between /O2 and /RTC usage If you want spellchecking support, add these flags to the cmake command: "-DEnchant_FOUND=1 -DEnchant_INCLUDE_DIRS=c:\kvirccomp\enchant-inst\include\enchant;c:\kvirccomp\enchant-inst\include\glib-2.0 -DEnchant_LDFLAGS=c:\kvirccomp\enchant-inst\lib\libenchant.dll.a" If you don't want Perl scripting support, add this flag to the cmake command: "-DWANT_PERL=0" If you don't want the Phonon audio backend and want to ignore the warning, add this flag to the cmake command: "-DWANT_PHONON=0" cd C:\kvirccomp\KVIrc md build cd build cmake .. -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=release -DWANT_KDE=0 nmake nmake install
Your binaries are now located at C:\kvirccomp\kvirc\build\release. But you can’t start kvirc.exe as there're some libraries missing. You can either copy these to the system dir, add their locations to %PATH% or copy them to the KVIrc-release dir. The latter is preferred for portability reasons. robocopy C:\Qt\5.4\msvc2013_64\bin C:\kvirccomp\kvirc\build\release\ Qt5Network.dll Qt5Core.dll Qt5Widgets.dll Qt5Gui.dll Qt5WebKitWidgets.dll Qt5WebKit.dll Qt5Sensors.dll Qt5Positioning.dll Qt5Quick.dll Qt5Qml.dll Qt5Multimedia.dll Qt5WebChannel.dll Qt5Sql.dll Qt5MultimediaWidgets.dll Qt5OpenGL.dll Qt5PrintSupport.dll Qt5WinExtras.dll icuin53.dll icuuc53.dll icudt53.dll robocopy C:\kvirccomp\openssl-1.0.2d\out32dll C:\kvirccomp\kvirc\build\release\ libeay32.dll ssleay32.dll copy C:\kvirccomp\zlib-1.2.8\zlib1.dll C:\kvirccomp\kvirc\build\release
copy C:\Perl64\bin\perl520.dll C:\kvirccomp\kvirc\build\release
Optionally copy: copy C:\Windows\System32\python27.dll C:\kvirccomp\kvirc\build\release\ -
Add extra plugins Qt provides extra plugins which can be used, these have to be placed in a subdirectory named "qt-plugins". Currently KVIrc can use these types of plugins: qt4: codecs, iconengines, imageformats, phonon_backend, sqldrivers qt5: audio, iconengines, imageformats, mediaservice, platforms, sqldrivers Create a subdirectory and name it with the type name of the plugins you'll place inside it; You can find them inside C:\Qt\5.4\msvc2013_64\plugins. Choose the dlls without a "d" at the end of the filename: qjpeg.dll and not qjpegd.dll.