PDA

View Full Version : Change install path of qtdesktopcomponents



StMartin81
5th March 2013, 09:56
Hello,

I've tried to compile the Desktop Components for Qt 5 and when I run make I get the following error message:

make[2]: Entering directory `/home/martin/abs/qtdesktopcomponents/src/qtdesktopcomponents-build/src/qtdesktop'
mkdir: cannot create directory ‘/usr/lib/qt/qml/QtDesktop/’: Permission denied
make[2]: *** [/usr/lib/qt/qml/QtDesktop/libstyleplugin.so] Error 1
make[2]: Leaving directory `/home/martin/abs/qtdesktopcomponents/src/qtdesktopcomponents-build/src/qtdesktop'


Can anybody tell what I have to change so that Qt doesn't try to install a file in my /usr directory when I run the make command?

The problem seems to originate from the Makefile created by the attached .pro file.

qmake is the one from Qt5 and the system is a Linux system.


Best regards
Martin

wysota
5th March 2013, 10:17
Where would you like it to install the plugin?

StMartin81
5th March 2013, 12:21
I want to build a package for my distribution (Archlinux). The INSTALL_ROOT should be ${pkgdir}. The problem I have is that the make command tries to install the file libstyleplugin.so in /usr/lib/qt/qml/QtDesktop. I don't understand why the make command tries to install the file into a privileged directory. From all the other make files I've used this is the first time this happened. In my expectation only make install should need root privileges.

wysota
5th March 2013, 12:52
I want to build a package for my distribution (Archlinux). The INSTALL_ROOT should be ${pkgdir}. The problem I have is that the make command tries to install the file libstyleplugin.so in /usr/lib/qt/qml/QtDesktop. I don't understand why the make command tries to install the file into a privileged directory. From all the other make files I've used this is the first time this happened. In my expectation only make install should need root privileges.

So change the .pro file to point to somewhere else.

StMartin81
5th March 2013, 14:19
Can you tell me what the .pro file should look like then?

The generated Makefile wants to install libstyleplugin.so into /usr/lib/qt/qml/QtDesktop.
My guess is that CXX_MODULE = qml is responsible for the /usr/lib/qt/qml and TARGETPATH = QtDesktop is responsible for QtDesktop of the path name.

So what I would like to have is:
1. Compile libstyleplugin.so to some place in the build directory
2. Install the file to ${pkgdir}/usr/lib/qt/qml/QtDesktop via make INSTALL_ROOT="${pkgdir}" install
3. Distribution package installer installs the file to /usr/lib/qt/qml/QtDesktop

wysota
5th March 2013, 14:51
Can you tell me what the .pro file should look like then?

The generated Makefile wants to install libstyleplugin.so into /usr/lib/qt/qml/QtDesktop.
My guess is that CXX_MODULE = qml is responsible for the /usr/lib/qt/qml and TARGETPATH = QtDesktop is responsible for QtDesktop of the path name.

So what I would like to have is:
1. Compile libstyleplugin.so to some place in the build directory
2. Install the file to ${pkgdir}/usr/lib/qt/qml/QtDesktop via make INSTALL_ROOT="${pkgdir}" install
3. Distribution package installer installs the file to /usr/lib/qt/qml/QtDesktop

Forget the makefile. It is generated from the .pro file so that is what is relevant. This file should contain an entry such as the following:
unix {
installPath = $$[QT_INSTALL_IMPORTS]/$$replace(uri, \\., /)
qmldir.path = $$installPath
target.path = $$installPath
INSTALLS += target qmldir
}

That's what you need to adjust. You can either enter a full path there of fetch the path from environment variable (see qmake docs to learn how to do that).

StMartin81
18th March 2013, 17:37
Is there a way to set the DESTDIR variable on the command line?

I've tried
$ export DESTDIR=../pkg && qmake
$ env DESTDIR=../pk && qmake
$ qmake -set DESTDIR ../pkg

but none of these three commands did change the destination directory. I really would like to avoid editing the .pro files.

Is it correct that the files are installed to ${DESTDIR}/${TARGETPATH}. I think I read it somewhere but I can't seem to find that information again.

wysota
18th March 2013, 18:45
qmake DESTDIR=../pkg

