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

Trouble with examples build

Tags: None
(comma "," separated)
Mechatronic
Registered Member
Posts
24
Karma
0

Trouble with examples build

Thu Apr 03, 2014 8:39 am
Hello. I tryed to build examples/cpp/hello-marble with Qt5. And I have some troubles. Please, help me. I am a newbie in Qt and Linux. And I am a newbie in English too, sorry if it is awkward.

cmake :

CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 2.8)

should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.

-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/marble/sources/examples/cpp/hello-marble


make:

[100%] Building CXX object CMakeFiles/hello-marble.dir/main.o
/home/user/marble/sources/examples/cpp/hello-marble/main.cpp:11:24: fatal error: QApplication: No such file or directory
#include <QApplication>
^
compilation terminated.
make[2]: *** [CMakeFiles/hello-marble.dir/main.o] Error 1
make[1]: *** [CMakeFiles/hello-marble.dir/all] Error 2
make: *** [all] Error 2
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Trouble with examples build

Fri Apr 04, 2014 5:23 am
To compile Marble, you need the appropriate Qt development headers on your system - can you please check to see if all necessary Qt5 packages are installed?


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
Mechatronic
Registered Member
Posts
24
Karma
0

Re: Trouble with examples build

Fri Apr 04, 2014 6:07 am
bcooksley, I used offline installator from official site. Should I Do something to view list of installed components?
My first attempt to build Marble (But not examples) and install it was successfull.
But I loked dependencyes by
readelf -d /usr/lib/libmarblewidget.so

and got this:
Dynamic section at offset 0x670410 contains 38 entries:
Tag Type Name/Value
0x0000000000000001 (NEEDED) Shared library: [libastro.so.1]
0x0000000000000001 (NEEDED) Shared library: [libQtCore.so.4]
0x0000000000000001 (NEEDED) Shared library: [libQtDBus.so.4]
0x0000000000000001 (NEEDED) Shared library: [libQtGui.so.4]
0x0000000000000001 (NEEDED) Shared library: [libQtXml.so.4]
0x0000000000000001 (NEEDED) Shared library: [libQtSvg.so.4]
0x0000000000000001 (NEEDED) Shared library: [libQtNetwork.so.4]
0x0000000000000001 (NEEDED) Shared library: [libQtScript.so.4]
0x0000000000000001 (NEEDED) Shared library: [libQtWebKit.so.4]
0x0000000000000001 (NEEDED) Shared library: [libQtDeclarative.so.4]
0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6]
0x0000000000000001 (NEEDED) Shared library: [libm.so.6]
0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x000000000000000e (SONAME) Library soname: [libmarblewidget.so.18]

libQtCore.so instead of libQt5Core.so. After that I found on my computer installed libqt4* libraries. And I tryed to remove all qt libraries.
After that I reinstalled Qt5 online installer (checked all components in Qt5.2.1 to Install), removed marble, and run cmake
cmake -DCMAKE_BUILD_TYPE=Debug -DQTONLY=TRUE -DCMAKE_INSTALL_PREFIX=/usr ~/marble/sources

and got this
-- Found unsuitable Qt version "5.0.2" from /usr/bin/qmake
-- Could NOT find Phonon (missing: PHONON_INCLUDE_DIR PHONON_LIBRARY)
-- Could NOT find Phonon (missing: PHONON_INCLUDE_DIR PHONON_LIBRARY)
-- Could NOT find QextSerialPort (missing: QEXTSERIALPORT_INCLUDE_DIR QEXTSERIALPORT_LIBRARIES)
-- Could NOT find quazip (missing: QUAZIP_INCLUDE_DIR QUAZIP_LIBRARIES)
-- Could NOT find libshp (missing: LIBSHP_INCLUDE_DIR LIBSHP_LIBRARIES)
-- Could NOT find libgps (missing: LIBGPS_INCLUDE_DIR LIBGPS_LIBRARIES)
-- checking for module 'liblocation>=0.102'
-- package 'liblocation>=0.102' not found
-- Could NOT find libwlocate (missing: LIBWLOCATE_INCLUDE_DIR LIBWLOCATE_LIBRARIES)
--
-- The following features have been enabled:

