Getting Started/Build/Windows/Cross-Compiling
cleanup confusing sections and fix sections which contain a todo
cross compiling is still unstable
Basic tools
MinGw
Install mingw for linux, on debian the packages are called mingw32, mingw32-binutils, mingw32-runtime, you need to install mingw32 with gcc/g++ 3 and not 4 since that doesn't work with kdelibs, debian testing/unstable has gcc 4 so i've installed mingw32 package from ubuntu repository
Qt4 Kdesupport and dependencies
You can install these dependencies(aspell, boost, dbus, qca etc..) from windows with the kdewin installer or manually download them from sourceforge mirrors
Qt4 and KDE4 for linux
You also need to have Qt4 and KDE4 already installed on linux, to use moc/uic/kde4automoc etc...
Cmake
To cross compile kde you need cmake >= 2.5, you can get the last version from CVS
- Create a file Toolchain-mingw32.cmake with this content and place it somewhere i.e. in your home
- the name of the target operating system
SET(CMAKE_SYSTEM_NAME Windows)
- which compilers to use for C and C++
SET(CMAKE_C_COMPILER i586-mingw32msvc-gcc)
SET(CMAKE_CXX_COMPILER i586-mingw32msvc-g++)
- here is the target environment located
SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc /windows/kde4 )
- adjust the default behaviour of the FIND_XXX() commands:
- search headers and libraries in the target environment, search
- programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(KDE4_INSTALL_DIR /windows/kde4)
set(QT_BINARY_DIR /home/kdeuser/kde/src/qt-copy/bin)
set(CMAKE_MODULE_PATH ${KDE4_INSTALL_DIR}/share/apps/cmake/modules)
set(CMAKE_INSTALL_PREFIX ${KDE4_INSTALL_DIR})
set(LIB_INSTALL_DIR ${KDE4_INSTALL_DIR}/lib)
set(QT_LIBRARY_DIR ${KDE4_INSTALL_DIR}/lib)
set(QT_QTCORE_LIBRARY ${KDE4_INSTALL_DIR}/lib/libQtCore4.a)
set(QT_QTCORE_INCLUDE_DIR ${KDE4_INSTALL_DIR}/include/QtCore)
set(QT_MKSPECS_DIR ${KDE4_INSTALL_DIR}/mkspecs)
set(QT_MOC_EXECUTABLE ${QT_BINARY_DIR}/moc)
set(QT_QMAKE_EXECUTABLE ${QT_BINARY_DIR}/qmake)
set(QT_UIC_EXECUTABLE ${QT_BINARY_DIR}/uic)
set(WITH_AVAHI OFF)
set(WITH_DNSSD OFF)
set(WITH_ENCHANT OFF)
set(WITH_FAM OFF)
set(WITH_GSSAPI OFF)
set(WITH_HSPELL OFF)
set(WITH_OpenEXR OFF)
set(KDE4_DATA_DIR ${KDE4_INSTALL_DIR}/share/apps)
set(KDE4_LIB_INSTALL_DIR ${KDE4_INSTALL_DIR}/lib)
set(KDE4_INCLUDE_DIR ${KDE4_INSTALL_DIR}/include)
set(KDE4_KDECORE_LIBRARY ${KDE4_INSTALL_DIR}/lib/libkdecore.dll.a)
set(KDE4_KDE3SUPPORT_LIBRARY ${KDE4_INSTALL_DIR}/lib/libkde3support.dll.a)
set(KDE4_KDEUI_LIBRARY ${KDE4_INSTALL_DIR}/lib/libkdeui.dll.a)
set(KDE4_KIO_LIBRARY ${KDE4_INSTALL_DIR}/lib/libkio.dll.a)
set(KDE4_KDNSSD_LIBRARY ${KDE4_INSTALL_DIR}/lib/libkdnssd.dll.a)
set(KDE4_KFILE_LIBRARY ${KDE4_INSTALL_DIR}/lib/libkfile.dll.a)
set(KDE4_KHTML_LIBRARY ${KDE4_INSTALL_DIR}/lib/libkhtml.dll.a)
set(KDE4_KNEWSTUFF2_LIBRARY ${KDE4_INSTALL_DIR}/lib/libknewstuff2.dll.a)
set(KDE4_KNOTIFYCONFIG_LIBRARY ${KDE4_INSTALL_DIR}/lib/libknotifyconfig.dll.a)
set(KDE4_KPARTS_LIBRARY ${KDE4_INSTALL_DIR}/lib/libkparts.dll.a)
set(KDE4_KTEXTEDITOR_LIBRARY ${KDE4_INSTALL_DIR}/lib/libktexteditor.dll.a)
set(KDE4_KUTILS_LIBRARY ${KDE4_INSTALL_DIR}/lib/libkutils.dll.a)
set(KDE4_PHONON_LIBRARY ${KDE4_INSTALL_DIR}/lib/libphonon.dll.a)
set(KDE4_SOLID_LIBRARY ${KDE4_INSTALL_DIR}/lib/libsolid.dll.a)
adjust the values according to your setup
Build kdelibs
svn co svn://anonsvn.kde.org/home/kde/trunk/KDE/kdelibs
cd kdelibs
mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=~/Toolchain-mingw32.cmake ..
- you have to make a link to your kde4automoc for linux in the bin directory
ln -s /path/to/kde4automoc bin/
ln -s /path/to/kconfig_compiler bin/
- since linux is case sensitive you have to make symbolic links for some headers
cd /usr/i586-mingw32msvc/include
ln -s userenv.h Userenv.h
ln -s windows.h Windows.h
cd /windows/kde4/include
ln -s soprano Soprano
- You will get a linker error on kjsembed so from the build directory cd into kjsembed/kjsembed and make VERBOSE=1 2>/dev/null
copy the last command i.e.
/usr/bin/i586-mingw32msvc-g++ -Wl,--export-all-symbols -Wl,--disable-auto-import -shared -o ../../bin/libkjsembed.dll -Wl,--out-implib,../../bin/libkjsembed.dll.a -Wl,--major-image-version,4,--minor-image-version,1 CMakeFiles/kjsembed.dir/kjsembed_automoc.cpp.obj CMakeFiles/kjsembed.dir/kjseglobal.cpp.obj CMakeFiles/kjsembed.dir/binding_support.cpp.obj CMakeFiles/kjsembed.dir/static_binding.cpp.obj CMakeFiles/kjsembed.dir/variant_binding.cpp.obj CMakeFiles/kjsembed.dir/object_binding.cpp.obj CMakeFiles/kjsembed.dir/builtins.cpp.obj CMakeFiles/kjsembed.dir/fileio.cpp.obj CMakeFiles/kjsembed.dir/jseventmapper.cpp.obj CMakeFiles/kjsembed.dir/eventproxy.cpp.obj CMakeFiles/kjsembed.dir/slotproxy.cpp.obj CMakeFiles/kjsembed.dir/jseventutils.cpp.obj CMakeFiles/kjsembed.dir/qobject_binding.cpp.obj CMakeFiles/kjsembed.dir/kjsembed.cpp.obj CMakeFiles/kjsembed.dir/value_binding.cpp.obj CMakeFiles/kjsembed.dir/iosupport.cpp.obj CMakeFiles/kjsembed.dir/qwidget_binding.cpp.obj CMakeFiles/kjsembed.dir/qaction_binding.cpp.obj CMakeFiles/kjsembed.dir/qlayout_binding.cpp.obj CMakeFiles/kjsembed.dir/qpainter_binding.cpp.obj CMakeFiles/kjsembed.dir/settings.cpp.obj CMakeFiles/kjsembed.dir/svg_binding.cpp.obj CMakeFiles/kjsembed.dir/filedialog_binding.cpp.obj CMakeFiles/kjsembed.dir/application.cpp.obj CMakeFiles/kjsembed.dir/color.cpp.obj CMakeFiles/kjsembed.dir/dom.cpp.obj CMakeFiles/kjsembed.dir/font.cpp.obj CMakeFiles/kjsembed.dir/image.cpp.obj CMakeFiles/kjsembed.dir/pen.cpp.obj CMakeFiles/kjsembed.dir/pixmap.cpp.obj CMakeFiles/kjsembed.dir/point.cpp.obj CMakeFiles/kjsembed.dir/rect.cpp.obj CMakeFiles/kjsembed.dir/size.cpp.obj CMakeFiles/kjsembed.dir/url.cpp.obj CMakeFiles/kjsembed.dir/bind_qlcdnumber.cpp.obj CMakeFiles/kjsembed.dir/bind_qtimer.cpp.obj CMakeFiles/kjsembed.dir/brush.cpp.obj CMakeFiles/kjsembed.dir/QBrush_bind.cpp.obj CMakeFiles/kjsembed.dir/quiloader_binding.cpp.obj -L/windows/kde4/bin -L/windows/kde4/lib ../../bin/libkdecore.dll.a /windows/kde4/lib/libQtCore4.a /windows/kde4/lib/libQtUiTools.a /windows/kde4/lib/libQtGui4.a /windows/kde4/lib/libQtSvg4.a ../../bin/libkjs.dll.a /windows/kde4/lib/libQtNetwork4.a /windows/kde4/lib/libQtDBus4.a /windows/kde4/lib/libz.dll.a /windows/kde4/lib/libkdewin32.dll.a -luser32 -lshell32 -lws2_32 -lnetapi32 -luserenv /windows/kde4/lib/libQtXml4.a /windows/kde4/bin/bzip2.dll /windows/kde4/lib/libintl.dll.a /windows/kde4/bin/libpcre.dll /windows/kde4/bin/libpcreposix.dll
you need to remove
/windows/kde4/lib/libQtCore4.a /windows/kde4/lib/libQtUiTools.a /windows/kde4/lib/libQtGui4.a /windows/kde4/lib/libQtSvg4.a /windows/kde4/lib/libQtNetwork4.a /windows/kde4/lib/libQtDBus4.a /windows/kde4/lib/libQtXml4.a
from this command and add
-lQtCore4 -lQtUiTools -lQtGui4 -lQtSvg4 -lQtNetwork4 -lQtDBus4 -lQtXml4 t
execute the modified command and continue with the normal building
- You will get another error in klauncher.moc about slotKDEInitData so go into kinit and do something like this(you need wine)
make clean
rm *.moc
../bin/kde4automoc.exe /home/kdeuser/kde/src/KDE/kdelibs/build/kinit/kdeinit_klauncher_automoc.cpp /home/kdeuser/kde/src/KDE/kdelibs/kinit /home/kdeuser/kde/src/KDE/kdelibs/build/kinit /windows/kde4/bin/moc.exe
and then do make as usual