Cross compiling page in techbase

Carlo brandon.ml at gmail.com
Wed Mar 12 01:49:23 CET 2008


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/KDE4/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
>  > 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)
>  > >  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

>  > >  > 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/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/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

>
>  > >  > 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

>  > >  > 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
>  > the bin dir, but for makekdewidgets it wants to use the exe one
>
>  Can you please have a look at FindKDE4Internal.cmake.
>  There you will find this code:
>
>  if (_kdeBootStrapping)
>    set(KDE4_INCLUDE_DIR ${kdelibs_SOURCE_DIR})
>    set(KDE4_KDECORE_LIBS ${QT_QTCORE_LIBRARY} kdecore)
>    ...
>    if (WIN32)
>       set(LIBRARY_OUTPUT_PATH            ${EXECUTABLE_OUTPUT_PATH} )
>       ...
>    else (WIN32)
>       set(LIBRARY_OUTPUT_PATH            ${CMAKE_BINARY_DIR}/lib )
>       ...
>    endif (WIN32)
>
>  which branch does it enter here ?
>  I assume it goes into the else() branch, which is wrong for cross compiling to
>  Windows.
>  Does it change if you replace the
>  if(WIN32)
>  with
>  if (CMAKE_SYSTEM MATCHES Windows)
>  ?
>
>  (when cross compiling CMAKE_SYSTEM is for the target system, CMAKE_HOST_SYSTEM
>  is for the build host, WIN32, UNIX and APPLE are for the build host).
>
>  Alex
>
it works either with WIN32 or with CMAKE_SYSTEM so the problem is not there



More information about the Kde-windows mailing list