StMartin81
19th March 2013, 09:43
Unfortunately this also didn't work. I'm trying to compile qtdesktopcomponents (https://git.gitorious.org/qtplayground/qtdesktopcomponents.git). When I run:

qmake DESTDIR=../pkg && make
it still wants to install a file in /usr directory.

I think this is the file which generates the library which should get installed into /usr: qtdesktop.pro (http://qt.gitorious.org/qtplayground/qtdesktopcomponents/blobs/master/src/qtdesktop/qtdesktop.pro)

I've tried to replace

TARGETPATH = QtDesktop
with

TARGETPATH = $$(PWD)/$$(DESTDIR)/QtDesktop

Then I run:
qmake DESTDIR=../../pkg && make
but it still wants to install the file into /usr:

cd qtdesktop/ && ( test -f Makefile || /usr/bin/qmake /home/gumstix/abs/qtdesktopcomponents/src/qtdesktopcomponents-build/src/qtdesktop/qtdesktop.pro DESTDIR=../../pkg -o Makefile ) && make -f Makefile
WARNING: DESTDIR: Cannot access directory '/usr/lib/qt/qml/home/gumstix/abs/qtdesktopcomponents/src/qtdesktopcomponents-build/pkg/QtDesktop'
make[2]: Entering directory `/home/gumstix/abs/qtdesktopcomponents/src/qtdesktopcomponents-build/src/qtdesktop'
mkdir: das Verzeichnis „/usr/lib/qt/qml/home“ kann nicht angelegt werden: Keine Berechtigung
make[2]: *** [/usr/lib/qt/qml/home/gumstix/abs/qtdesktopcomponents/src/qtdesktopcomponents-build/pkg/QtDesktop/libstyleplugin.so] Fehler 1

I then added

INSTALLPATH = $$(PWD)/$$(DESTDIR)
but this also doesn't change anything.

Adding this:

unix {
installPath = $$(PWD)/$$(DESTDIR)
qmldir.path = $$installPath
target.path = $$installPath
INSTALLS += target qmldir
}
to the .pro file results in:

make[2]: Entering directory `/home/gumstix/abs/qtdesktopcomponents/src/qtdesktopcomponents-build/src/qtdesktop'
/usr/bin/qmake DESTDIR=../../pkg -o Makefile qtdesktop.pro
WARNING: DESTDIR: Cannot access directory '/usr/lib/qt/qml/home/gumstix/abs/qtdesktopcomponents/src/qtdesktopcomponents-build/src/qtdesktop/usr/lib/qt/qml/home/gumstix/abs/qtdesktopcomponents/src/qtdesktopcomponents-build/src/qtdesktop/usr/lib/qt/qml/home/gumstix/abs/qtdesktopcomponents/src/qtdesktopcomponents-build/src/qtdesktop/usr/lib/qt/qml/home/gumstix/abs/qtdesktopcomponents/src/qtdesktopcomponents-build/pkg/QtDesktop/QtDesktop/QtDesktop/QtDesktop'
make[2]: Leaving directory `/home/gumstix/abs/qtdesktopcomponents/src/qtdesktopcomponents-build/src/qtdesktop'
make[2]: Entering directory `/home/gumstix/abs/qtdesktopcomponents/src/qtdesktopcomponents-build/src/qtdesktop'
Makefile:8044: warning: overriding recipe for target `install_target'
Makefile:7937: warning: ignoring old recipe for target `install_target'
Makefile:8049: warning: overriding recipe for target `uninstall_target'
Makefile:7942: warning: ignoring old recipe for target `uninstall_target'
Makefile:8055: warning: overriding recipe for target `install_qmldir'
Makefile:7947: warning: ignoring old recipe for target `install_qmldir'
Makefile:8102: warning: overriding recipe for target `uninstall_qmldir'
Makefile:7995: warning: ignoring old recipe for target `uninstall_qmldir'
mkdir: das Verzeichnis „/usr/lib/qt/qml/home“ kann nicht angelegt werden: Keine Berechtigung

When I add these lines:

TARGET.path = $$(PWD)/$$(DESTDIR)/QtDesktop
INSTALLS += TARGET

I get the following error message:

cd qtdesktop/ && ( test -f Makefile || /usr/bin/qmake /home/gumstix/abs/qtdesktopcomponents/src/qtdesktopcomponents-build/src/qtdesktop/qtdesktop.pro DESTDIR=/home/gumstix/abs/qtdesktopcomponents/src/qtdesktopcomponents-build../../pkg -o Makefile ) && make -f Makefile
make[2]: Entering directory `/home/gumstix/abs/qtdesktopcomponents/src/qtdesktopcomponents-build/src/qtdesktop'
mkdir: das Verzeichnis „/usr/lib/qt/qml/QtQml/“ kann nicht angelegt werden: Keine Berechtigung
make[2]: *** [/usr/lib/qt/qml/QtQml/libstyleplugin.so] Fehler 1


So I'm out of luck with my guessing.