We have moved to a new Sailfish OS Forum. Please start new discussions there.
2

BUG: SDK can't handle subdirs template on OSX

asked 2014-01-18 19:04:31 +0200

hardcodes.de gravatar image

updated 2014-01-19 14:05:00 +0200

Let's assume the following directory structure in a project:

├── Library
│   ├── Library.pro
│   ├── world.cpp
│   └── world.h
├── SFOSHelloWorldWithLibrary
│   ├── SFOSHelloWorldWithLibrary.pro
│   ├── harbour-SFOSHelloWorldWithLibrary.desktop
│   ├── harbour-SFOSHelloWorldWithLibrary.png
│   ├── qml
│   │   ├── cover
│   │   │   └── CoverPage.qml
│   │   ├── harbour-SFOSHelloWorldWithLibrary.qml
│   │   └── pages
│   │       └── FirstPage.qml
│   ├── rpm
│   │   └── harbour-SFOSHelloWorldWithLibrary.yaml
│   └── src
│       └── SFOSHelloWorldWithLibrary.cpp
└── SFOSHelloWorldWithLibrary.pro

And the main project file would be

TEMPLATE = subdirs
# build the project in the given order
CONFIG += ordered
SUBDIRS += Library \
           SFOSHelloWorldWithLibrary

SFOSHelloWorldWithLibrary.depends = LIBRARY

It is possible to compile the project but it can not be deployed. If you choose deploy from the build menu, you get the error message

Fatal: No spec file found in '/home/mersdk//Documents/QtProjects/SFOSHelloWorldWithLibrary_02/rpm/' and couldn't make one from a yaml #1

Well, that's true - there is no .spec file in /home/mersdk//Documents/QtProjects/SFOSHelloWorldWithLibrary_02/rpm/. It should look in /home/mersdk//Documents/QtProjects/SFOSHelloWorldWithLibrary_02/SFOSHelloWorldWithLibrary/rpm/= one directory level deeper. First I thought it was mixed up in the mb2script on the development VM. But now I believe it is hidden somewhere in the mersshbinary, which is used as a proxy to shield the calls from QtCreator (or to make QtCreator believe to have the needed tools at hand locally).

QtCreator calls ~/.config/SailfishAlpha3/mer-sdk-tools/MerSDK/SailfishOS-i486-x86/deploy script. That reads

#!/bin/bash
exec "/Users/sven/SailfishOS/bin/Qt Creator.app/Contents/MacOS/../Resources/merssh" -sdktoolsdir "/Users/sven/.config/SailfishAlpha3/mer-sdk-tools/MerSDK" -commandtype mb2 -mertarget SailfishOS-i486-x86 deploy $@

This turns into bash -c cd "$HOME//Documents/QtProjects/build-SFOSHelloWorldWithLibrary-MerSDK_SailfishOS_i486_x86-Debug" && mb2 -p "$HOME//Documents/QtProjects/SFOSHelloWorldWithLibrary_02" -t SailfishOS-i486-x86 qmake $HOME//Documents/QtProjects/SFOSHelloWorldWithLibrary_02/SFOSHelloWorldWithLibrary.pro -r -spec linux-g++ CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug on the MerSDK VM (followed by some similar calls for make etc.)

The -p "$HOME//Documents/QtProjects/SFOSHelloWorldWithLibrary_02"is the problem (and the hint for the solution) here. If you pass the '-p SOMEDIR` as extra parameter in QtCreator, it does not override the path seen here. And it can not be saved in QtCreator.

You could say: move your things one level up and of course I could. But what if a developer wants to reuse libraries and resources from code he/she has written on other platforms? Even using Qt this could be BB10, Android, iOS and such.

Am I doing it wrong? Or is it really a bug?

Maybe this is an OSX only problem? Can anyone confirm this for other platforms?

edit retag flag offensive close delete

1 Answer

Sort by » oldest newest most voted
1

answered 2014-01-19 17:50:49 +0200

kaltsi gravatar image

The SDK expects the project directories to be arranged so that the 'rpm' directory is on the main project directory level. No other kind of directory layout has been tested or is expected to work. This is a requirement of the SDK as it stands now.

I've verified on linux just now that it behaves the same way as in OSX.

In Sailfish OS SDK the rpm spec file is an essential part in managing your project's buildtime and runtime requirements.

As you have noticed, the mb2 script can also build Qt projects when it doesn't find a spec file. In this case it expects to find all the project's build dependencies already installed to the build target and that seems to be the case for you. But once you choose 'deploy', the SDK needs to run the install rule and maybe additionally build an rpm package out of it using the rules in the spec file, which is why it fails in your case.

edit flag offensive delete publish link more

Comments

First of all: thanks for doing this on sundays! I understand why the deploy does not work and will have to accept the SDK requirements as they are. But anyhow: I managed to use subdirs by moving the top level .pro file into the SFOS directory. Not perfect, but close :-)

hardcodes.de ( 2014-01-20 11:23:06 +0200 )edit
Login/Signup to Answer

Question tools

Follow
1 follower

Stats

Asked: 2014-01-18 19:04:31 +0200

Seen: 298 times

Last updated: Jan 19 '14