Difference between revisions of "Tutorial:Compiling & Installing SWORD on Windows"
(Cross-compile instructions with cmake -- not finished yet) |
David Haslam (talk | contribs) (→Compilation of Sword: Category:SWORD) |
||
(5 intermediate revisions by one other user not shown) | |||
Line 50: | Line 50: | ||
# cd to $dir$/clucene | # cd to $dir$/clucene | ||
# Set Boost environment variables by executing the following (with replacements for $dir$): | # Set Boost environment variables by executing the following (with replacements for $dir$): | ||
− | + | #: set BOOST_BUILD_PATH=$dir$\boost\tools\build\v2 | |
− | + | #: set BOOST_PATH=$dir$ | |
− | + | #: set BOOST_ROOT=$dir$\boost | |
# Execute: mkdir cmakebuild | # Execute: mkdir cmakebuild | ||
# Execute: cd cmakebuild | # Execute: cd cmakebuild | ||
Line 69: | Line 69: | ||
# Open $dir$\sword-$version$\utilities\vcppmake\utilities.sln | # Open $dir$\sword-$version$\utilities\vcppmake\utilities.sln | ||
# Build the solution (Release, Debug, or both) | # Build the solution (Release, Debug, or both) | ||
+ | |||
+ | == Cross Compiling Sword for MS Windows on Linux with MingW == | ||
+ | NOTE: these instructions do not include CLucene. | ||
+ | |||
+ | # Create a build directory $BUILD_DIR | ||
+ | # Download the latest version of SWORD from svn | ||
+ | svn co https://www.crosswire.org/svn/sword/trunk/ $BUILD_DIR/sword | ||
+ | # Download and install MXE (steps 1 and 2 of the tutorial here [http://mxe.cc/#tutorial]). | ||
+ | # Aquire all the dependancies (except ICU and CLucene) | ||
+ | #:: by using the instructions above (on windows with visual studio) | ||
+ | #:: downloading the binaries (dynamic linking) | ||
+ | #:: using MXE's system libraries (static linking). In this case, change to MXE's install dir ('/opt/mxe' in the tutorial) and do: | ||
+ | su | ||
+ | make MXE_TARGETS='i686-w64-mingw32' gcc zlib bzip2 xz curl | ||
+ | |||
+ | === Aquire icu === | ||
+ | Download the latest ICU source [http://site.icu-project.org/download/] | ||
+ | Inflate the zip or tar archive to $BUILD_DIR/icu | ||
+ | # | ||
+ | # Make icu for linux first... | ||
+ | cd $BUILD_DIR/icu/source/ | ||
+ | mkdir linux-build | ||
+ | cd linux-build | ||
+ | ../source/runConfigureICU Linux | ||
+ | # | ||
+ | # ...then cross-compile for windows... | ||
+ | cd $BUILD_DIR/icu/source | ||
+ | mkdir win-build | ||
+ | cd win-build | ||
+ | # | ||
+ | # ...making sure we are being consistant with which compiler we are using by setting CC and CXX... | ||
+ | CC=/opt/mxe/usr/bin/i686-w64-mingw32-gcc CXX=/opt/mxe/usr/bin/i686-w64-mingw32-g++ ../source/runConfigureICU MinGW --host=i686-w64-mingw32 --with-cross-build=$BUILD_DIR/icu/linux-build | ||
+ | # | ||
+ | # Finally, set up the include dir for use with cmake | ||
+ | cd $BUILD_DIR/icu | ||
+ | cp -r source/*/unicode/ include/ | ||
+ | |||
+ | : ...or use MXE's system icu. Take care when doing this because | ||
+ | :: it be an older version of icu (ie, icu51 at time of writing). | ||
+ | :: MXE make static libraries (haven't figured out how to get dynamic ones yet) which bloat the libsword.dll! | ||
+ | :: you will have to hack the build process a bit too. | ||
+ | su | ||
+ | make MXE_TARGETS='i686-w64-mingw32' icu4c | ||
+ | |||
+ | === Building SWORD === | ||
+ | Make an out of source-directory-for cmake. | ||
+ | mkdir $BUILD_DIR/sword/cmakebuild | ||
+ | cd $BUILD_DIR/sword/cmakebuild | ||
+ | |||
+ | If you want to use the dynamics libraries (recommended): | ||
+ | cmake -DREGEX_INCLUDE_DIR= \ | ||
+ | -DCURL_LIBRARY=$BUILD_DIR/curl/builds/libcurl-vc-x86-release-dll-ipv6-sspi-winssl/bin/libcurl.dll \ | ||
+ | -DCURL_INCLUDE_DIR=$BUILD_DIR/curl/include \ | ||
+ | -DXZ_LIBRARY=$BUILD_DIR/xz/bin_i486/liblzma.dll \ | ||
+ | -DXZ_INCLUDE_DIR=$BUILD_DIR/xz/include \ | ||
+ | -DZLIB_LIBRARY=$BUILD_DIR/zlib/zlib1.dll \ | ||
+ | -DZLIB_INCLUDE_DIR=$BUILD_DIR/zlib \ | ||
+ | -DICU_LIBRARY=$BUILD_DIR/icu/win-build/lib/icuuc54.dll \ | ||
+ | -DICU_I18N_LIBRARY=$BUILD_DIR/icu/win-build/lib/icuin54.dll \ | ||
+ | -DICU_INCLUDE_DIR=$BUILD_DIR/icu/include \ | ||
+ | -DBZIP2_LIBRARY=$BUILD_DIR/bzip2/libbz2.dll \ | ||
+ | -DBZIP2_LIBRARY=$BUILD_DIR/bzip2 \ | ||
+ | -DCMAKE_TOOLCHAIN_FILE=/opt/mxe/usr/i686-w64-mingw32/share/cmake/mxe-conf.cmake -G "Unix Makefiles" .. | ||
+ | make sword | ||
+ | : ...or if you want to use MXE's system libraries: | ||
+ | # | ||
+ | # I couldn't link against MXE's static build of libcurl. | ||
+ | # It might be to do with this: http://curl.haxx.se/docs/faq.html#Link_errors_when_building_libcur | ||
+ | # | ||
+ | cmake -DREGEX_INCLUDE_DIR= \ | ||
+ | -DCURL_LIBRARY=$BUILD_DIR/curl/builds/libcurl-vc-x86-release-dll-ipv6-sspi-winssl/bin/libcurl.dll \ | ||
+ | -DCURL_INCLUDE_DIR=$BUILD_DIR/curl/include \ | ||
+ | -DICU_LIBRARY=$BUILD_DIR/icu/win-build/lib/icuuc54.dll \ | ||
+ | -DICU_I18N_LIBRARY=$BUILD_DIR/icu/win-build/lib/icuin54.dll \ | ||
+ | -DICU_INCLUDE_DIR=$BUILD_DIR/icu/include \ | ||
+ | -DCMAKE_TOOLCHAIN_FILE=/opt/mxe/usr/i686-w64-mingw32/share/cmake/mxe-conf.cmake -G "Unix Makefiles" .. | ||
+ | make sword | ||
+ | : ...or if you want to use MXE's system ICU too: | ||
+ | # | ||
+ | # I couldn't link against MXE's static build of libcurl. | ||
+ | # It might be to do with this: http://curl.haxx.se/docs/faq.html#Link_errors_when_building_libcur | ||
+ | # | ||
+ | cmake -DREGEX_INCLUDE_DIR= \ | ||
+ | -DCURL_LIBRARY=$BUILD_DIR/curl/builds/libcurl-vc-x86-release-dll-ipv6-sspi-winssl/bin/libcurl.dll \ | ||
+ | -DCURL_INCLUDE_DIR=$BUILD_DIR/curl/include \ | ||
+ | -DCMAKE_TOOLCHAIN_FILE=/opt/mxe/usr/i686-w64-mingw32/share/cmake/mxe-conf.cmake -G "Unix Makefiles" .. | ||
+ | make sword | ||
+ | # | ||
+ | # 'make sword' will end in an error (similarly 'make blah'). | ||
+ | # | ||
+ | # ... but all we need to do is link against icudt. So we hack link.txt a bit an run ... | ||
+ | # | ||
+ | `echo $(tail -n1 CMakeFiles/sword.dir/link.txt) -licudt -licuuc` | ||
+ | NOTE: the directory that your libcurl.dll ends up in might be different to mine - but it will be something like build/libcurl-blah-release-dll-blah-blah-blah/bin/libcurl.dll. I also had to rename liblzma.dll to liblzma-5.dll for some reason... | ||
== Cross Compiling Sword for MS Windows on Suse Linux with MingW == | == Cross Compiling Sword for MS Windows on Suse Linux with MingW == | ||
Line 116: | Line 210: | ||
patch1 patch2 | patch1 patch2 | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
[[Category:Tutorials]] | [[Category:Tutorials]] | ||
+ | [[Category:SWORD]] |
Latest revision as of 14:03, 11 January 2018
- For compiling on Linux, see Tutorial:Compiling & Installing SWORD.
Contents
Compiling The SWORD Project using MS Visual Studio 2013
- Create a build directory, hereafter referred to as $dir$. Much of the Sword build process expects that various downloads be unpacked to the same directory.
Compiling cURL
- Download the latest release of cURL
- Extract the ZIP to $dir$
- Rename the cURL directory to "curl" (with no version number)
- Start a Developer Command Prompt (find this on your Start Menu in the Visual Studio 2013 | Visual Studio Tools menu)
- cd to $dir$/curl/winbuild
- Execute: nmake /f Makefile.vc mode=static DEBUG=no
Compiling ICU
- Download the latest release of ICU. At writing, the latest version is 52.1: [1]
- Extract the tarball to $dir$
- Open $dir$\icu\source\allinone\allinone.sln
- Ensure that the Win32 Release configuration is selected and build the solution
Compiling zlib
- Download the latest release of zlib source code. At writing, the latest version is 1.2.8: [2]
- Extract the archive to $dir$ and rename the directory "zlib" (with no version number)
- Start a Developer Command Prompt (find this on your Start Menu in the Visual Studio 2013 | Visual Studio Tools menu)
- cd to $dir$/zlib
- Execute: nmake /f win32/Makefile.msc
Compiling bzip2
- Download the latest release of bzip2. At writing, the latest version is 1.0.6: [3]
- Extract the archive to $dir$ and rename the directory "bzip2"
- Open $dir$\bzip2\libbz2.dsp and allow Visual Studio to update the project
- Ensure that the Release configuration is selected and build the solution
Downloading liblzma
- Download the latest release of xz prebuilt for Windows from tukaani.org. At writing, the latest version is 5.0.5: [4]
- Extract the archive to $dir$/xz
- Start a Developer Command Prompt (find this on your Start Menu in the Visual Studio 2013 | Visual Studio Tools menu)
- cd to $dir$/xz/bin_i486
- Execute: lib /def:../doc/liblzma.def /out:liblzma.lib /machine:x86
Compiling CLucene
- Install cmake
- Download the latest version of boost. At writing, the latest version is 1.5.5: [5]
- Extract the archive to $dir$
- Rename the boost directory to "boost"
- Download a snapshot of the CLucene 2_3_2 branch
- Extract the archive to $dir$
- Rename the CLucene directory to "clucene"
- Start a regular Command Prompt (cmd.exe)
- cd to $dir$/clucene
- Set Boost environment variables by executing the following (with replacements for $dir$):
- set BOOST_BUILD_PATH=$dir$\boost\tools\build\v2
- set BOOST_PATH=$dir$
- set BOOST_ROOT=$dir$\boost
- Execute: mkdir cmakebuild
- Execute: cd cmakebuild
- Execute: cmake -G "Visual Studio 12" ..
- Open $dir$\clucene\cmakebuild\clucene.sln
- Ensure that the Release configuration is selected and build the BUILD_ALL project
Compiling libsword
- Download the latest release of The SWORD Project or download a copy from SVN: https://www.crosswire.org/svn/sword/trunk/
- Extract the tarball to $dir$
- If you are building utilities or diatheke, the following steps are not necessary:
- Open $dir$\sword-$version$\lib\vcppmake\libsword.sln
- Build the solution (Release, Debug, or both)
Compiling utilities
- Open $dir$\sword-$version$\utilities\vcppmake\utilities.sln
- Build the solution (Release, Debug, or both)
Cross Compiling Sword for MS Windows on Linux with MingW
NOTE: these instructions do not include CLucene.
- Create a build directory $BUILD_DIR
- Download the latest version of SWORD from svn
svn co https://www.crosswire.org/svn/sword/trunk/ $BUILD_DIR/sword
- Download and install MXE (steps 1 and 2 of the tutorial here [6]).
- Aquire all the dependancies (except ICU and CLucene)
- by using the instructions above (on windows with visual studio)
- downloading the binaries (dynamic linking)
- using MXE's system libraries (static linking). In this case, change to MXE's install dir ('/opt/mxe' in the tutorial) and do:
su make MXE_TARGETS='i686-w64-mingw32' gcc zlib bzip2 xz curl
Aquire icu
Download the latest ICU source [7] Inflate the zip or tar archive to $BUILD_DIR/icu
# # Make icu for linux first... cd $BUILD_DIR/icu/source/ mkdir linux-build cd linux-build ../source/runConfigureICU Linux # # ...then cross-compile for windows... cd $BUILD_DIR/icu/source mkdir win-build cd win-build # # ...making sure we are being consistant with which compiler we are using by setting CC and CXX... CC=/opt/mxe/usr/bin/i686-w64-mingw32-gcc CXX=/opt/mxe/usr/bin/i686-w64-mingw32-g++ ../source/runConfigureICU MinGW --host=i686-w64-mingw32 --with-cross-build=$BUILD_DIR/icu/linux-build # # Finally, set up the include dir for use with cmake cd $BUILD_DIR/icu cp -r source/*/unicode/ include/
- ...or use MXE's system icu. Take care when doing this because
- it be an older version of icu (ie, icu51 at time of writing).
- MXE make static libraries (haven't figured out how to get dynamic ones yet) which bloat the libsword.dll!
- you will have to hack the build process a bit too.
su make MXE_TARGETS='i686-w64-mingw32' icu4c
Building SWORD
Make an out of source-directory-for cmake.
mkdir $BUILD_DIR/sword/cmakebuild cd $BUILD_DIR/sword/cmakebuild
If you want to use the dynamics libraries (recommended):
cmake -DREGEX_INCLUDE_DIR= \ -DCURL_LIBRARY=$BUILD_DIR/curl/builds/libcurl-vc-x86-release-dll-ipv6-sspi-winssl/bin/libcurl.dll \ -DCURL_INCLUDE_DIR=$BUILD_DIR/curl/include \ -DXZ_LIBRARY=$BUILD_DIR/xz/bin_i486/liblzma.dll \ -DXZ_INCLUDE_DIR=$BUILD_DIR/xz/include \ -DZLIB_LIBRARY=$BUILD_DIR/zlib/zlib1.dll \ -DZLIB_INCLUDE_DIR=$BUILD_DIR/zlib \ -DICU_LIBRARY=$BUILD_DIR/icu/win-build/lib/icuuc54.dll \ -DICU_I18N_LIBRARY=$BUILD_DIR/icu/win-build/lib/icuin54.dll \ -DICU_INCLUDE_DIR=$BUILD_DIR/icu/include \ -DBZIP2_LIBRARY=$BUILD_DIR/bzip2/libbz2.dll \ -DBZIP2_LIBRARY=$BUILD_DIR/bzip2 \ -DCMAKE_TOOLCHAIN_FILE=/opt/mxe/usr/i686-w64-mingw32/share/cmake/mxe-conf.cmake -G "Unix Makefiles" .. make sword
- ...or if you want to use MXE's system libraries:
# # I couldn't link against MXE's static build of libcurl. # It might be to do with this: http://curl.haxx.se/docs/faq.html#Link_errors_when_building_libcur # cmake -DREGEX_INCLUDE_DIR= \ -DCURL_LIBRARY=$BUILD_DIR/curl/builds/libcurl-vc-x86-release-dll-ipv6-sspi-winssl/bin/libcurl.dll \ -DCURL_INCLUDE_DIR=$BUILD_DIR/curl/include \ -DICU_LIBRARY=$BUILD_DIR/icu/win-build/lib/icuuc54.dll \ -DICU_I18N_LIBRARY=$BUILD_DIR/icu/win-build/lib/icuin54.dll \ -DICU_INCLUDE_DIR=$BUILD_DIR/icu/include \ -DCMAKE_TOOLCHAIN_FILE=/opt/mxe/usr/i686-w64-mingw32/share/cmake/mxe-conf.cmake -G "Unix Makefiles" .. make sword
- ...or if you want to use MXE's system ICU too:
# # I couldn't link against MXE's static build of libcurl. # It might be to do with this: http://curl.haxx.se/docs/faq.html#Link_errors_when_building_libcur # cmake -DREGEX_INCLUDE_DIR= \ -DCURL_LIBRARY=$BUILD_DIR/curl/builds/libcurl-vc-x86-release-dll-ipv6-sspi-winssl/bin/libcurl.dll \ -DCURL_INCLUDE_DIR=$BUILD_DIR/curl/include \ -DCMAKE_TOOLCHAIN_FILE=/opt/mxe/usr/i686-w64-mingw32/share/cmake/mxe-conf.cmake -G "Unix Makefiles" .. make sword # # 'make sword' will end in an error (similarly 'make blah'). # # ... but all we need to do is link against icudt. So we hack link.txt a bit an run ... # `echo $(tail -n1 CMakeFiles/sword.dir/link.txt) -licudt -licuuc`
NOTE: the directory that your libcurl.dll ends up in might be different to mine - but it will be something like build/libcurl-blah-release-dll-blah-blah-blah/bin/libcurl.dll. I also had to rename liblzma.dll to liblzma-5.dll for some reason...
Cross Compiling Sword for MS Windows on Suse Linux with MingW
Suse with MingW
Installation of all necessary dependencies of Sword, but for CLucene - libcurl, ICU, libgnurx etc -
Compilation of Clucene
clucene 0.9.21b source
The scripts for compiling sword and clucene in xiphos/win32/suse are meant to be used from ~/source/ with the clucene and sword directories directly under that. I would suggest reading the scripts. They aren't complicated, and I'm sure that I made assumptions about my environment (which is basically the *sole* reason for the warning that they aren't ready, I never meant they couldn't be used). You can go ahead and try to use them to cross-compile clucene. It will probably fail. If at that point, you send me config.log, that will help me remember what to do to fix it.
edit m4/dps_static_const_type.m4, the last AC_DEFINE line. Change from:
AC_MSG_ERROR([Cannot figure out how to write static consts in classes. Check the m4 script or upgrade your compiler])
to:
AC_DEFINE([LUCENE_STATIC_CONSTANT_SYNTAX], 1, [How to define a static const in a class])
eg, the same as the first AC_DEFINE. I have no idea if it's correct, actually, but it seems to work ;)
Next, edit src/Makefile.am, line 6. Add -no-undefined at the end, like so:
libclucene_la_LDFLAGS = --version-info $(CLLIB_VERSION) --release $(PACKAGE_VERSION) -no-undefined
src/CLucene/store/FSDirectory.cpp
At the top of that file, after the #include directives, I just added this:
#define _mkdir mkdir
After changing these, you'll have to run autogen.sh and then re-configure using my script. It *should* build after this, at which point run sudo make install. Check to be sure it created a dll rather than just a static library (which will end in .la). It should be located in /usr/i686-w64-mingw32/sys-root/mingw/bin
After this Clucene compiles without errors and creates a working dll.
Compilation of Sword
Application of 2 patches:
patch1 patch2