This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Any Advice on Setting Up a compiled Qt to work with Cmake?

Tags: None
(comma "," separated)
LastGuyonEarth
Registered Member
Posts
16
Karma
0
As part of a personal project, I'm working on building the latest release branch of KDE 4.3 on top of gNewSense.

"What?!" you ask. "Why would you do such a thing?!"

Well, I'm doing it for several reasons:

1.) To help me understand the inner workings of both KDE and Qt so that I may one day code with them.

2.) To get a desktop environment that I really love working on a Free-As-Can-Be distribution.

3.) To eventually help package KDE 4.3 final when it comes out for the gNewSense project.

It's all very much a learning experience for me. Currently, I've gotten Cmake and Qt built. All very nice. I have the most recent KDE SVN release from /trunk, and I have a kde-devel profile on my computer with a specialized .bashrc

However, when I try and run CMake in kdelibs, I get the following error:

CMake Error at cmake/modules/FindQt4.cmake:1493 (MESSAGE):
The installed Qt version 4.3.4 is too old, at least version 4.5.0 is
required
Call Stack (most recent call first):
cmake/modules/FindKDE4Internal.cmake:289 (find_package)
CMakeLists.txt:35 (find_package)


-- Configuring incomplete, errors occurred!



With a little digging around the internet, it seems that the error is stemming from the fact that I have a previous version of Qt installed. Well okay, so apparently this line has to go somewhere:


-DQT_QMAKE_EXECUTABLE=/usr/local/Trolltech/Qt-4.5.1/bin/qmake




According to a mailing list I was reading, I have to use this line to tell Cmake to link to these newly-built libraries. However, I'm not sure which files this line is supposed to go into. If anyone can clue me in to figuring this out, I'd greatly appreciate it!


"As the Days change like weather, all of you must know:
Everything gets better. Everything regrows."

-Forest, from "Under an Iron Tree" by Sean Tilley
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
You need to set the following environment variables ( in your shell ) before running CMake.
QTDIR=Where you installed Qt
CMAKE_PREFIX_PATH=$QTDIR
PATH=$QTDIR/bin:$PATH
LD_LIBRARY_PATH=$QTDIR/libs

Since you are also building KDE from trunk you may find the script I use to set environment variables helpful.
You will need to change KDEDIR and QTDIR appropriately.
Code: Select all
if [ -z "${KDE_ENV_SET}" ]; then
    # Change this to where you install KDE
    export KDEDIR="/opt/trunk-kde/kde"
    export KDEDIRS="${KDEDIR}"

    # Change this to where you install Qt
    export QTDIR="/opt/trunk-kde/qt"

    export PATH="${KDEDIR}/bin:${QTDIR}/bin:${PATH}"
    export LD_LIBRARY_PATH="${KDEDIR}/lib:${QTDIR}/lib"
    export CMAKE_PREFIX_PATH="${KDEDIR}:${QTDIR}"

    export KDEHOME="${HOME}/.kde4-trunk/"

    # Set the XDG data path, helps finding plugins, etc
    export XDG_DATA_DIRS="${KDEDIR}/share:${XDG_DATA_DIRS}"

    # Don't accidentally get sourced again.
    export KDE_ENV_SET=1
fi


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
LastGuyonEarth
Registered Member
Posts
16
Karma
0
bcooksley wrote:You need to set the following environment variables ( in your shell ) before running CMake.
QTDIR=Where you installed Qt
CMAKE_PREFIX_PATH=$QTDIR
PATH=$QTDIR/bin:$PATH
LD_LIBRARY_PATH=$QTDIR/libs

Since you are also building KDE from trunk you may find the script I use to set environment variables helpful.
You will need to change KDEDIR and QTDIR appropriately.
Code: Select all
if [ -z "${KDE_ENV_SET}" ]; then
    # Change this to where you install KDE
    export KDEDIR="/opt/trunk-kde/kde"
    export KDEDIRS="${KDEDIR}"

    # Change this to where you install Qt
    export QTDIR="/opt/trunk-kde/qt"

    export PATH="${KDEDIR}/bin:${QTDIR}/bin:${PATH}"
    export LD_LIBRARY_PATH="${KDEDIR}/lib:${QTDIR}/lib"
    export CMAKE_PREFIX_PATH="${KDEDIR}:${QTDIR}"

    export KDEHOME="${HOME}/.kde4-trunk/"

    # Set the XDG data path, helps finding plugins, etc
    export XDG_DATA_DIRS="${KDEDIR}/share:${XDG_DATA_DIRS}"

    # Don't accidentally get sourced again.
    export KDE_ENV_SET=1
fi



Thanks! KDEsupport is building currently, so I'll keep you posted if everything builds as expected. Cheers!


"As the Days change like weather, all of you must know:
Everything gets better. Everything regrows."

-Forest, from "Under an Iron Tree" by Sean Tilley
LastGuyonEarth
Registered Member
Posts
16
Karma
0
Okay, some new hurdles. kdelibs passed with cmake, and building it gets up to about 81%.

It gets around to
Linking CXX shared module ../lib/katepart.so


And then a series of error messages fly across the screen, ending with:

collect2: ld returned 1 exit status
make[2]: *** [lib/katepart.so] Error 1
make[1]: *** [kate/CMakeFiles/katepart.dir/all] Error 2
make: *** [all] Error 2
makeobj[0]: Leaving directory `/home/kde-devel/kdelibs_build'
kde-devel@Liberty:~/kdelibs_build$


What do I need to do to fix this?


"As the Days change like weather, all of you must know:
Everything gets better. Everything regrows."

-Forest, from "Under an Iron Tree" by Sean Tilley
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
It usually prints some information ( such as unknown symbols ) when this occurs. Can you please post those?
Also, try passing running the make command as follows in order to have CMake print out the full command it is executing.
Code: Select all
DEBUG=1 make


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
LastGuyonEarth
Registered Member
Posts
16
Karma
0
I've tried DEBUG=1, here's as full as an output I could get. Gnome-terminal wasn't able to show everything, but I figure that this is lengthy enough to get a good idea of what's going on.

http://pastebin.com/m75d12df7


"As the Days change like weather, all of you must know:
Everything gets better. Everything regrows."

-Forest, from "Under an Iron Tree" by Sean Tilley
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
You may need to alter the TARGET_LINK_LIBRARIES argument for KatePart in the appropriate CMakeLists.txt file to include the KTextEditor linking. This is likely caused by behaviour differences between Linux/Solaris/Mac/Windows/Etc and GNewSense.

You should be able to find some people who are quite skilled at using CMake on the kde-buildsystem@kde.org mailing list.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
LastGuyonEarth
Registered Member
Posts
16
Karma
0
Well, it's been about five days and I haven't heard back from them... should I just try 4.3 Beta2 instead?


"As the Days change like weather, all of you must know:
Everything gets better. Everything regrows."

-Forest, from "Under an Iron Tree" by Sean Tilley
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
There may be improvements in Beta 2 ( I saw some changes in some KDELibs CMakeLists.txt files today actually.... you may wish to try directly from trunk )


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], Evergrowing, Google [Bot], lockheed, mesutakcan, mickae, Sogou [Bot]