* Unit tests , Build unit tests. Toggle with BUILD_MARBLE_TESTS=YES/NO. 'make test' will run all.
* Qt Designer plugins , Marble widget support in Qt Designer. Toggle with WITH_DESIGNER_PLUGIN=YES/NO
* Marble Desktop/Mobile applications , Build Marble Desktop/Mobile applications. Toggle with BUILD_MARBLE_APPS=YES/NO.

-- The following REQUIRED packages have been found:

* Qt5Core
* Qt5Xml
* Qt5Network
* Qt5Test
* Qt5Script
* Qt5Gui
* Qt5Widgets
* Qt5Qml
* Qt5Quick
* Qt5OpenGL
* Qt5WebKit
* Qt5Location
* Qt5Sensors
* Qt5WebKitWidgets
* Qt5Svg
* Qt5Sql
* Qt5Concurrent
* Qt5PrintSupport
* Qt5Designer

-- The following features have been disabled:

* Marble tools , Build various Marble tools for e.g. file format conversion. Toggle with BUILD_MARBLE_TOOLS=YES/NO.
* Marble library C++ examples , Build C++ examples showing how to use the Marble library. Toggle with BUILD_MARBLE_EXAMPLES=YES/NO.

-- The following OPTIONAL packages have not been found:

* Qt4
* Phonon , cross-platform multimedia framework that enables the use of audio and video content , <http://qt.digia.com/>
Support for playback of soundcue elements
Voice navigation (sound or human speakers)
* QextSerialPort , access to serial ports , <http://code.google.com/p/qextserialport/>
Reading from serial port in APRS plugin
* quazip , reading and writing of ZIP archives , <http://quazip.sourceforge.net/>
reading and displaying .kmz files
* libshp , reading and writing of ESRI Shapefiles (.shp) , <http://shapelib.maptools.org/>
reading and displaying .shp files
* libgps , communicating with the GPS daemon , <http://catb.org/gpsd/>
position information via gpsd
* liblocation , position information on Maemo 5 devices , <http://maemo.org/>
position information via GPS/WLAN for the Nokia N900 smartphone
* libwlocate , WLAN-based geolocation , <http://www.openwlanmap.org/>
Position information based on neighboring WLAN networks

-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/marble/build

Qt version "5.0.2" - because I tried Qt5 from ubuntu repository. I do not know, where cmake take this options.
Tell me, please, what should I do to get working inviroment.
Thanks a lot for your attention an sorry for a long post.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Trouble with examples build

Fri Apr 04, 2014 6:13 am
-- Found unsuitable Qt version "5.0.2" from /usr/bin/qmake

It appears something is wrong with the installation of Qt 5 on your system - instead of using the official installer, could you try using your distribution packages instead?


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
Mechatronic
Registered Member
Posts
24
Karma
0

Re: Trouble with examples build

Fri Apr 04, 2014 6:18 am
Should I found .deb package for Qt5? Or what do you mean on "distribution packages"?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Trouble with examples build

Fri Apr 04, 2014 6:27 am
Which distribution are you running, as most should now have Qt 5 packages available?


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
Mechatronic
Registered Member
Posts
24
Karma
0

Re: Trouble with examples build

Fri Apr 04, 2014 6:39 am
I use Ubuntu 13.10. There was Qt4. I tried to install Ubuntu SDK from repository, but it contains Qt5.0.2

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 13.10
Release: 13.10
Codename: saucy
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Trouble with examples build

Fri Apr 04, 2014 6:48 am
You may need to add a PPA in that case - which should contain Qt 5.1, which should be better suited.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
Mechatronic
Registered Member
Posts
24
Karma
0

Re: Trouble with examples build

Thu Apr 10, 2014 12:28 pm
I can not get a working result. Sorry to bother you.
I tryed different Linux distribution, Qt distribution, built it from git...
Tell me, please, what can I do (may be, manually) to let build system see Qt5?
adabrowski
Registered Member
Posts
14
Karma
0

Re: Trouble with examples build

Thu Apr 10, 2014 12:48 pm
Hey,

I guess the point lies in providing a correct path to cmake in a flag, i.e. -DCMAKE_PREFIX_PATH=/opt/Qt/5.2.1/gcc_64/lib/cmake/ (see below).

I've built Marble with Qt 5.2.1 on both Ubuntu 12.04 LTS and ArchBang recently. It's all working fine. You can try building it as I did:

On Ubuntu 12.04 LTS:

Download online installer for your architecture (64bit or 32bit) for qt 5.2.1 from .run http://qt-project.org/downloads and run it.
Afterwards you should have Qt installed in /opt/Qt/
Get Marble:
Code: Select all
git clone git://anongit.kde.org/marble

I used git version with hash: 14ec43d447245086bbff83411e165fd973d49f39 but I don't think it matters that much.

Code: Select all
mkdir marble-build
cd marble-build
cmake -DCMAKE_BUILD_TYPE=Debug -DQTONLY=1 -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_PREFIX_PATH=/opt/Qt/5.2.1/gcc_64/lib/cmake/ -DCMAKE_CXX_FLAGS='-fPIC' -DQT5BUILD=1 ../marble/
make
sudo make install

Above is for x64, correct path to your cmake depending on your version.

This will put marble library in /usr/local/lib
now link your project with it and it should run.

Good luck!
Adam
Mechatronic
Registered Member
Posts
24
Karma
0

Re: Trouble with examples build

Thu Apr 10, 2014 1:35 pm
Thank you very much, Adam!
It was built. I will try to use it and will report about result
Mechatronic
Registered Member
Posts
24
Karma
0

Re: Trouble with examples build

Thu Apr 10, 2014 1:48 pm
I have an error when trying to use library -lmarblewidget
/usr/local/lib/libmarblewidget.so:-1: error: undefined reference to `QAbstractConcatenable::appendLatin1To(char const*, int, QChar*)'
adabrowski
Registered Member
Posts
14
Karma
0

Re: Trouble with examples build

Thu Apr 10, 2014 2:06 pm
This is a linker output in your project, right?
Are you using Qt 5.2.1 or Qt 5.3.0? If it's Qt 5.3.0 and Marble was built with Qt 5.2.1 there might be a problem like this (guessing)

I can only guess one of following might help:

1) Make sure you are using the right library (a version you just built)
When I run
Code: Select all
ldd bin/myMarbleApp | grep marble

I get libmarblewidget.so.18 ⇒ /usr/local/lib/libmarblewidget.so.18
Check if this is the version that you are linking against (I had success building marble 1.8 alpha which produces this version of library)
2) Try using the same version of Qt in your project that the marble library was built against.
You need to provide all necessary information about your environment, otherwise it's just guessing.
Good that you are at least one step ahead now :]
Mechatronic
Registered Member
Posts
24
Karma
0

Re: Trouble with examples build

Thu Apr 10, 2014 2:17 pm
Yes, it is linker output.
If I did all right, I used Qt 5.2.1 in both cases. I will check it
Mechatronic
Registered Member
Posts
24
Karma
0

Re: Trouble with examples build

Thu Apr 10, 2014 2:37 pm
I created project with Qt5.3.0 and it built.
But I used
-DCMAKE_PREFIX_PATH=/opt/Qt/5.2.1/gcc_64/lib/cmake/
as you sayed. May it be because Qt5.3.0 in PATH variable?
I tryed to run application and got
Starting /home/user/build-untitledM1-Desktop-Debug/untitledM1...
QIODevice::write: device not open
QIODevice::write: device not open
QIODevice::write: device not open
QIODevice::write: device not open
QIODevice::write: device not open
QIODevice::write: device not open
QIODevice::write: device not open
QIODevice::write: device not open
QIODevice::write: device not open
QIODevice::write: device not open
QIODevice::write: device not open
QIODevice::write: device not open
QIODevice::write: device not open
QIODevice::write: device not open
QIODevice::write: device not open
QIODevice::write: device not open
QIODevice::write: device not open
The program has unexpectedly finished.


main.cpp
Code: Select all
#include "mainwindow.h"
#include <QApplication>
#include <marble/MarbleWidget.h>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    Marble::MarbleWidget m;
    m.setProjection(Marble::Mercator);
    m.setMapThemeId("earth/openstreetmap/openstreetmap.dgml");

    m.setWindowTitle("Hello Marble!");
    m.show();
    w.show();

    return a.exec();
}


Code: Select all
#-------------------------------------------------
#
# Project created by QtCreator 2014-04-10T18:18:47
#
#-------------------------------------------------

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = untitledM1
TEMPLATE = app


SOURCES += main.cpp\
        mainwindow.cpp

HEADERS  += mainwindow.h

unix:!macx: LIBS += -L/usr/local/lib -lmarblewidget


Bookmarks



Who is online

Registered users: Bing [Bot], daret, Google [Bot], Sogou [Bot]