Cross compiling page in techbase

Carlo brandon.ml at gmail.com
Wed Mar 12 23:18:30 CET 2008


On Wed, Mar 12, 2008 at 6:31 PM, Alexander Neundorf <neundorf at kde.org> wrote:
> Hi,
>
>
>
>  On Wednesday 12 March 2008, Carlo wrote:
>  > On Tue, Mar 11, 2008 at 9:47 PM, Alexander Neundorf <neundorf at kde.org>
>  wrote:
>  > > On Tuesday 11 March 2008, Carlo wrote:
>  > >  > On Tue, Mar 11, 2008 at 7:45 PM, Alexander Neundorf <neundorf at kde.org>
>  > >
>  > >  wrote:
>  > >  > > On Tuesday 11 March 2008, Carlo wrote:
>  > >  > >  > Hi, i've added a page in techbase with instruction to
>  > >  > >  > crosscompile kde for windows from linux
>  > >  > >  > http://techbase.kde.org/index.php?title=Getting_Started/Build/KDE
>  > >  > >  >4/Win dows/ CrossCompiling and i've linked it to
>  > >  > >
>  > >  > >  Wow, _very_ cool ! :-)
>  > >  > >
>  > >  > >  Some questions:
>  > >  > >
>  > >  > >  Why do you need to preset all the variables starting with
>  > >  > > KDE4_INSTALL_DIR, especially the KDE4_XXX_LIBRARY variables ?
>  > >  >
>  > >  > KDE4_INSTALL_DIR is just for convenience so you don't have to modify
>  > >
>  > >  Why do you have to set CMAKE_MODULE_PATH ? This really shouldn't be
>  > > necessary. It is set at the top of kdelibs/CMakeLists.txt. What doesn't
>  > > work there ?
>  > >
>  > >  Why do you set the KDE4_xxx_LIBRARY variables ? They also really
>  > > shouldn't be necessary. What are the errors ?
>  >
>  > Yeah that's unnecessary, i set that because i've seen this line  when
>  > running cmake
>  > -- Adding /home/kdeuser/kde/share/apps/cmake/modules to CMAKE_MODULE_PATH
>  > and that's the linux kde4 modules dir so i tought  that it could
>  > conflict with the windows one and cant' automatically find
>  > KDE4_xxx_LIBRARY for that reason but it adds that line anyway  in
>  > FindQt4 iirc
>  >
>  > if I don't set KDE4_KDECORE_LIBRARY cmake gives this error
>  > CMake Error: ERROR: could NOT find everything required for compiling
>  > KDE 4 programs
>  >
>  > while for other libraries it says something like this
>  > KDE4_PHONON_LIBRARY
>  >    linked by target "knotify" in directory
>  > /home/kdeuser/kde/src/KDE/kdebase/runtime/knotify
>  >    linked by target "konq_sound" in directory
>  > /home/kdeuser/kde/src/KDE/kdebase/apps/lib/konq
>
>  Ahh, so this is already in kdebase.
>  I have split your file into two parts:
>  Toolchain-mingw32.cmake which has to be used as toolchain file for every KDE
>  module (i.e. also kdelibs) and mingw32-kdelibs.cmake which contains settings
>  which should come from the installed kdelibs (i.e. it must not be used for
>  kdelibs).
>  The problem here was that FindKDE4.cmake runs kde4-config and checks what this
>  returns.
>  I attached a modified FindKDE4.cmake file which only executes kde4-config if
>  KDE4_DATA_DIR is not set.
>  So by setting KDE4_DATA_DIR in mingw32-kdelibs.cmake this FindKDE4.cmake
>  should work as expected for cross compiling.
>  I forgot, so you have to use Toolchain-mingw32.cmake
>  with -DCMAKE_TOOLCHAIN_FILE=..., and the other file to preload the cmake
>  cache, which is done using -C <filename>.
>  So for kdebase you would need something like:
>
>  cmake -DCMAKE_TOOLCHAIN_FILE=<path>/Toolchain-mingw32.cmake -C
>  <path>/mingw32-kdelibs.cmake <src dir>
you forgot set(KDE4_INSTALL_DIR    /windows/kde4) in the toolchain file
anyway it doesn't work, this is the erorr
-- ERROR: unable to find KDE 4 headers
-- ERROR: unable to find KDE 4 core library

