[maemo-developers] QtCreator, libraries, and multiple platforms

From: David Talmage talmage at acm.org
Date: Fri Aug 5 23:39:57 EEST 2011
Thanks to Danil, Ville, and Christian for taking the time to answer my call 
for help.

On Thursday, August 04, 2011 06:16:16 AM Daniil Ivanov wrote:

>  I agree that three project files are the way to go:
> ...
>  This is how you declare your library for your application
>  http://doc.qt.nokia.com/latest/qmake-project-files.html#declaring-other-li
> braries

I got about that far.  More below.

To answer Ville's question about the need for a separate library: I refactored 
my application into a library that other applications can use and an 
application that uses the library.  I have at least one more application in 
mind that will use this library.  For the curious, it's a home-grown dialog 
for choosing contacts.  I wrote it last year because the native Maemo contacts 
dialog didn't support pre-selecting some contacts. (The documentation said it 
did but I couldn't make it work at all.)

To answer Christian's question about linking: By "can't link" I mean that the 
linker can't find my library, so it complains about undefined symbols.


I have a directory structure like this:

N900/app
N900/app-uberproject
N900/lib

The contain, respectively, the app, the subdirs project, and the library.

I'm building for Maemo, Harmattan, Simulator, and Remote Compiler. In short, 
everything but Desktop.

When I build for Simulator, I get directories

N900/app-build-simulator
N900/app-uberproject-build-simulator
N900/lib-build-simulator

The next challenge is to teach app.pro how to find the library for the build 
platform, simulator in the example above.  It looks like some hackery-pokery 
with replace() will do the job.  I was hoping that QMake would Do The Right 
Thing for me.

After that, my challenge is to install liblib.so in the simulator so that app 
can load it.  That's just the usual packaging task, right?


Dave

> On Thu, Aug 4, 2011 at 12:48 PM, Ville M. Vainio <vivainio at gmail.com> wrote:
> > Do you have a particular reason for the requirement (like license) to
> > have a separate library, instead of just having one monolithic
> > application?
> > 
> > On Wed, Aug 3, 2011 at 10:03 PM, David Talmage <talmage at acm.org> wrote:
> >> I need help making QtCreator build an application and a library for
> >> Maemo, Symbian (using the remote compiler), and the simulator.  I've
> >> been all over the documentation, the forum on Qt Developer Network, and
> >> Google.  I can't find an example that does what I need.
> >> 
> >> I have a library (lib) and an application (app). Each one is a QtCreator
> >> project.  I can build them individually but I can't link app with
> >> liblib.so. Whatever I use has to work with maemo.org's autobuilder and
> >> Nokia's remote compiler for Symbian.
> >> 
> >> As a first pass, it would help if there is an environment variable I can
> >> reference in app.pro like $$OUT_PWD that contains the name of the build
> >> directory for lib.  Then linking might work.  I can hack something
> >> together with qmake's replace(), like replace($$OUT_PWD, app, lib) and
> >> that might work as long as app/ and lib/ were in the same directory.  I
> >> don't know how well it would port or whether it would continue to work
> >> when I install app and liblib.so on the phones.
> >> 
> >> Dave
> >> ...
> > ...
> ...
More information about the maemo-developers mailing list