|
BuildingOnWindows
Guide to building TeXworks on Windows XP using Microsoft Visual C++ 2008 Express Edition
Note: An open source alternative to this guide is to use the gcc-based MinGW toolset; see the BuildingOnWindowsMinGW page for details. Note: At the moment, KDE on Windows seems to distribute only 32 bit versions of the libraries. If you are running a 64 bit system, this guide probably won't work. Thanks to Stefan Löffler and Alain Delmotte for developing this guide.
PrefaceThis document describes a procedure for building TeXworks on Windows XP using the (freely available) Microsoft Visual C++ 2008 Express Edition. It is by no means the only way possible and it doesn't anticipate and tackle all possible problems, either. If you run into any difficulties feel free to ask for help on the mailing list. Note: This guide is designed for use with the English version on Windows XP. If you use another language the labels and some of the paths will be different. Required SoftwareThe process described here has been sucessfully implemented using the following software. You may of course use other software, but then the described steps may have to be adapted in some places.
Directory structureThe following directory layout is used in this guide. If you choose another layout you have to adjust the paths in the rest of this guide. C:\texworks\hunspell-1.2.8\ (hunspell) C:\texworks\texworks-read-only\ (TeXworks) Obtaining the necessary libraries from KDE on WindowsTeXworks depends on several external libraries, most notably Qt and Poppler. You can obtain most of the needed dependencies from the KDE on Windows project. See their summary of steps for further information. Download and run the installer. Choose the following options when asked:
Install the following packages and their dependencies (make sure that you install both the "bin" and the "devel" packages where available):
Add the KDEDIRS environment variable and adjust your path to include the KDE bin and lib directories according to the summary of steps required for installation of KDE on Windows Downloading and building HunspellThe hunspell library is required for spell checking and is not bundled with KDE on Windows. Hence you have to compile it yourself. Go to http://sourceforge.net/projects/hunspell/ and select "View all files". Download the .tar.gz file (the win32.zip file only contains programs, no sources and no libraries). At the time of writing, hunspell-1.2.8.tar.gz was the latest version and will be used throughout this guide. Extract hunspell-1.2.8.tar.gz to C:\texworks\ Open hunspell-1.2.8/src/win_api/Hunspell.sln (the solution needs to be converted) Two files are missing in the libhunspell project. Follow the next steps to add them:
Since all other libraries are built in Release mode, hunspell should be built in that mode as well. To switch to that mode, choose Configuration Manager from the Build menu. In the popup window, choose Release_dll as the active configuration for libhunspell and close the window. Build libhunspell (i.e. by Right-Clicking on libhunspell in the solution explorer and choosing "Build") There are several warnings but the build should succeed. Obtaining and building TeXworksRun the following command from the command line in the folder C:\texworks svn checkout http://texworks.googlecode.com/svn/trunk/ texworks-read-only You get a fresh new copy of the latest TeXworks code in the folder C:\texworks\texworks-read-only In order to build TeXworks you have to modify C:\texworks\texworks-read-only\TeXworks.pro to reflect your local configuration. Find the lines reading INCLUDEPATH += c:/MinGW514/local/include INCLUDEPATH += c:/MinGW514/local/include/poppler INCLUDEPATH += c:/MinGW514/local/include/poppler/qt4 INCLUDEPATH += c:/MinGW514/local/include/hunspell LIBS += -Lc:/MinGW514/local/lib LIBS += -lpoppler-qt4 LIBS += -lpoppler LIBS += -lfreetype LIBS += -lhunspell-1.2 LIBS += -lz LIBS += -lgdi32 and replace them by INCLUDEPATH += C:/KDE/include/poppler/qt4 INCLUDEPATH += C:/texworks/hunspell-1.2.8/src/hunspell LIBS += C:/KDE/lib/poppler-qt4.lib LIBS += C:/KDE/lib/poppler.lib LIBS += C:/texworks/hunspell-1.2.8/src/win_api/Release_dll/libhunspell/libhunspell.lib LIBS += C:/KDE/lib/zlib.lib In addition, unless you are using a poppler installation that includes the xpdf compatibility headers (not provided by default poppler builds, this requires a configure option), you will need to find the line QMAKE_CXXFLAGS += -DHAVE_POPPLER_XPDF_HEADERS and comment it out by inserting # at the beginning. The result will be that TeXworks will not automatically locate a poppler-data directory alongside the executable, but will need the poppler data files (for CJK font support) installed in a fixed system location that is dependent on the poppler library build. Then run qmake -tp vc on the command line from the C:\texworks\texworks-read-only directory. This creates C:\texworks\texworks-read-only\TeXworks.vcproj which can be opened in MSVC. Choose the Release configuration in the same way as for hunspell (Note: it's simply called Release this time). Build TeXworks (i.e. by Right-Clicking on the TeXworks project in the solution explorer and choosing "Build"). This creates C:\texworks\texworks-read-only\release\TeXworks.exe Note: When asked whether to save the solution it doesn't matter what you choose. Running TeXworks for the first timeBefore you can run TeXworks for the first time you need to copy the hunspell dll into a location where TeXworks can find them. Copy C:\texworks\hunspell-1.2.8\src\win_api\Release_dll\libhunspell\libhunspell.dll to C:\texworks\texworks-read-only\release. Updating TeXworksRemove the following files (if they exist) from C:\texworks\texworks-read-only:
Then run svn update qmake -tp vc from the same directory to update your TeXworks sources and your MSVC project file. Finally open TeXworks.vcproj in MSVC, make sure the Release configuration is selected and build. Note: When asked whether to save the solution it doesn't matter what you choose. DisclaimerThis guide is provided as-is in the hope that it's helpful. There is no guarantee the described procedure will work on your system. Use at your own risk. Q & AI already have the version X of the software/package Y installed. Do I really have to install it again as described in this guide? You don't necessarily have to. The full version of MSVC shouldn't be a problem. Other versions will, however (see below). Different versions of the KDE libraries could be a problem as well. This is especially true for different versions of Qt. All the packages of the KDE on Windows project fit together (are compiled by similar compilers and similar configurations, etc.). Mixing versions will most likely cause problems. I really want to install the KDE on Windows packages into a folder containing spaces. Can't it be done? Yes, you can try. If everything works well and all settings are correct it should work on most systems. Some of the workarounds presented here won't work, however. So to be on the safe side installing to paths not containing spaces or special characters is recommended. If it doesn't work please try installing the packages to the recommended location before asking for help on the mailing list. When executing qmake I get errors similar to WARNING: Unable to generate output for: c:/texworks/texworks/Makefile.Debug (TEMPLATE vcapp). What's wrong? This is most likely a problem with your Qt version(s) (see also the previous answer). Not all Qt versions have full support for MSVC. Make sure that the one you use (you shouldn't have more than one, anyway) has a C:\KDE\mkspecs\win32-msvc2008 directory. If it does make sure you have all your environmental variables set correctly. If all this doesn't help you can temporarily override the qmake file generation specification by executingqmake -tp vc -spec C:\KDE\mkspecs\win32-msvc2008 MSVC complains that it can't execute a subprogram or that a subprogram returns an error. Why? Make sure that you have installed Qt in a path MSVC can find. This includes setting the environmental variables correctly. If you have set the paths in PATH directly (rather than using %KDEDIRS%) make sure your path to Qt doesn't contain spaces or special characters. MSVC complains about linking errors/unresolved references. Why? Make sure that you have chosen the Release configuration during compilation (KDE on Windows doesn't provide debugging libraries). If you change the configuration you need choose rebuild for the whole project (just hitting build again isn't enough as the old stuff is still lurking in some files). When starting TeXworks it complains about missing or incompatible dlls or simply crashes during start-up. What's wrong? This can be caused if TeXworks doesn't find some required dlls at all or finds different versions of the dlls first. This can most notably be caused by MikTeX which includes some Qt dlls. First of all make sure you have your environmental variables set correctly. If this doesn't help copy the following dlls from C:\KDE\bin to C:\texworks\texworks-read-only\release:
I have a question not answered here. What shall I do? Ask the question on the mailing list. |
Sign in to add a comment
Hi, seems that the links to Visual C++ 2005 Express Edition (+SP1) and the Platform SDK and the additional instructions by Microsoft for MSVC, are NOT valid any more. As MSVC 2005 has been replaced with MSVC 2008 on Microsoft's website.
You're right, thanks. Unfortunately, KDE on Windows still uses MSVC2005. Googling quickly pointed me to http://download.chip.eu/de/Visual-C-2005-Express-v8.0_237571.html for downloading MSVC2005 (only found it in German, though). The rest of the links on http://techbase.kde.org/Getting_Started/Build/KDE4/Windows/MS_Visual_Studio#Visual_Studio_2005_Express_Edition still work and should point you in the right direction.
Good news, KDE on windows now can be compiled with MSVC2008. see http://techbase.kde.org/Getting_Started/Build/KDE4/Windows/MS_Visual_Studio#Visual_Studio_2008_SP1
If you are having problems with linking to QT JPEG Plugin, You need to comment the below line in the .pro file
Add the below line to the .pro file
This way, you will start using KED's JPEG library instead of QT's JPEG Plugin.
Gopalakrishna Creator of CFugue http://gpalem.web.officelive.com/CFugue.html