in FindKDE4Internal.cmake
find_path(KDE4_INCLUDE_DIR kpassworddialog.h
${KDE4_INCLUDE_INSTALL_DIR} NO_DEFAULT_PATH )
and KDE4_INCLUDE_INSTALL_DIR is set to /home/kdeuser/kde/include but
that's the kde4 linux include not the windows one and btw
kpassworddialog.h exist in that dir
>
>  > >  > the path for all set, I have to specify some kde/qt library because
>  > >  > cmake can't find them itself and
>  > >  > i have disabled dnssd/avahi etc..
>  > >
>  > >  That's ok.
>  > >
>  > >  > because cmake find the linux one and think that it's good
>  > >
>  > >  This shouldn't happen.
>  > >  For which packages does it find the wrong versions ?
>  > >  Can you please post the complete list, with the location of the windows
>  > >  versions and what cmake found ?
>  > >  (maybe these are packages where pkg-config is used...)
>  >
>  >  the problem is GSSAPI, this is what cmake found
>  >  GSSAPI_FLAVOR                    MIT
>  >  GSSAPI_INCS
>  >  GSSAPI_LIBS                      -L/usr/lib -lgssapi_krb5 -lkrb5
>  > -lk5crypto -lcom_err
>  >
>  > i don't have gssapi and the other libraries that i've disabled on
>  > windows(and they don't exist in the kdewin installer either)
>
>  The problem here is that FindGSSAPI.cmake runs krb5-config and querys this for
>  information. Problem is that when cross compiling in general the executables
>  from the target cannot be executed.
>  We'll care for this one later.
>
>
>  > >  > >  Some comments:
>  > > > >  > you have to make a link to your kde4automoc for linux in the bin
>  > > > >  >
>  > >  > >  > directory
>  > >  > >
>  > >  > >  we should be able to fix that...
>  > >  > >
>  > >  > >  > since linux is case sensitive you have to make symbolic links for
>  > >  > >  > some headers
>  > >  > >
>  > >  > >  Can't this be corrected in the source files where the headers are
>  > >  > > included ?
>  > >  >
>  > >  > yeah this can be fixed in the source file too(maybe soprano would
>  > >  > require an ifdef since there are both soprano and Soprano on linux),
>  > >  > but link was easier to do
>  > >
>  > >  We should definitely fix it.
>  > >  Can you commit or do you have to create a patch ?
>  >
>  > Yes i can commit i will change that includes later
>
>  Yes, please do :-)
Ok i've commited, but for Soprano there are too many includes, it's
better to do a symbolic link rather then a lot of ifdefs
>
>  > >  > >  > You will get a linker error on kjsembed so from the build
>  > >  > >  > directory cd into kjsembed/kjsembed and make VERBOSE=1
>  > >  > >  > 2>/dev/null
>  > >  > >
>  > >  > >  what's the problem here with linking ?
>  > >  > >  This shouldn't happen, we have to fix it.
>  > >  >
>  > >  > it's a long linker error about QtUiTools it can't find anything
>  > >  > related to qt(QString, QDataStream etc..)
>  > >
>  > >  Can you please post the linker command and the complete error message ?
>  >
>  > this is the linker command:
>  > Linking CXX shared library ../../bin/libkjsembed.dll
>  > cd /home/kdeuser/kde/src/KDE/kdelibs/build/kjsembed/kjsembed &&
>  > /usr/local/bin/cmake -E cmake_link_script
>  > CMakeFiles/kjsembed.dir/link.txt --verbose=1
>  > /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/quiloader_binding.cpp.obj -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/lib/libbzip2.dll.a
>  > /windows/kde4/lib/libintl.dll.a /windows/kde4/lib/libpcre.dll.a
>  > /windows/kde4/lib/libpcreposix.dll.a
>  >
>  >
>  > and this is the long error message http://kde.pastebin.com/f3aa4d4f6
>
>  Ok. This is as far as I see always undefined references from QtUiTools to
>  QtCore:
>  > /windows/kde4/lib/libQtUiTools.a(quiloader.o):quiloader.cpp:(.text+0x7fd):
>  > undefined reference to `__imp___ZNK7QString6toUtf8Ev'
>
>  Which value does QT_QTUITOOLS_LIBRARY have ?
/windows/kde4/lib/libQtUiTools.a
anyway I've find out that it could be fixed by just removing
/windows/kde4/lib/libQtCore4.a and adding -lQtCore4 instead of every
Qt lib
>  > >  > >  > You will get another error in klauncher.moc about slotKDEInitData
>  > >  > >  > so go into kinit and do something like this(you need wine)
>  > >  > >
>  > >  > >  What's the exact problem here ?
>  > >  > >  Does the Windows moc have to be used ? Why ?
>  > >  >
>  > >  > slotKDEInitData doesn't exist on windows
>  > >  > http://lxr.kde.org/source/KDE/kdelibs/kinit/klauncher.h#179 but
>  > >  > kde4automoc thinks that we are on linux maybe, so maybe we should use
>  > >  > the windows version for everything
>  > >
>  > >  Hmm, if we are cross compiling to Windows Q_WS_WIN should be defined.
>  > >  Can you find out why it isn't ?
>  >
>  > Q_WS_WIN is defined when compiling but not in moc, probably it has
>  > hardcoded parameters from the platform where it was compiled
>
>  Hmm, that sounds bad. Let's care about this later.
>
>
>  > >  > >  > Another error in kdewidgets because wine doesn't find some dll to
>  > >  > >  > run makekdewidgets.exe so either run the linux version manually
>  > >  > >  > like this
>  > >  > >
>  > >  > >  So you run the generated executables using wine ? Interesting. The
>  > >  > > idea was to use "native" executables if cross compiling. But if it
>  > >  > > works, ok.
>  > >  > >
>  > >  > >  Alex
>  > >  >
>  > >  > for some strange reason for kde4automoc it calls ../bin/kde4automoc
>  > >  > instead of ../bin/kde4automoc.exe one that's why i made the link in
>
>  Is the .exe extension really required to run the executable ?
>  Under Windows it isn't. Is this a wine speciality ?
no, the problem here is that cmake wants to run makekdewidgets.exe,
maybe it tries to run makekdewidgets.exe.bat while kde4automoc is
called directly
>  I'd really like to get this working cleanly, it's still time to fix things in
>  cmake for cross compiling, 2.6.0 hasn't been released yet.
>
>  Alex
>



More information about the Kde-windows mailing list