Re: QtCreator, libraries, and multiple platforms
On Wednesday, August 03, 2011 03:03:11 PM David Talmage 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. > ... Thanks to the help I've received from Cristian Kandeler, Ville M Vainio, Daniil Ivanov, and Roman Morawek, I have a library project and an application project. The application project depends on the library project. I can deploy both of them to my N900 phone. I did not use a subdirs project as suggested. I created a library project and an app project. I manually copied the library and its header files to my Maemo sysroot. In order to make the loader look for the library in /opt/usr/lib, I added some linker flags to the qmake variable QMAKE_LFLAGS in the maemo5 section of the app project file: QMAKE_LFLAGS += '-Wl,-rpath,/opt/usr/lib' I think that's everything I did. Then I went and broke things. That's a story for another thread. Thank you all for helping me. Dave ___ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: QtCreator, libraries, and multiple platforms
On Sat, Aug 6, 2011 at 1:02 AM, David Talmage wrote: > I agree that static linking would make this simple. However, I'm targeting > devices with limited memory (e.g. N900, N8, N9). Dynamic linking is better in > this context. Applications probably want to (need to!) ship their own copy of the library anyway, which eliminates memory savings. Your library would need to be huge, or very popular, for this to matter. I'd encourage you to just link statically and call it a day. ___ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: QtCreator, libraries, and multiple platforms
If one wants to publish something on Ovi Store, then you have to place everything in single package. This could be rationale of having everything in single package. --Daniil On Mon, Aug 8, 2011 at 10:55 AM, Christian Kandeler wrote: > On Fri, 2011-08-05 at 16:39 -0400, ext David Talmage wrote: >> 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 > > But this is not a SUBDIRS project, is it? If it were, your directory > structure would look like this: > ... > Then you could just add "LIBS += -L$$OUT_PWD/../lib -llib" to your > application's pro file and the correct library would be found for every > platform. > >> 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. > > Also, if, like you said, there is not a 1:1 mapping between the library > and the application, I'd put them into separate projects. Then when you > change your library, you just deploy it to your sysroot (for > Maemo/Harmattan, don't know about the other platforms) and the linker > will find it there when linking the application. > > > Christian > > ___ > maemo-developers mailing list > maemo-developers@maemo.org > https://lists.maemo.org/mailman/listinfo/maemo-developers > ___ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: QtCreator, libraries, and multiple platforms
On Fri, 2011-08-05 at 16:39 -0400, ext David Talmage wrote: > 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 But this is not a SUBDIRS project, is it? If it were, your directory structure would look like this: 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. Also, if, like you said, there is not a 1:1 mapping between the library and the application, I'd put them into separate projects. Then when you change your library, you just deploy it to your sysroot (for Maemo/Harmattan, don't know about the other platforms) and the linker will find it there when linking the application. Christian ___ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: QtCreator, libraries, and multiple platforms
Hi Roman! The most likely it won't work in Harmattan since it's MeegoTouch based and partially QtQuick based. At least UI part have to be re-done. ~Daniil On Sun, Aug 7, 2011 at 10:48 AM, Roman Morawek wrote: > Hello David, > > On 06.08.2011 11:00, David Talmage wrote: >> I am writing another application that will link with the library. At least >> one other developer was interested in using my library last year. I failed >> to >> release the code. I don't know if he's still interested. > > Yes, I am still interested. Not interested for Fremantle anymore (I use > the native dialogs there) but for Harmattan. If you intend to deploy the > lib for Harmattan, please tell me. > > On the other hand, as this fits the thread: > I also think it would be easier for me if you'd release the source code > in an open source license and I just include it directly in my package. > I know that this approach also has disadvantages (ROM usage, redundancy, > bug fixes,...) but as I expect the functionality to be rather simple I > personally see more advantages. > > Regards, > Roman > ___ > maemo-developers mailing list > maemo-developers@maemo.org > https://lists.maemo.org/mailman/listinfo/maemo-developers > ___ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: QtCreator, libraries, and multiple platforms
Hello David, On 06.08.2011 11:00, David Talmage wrote: > I am writing another application that will link with the library. At least > one other developer was interested in using my library last year. I failed > to > release the code. I don't know if he's still interested. Yes, I am still interested. Not interested for Fremantle anymore (I use the native dialogs there) but for Harmattan. If you intend to deploy the lib for Harmattan, please tell me. On the other hand, as this fits the thread: I also think it would be easier for me if you'd release the source code in an open source license and I just include it directly in my package. I know that this approach also has disadvantages (ROM usage, redundancy, bug fixes,...) but as I expect the functionality to be rather simple I personally see more advantages. Regards, Roman ___ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: QtCreator, libraries, and multiple platforms
Hi David! There is no difference in building static and dynamically linked library as part of qmake project as such. It's hard to say what is the problem without seeing project files. My guess there is wrong path in one of variables added to INSTALLS qmake variable ~Daniil On Sat, Aug 6, 2011 at 1:04 AM, David Talmage wrote: > Thanks, Daniil! This is nearly working. > > I structured my directories as you advised. Everything builds and the app > links with lib. There is an executable, oh-my/app/app. > > Then some task called "copydeploymentfolders" is invoked and it fails. The > output is: > > Copying application data... > > cp: cannot overwrite non-directory > `/home/talmage/N900/oh-my-build-simulator/app/app' with directory > `/home/talmage/N900/oh-my/app/' > > make[1]: *** [copydeploymentfolders] Error 1 > > I can't imagine qmake thinks it's doing. > ___ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: QtCreator, libraries, and multiple platforms
Thanks, Daniil! This is nearly working. I structured my directories as you advised. Everything builds and the app links with lib. There is an executable, oh-my/app/app. Then some task called "copydeploymentfolders" is invoked and it fails. The output is: Copying application data... cp: cannot overwrite non-directory `/home/talmage/N900/oh-my-build- simulator/app/app' with directory `/home/talmage/N900/oh-my/app/' make[1]: *** [copydeploymentfolders] Error 1 I can't imagine qmake thinks it's doing. ___ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: QtCreator, libraries, and multiple platforms
On Friday, August 05, 2011 05:38:40 PM Ville M. Vainio wrote: > So I guessed correctly; your rationale for using a library is wrong > ;-). You are introducing a bunch of deployment headaches for the sake You're right, Ville, I am introducing deployment headaches. Those headaches shouldn't be there in this day and age. I have no idea if or how this will build on maemo.org's autobuilder or Nokia's remote compiler for Symbian. > of having a "reusable unit", which is not in fact reused by other > applications. In general, libraries should only be introduced when I am writing another application that will link with the library. At least one other developer was interested in using my library last year. I failed to release the code. I don't know if he's still interested. > ... > You should just link all the code statically with your main > application to keep things simple. I agree that static linking would make this simple. However, I'm targeting devices with limited memory (e.g. N900, N8, N9). Dynamic linking is better in this context. David ___ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: QtCreator, libraries, and multiple platforms
So I guessed correctly; your rationale for using a library is wrong ;-). You are introducing a bunch of deployment headaches for the sake of having a "reusable unit", which is not in fact reused by other applications. In general, libraries should only be introduced when your module is part of the operating system, there are licensing issues, or you are releasing something linked against by other applications as well. You should just link all the code statically with your main application to keep things simple. On Fri, Aug 5, 2011 at 11:39 PM, David Talmage wrote: > 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 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 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 >> >> ... >> > ... >> ... > ___ > maemo-developers mailing list > maemo-developers@maemo.org > https://lists.maemo.org/mailman/listinfo/maemo-developers > ___ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: QtCreator, libraries, and multiple platforms
Hi David! This is how you directory structure should look, you have only one project with name oh-my and it contains one application and one library $ tree oh-my oh-my ├── app │ ├── app.cpp │ ├── app.h │ └── app.pro ├── lib │ ├── lib.cpp │ ├── lib.h │ └── lib.pro └── oh-my.pro 2 directories, 7 files And you don't need replace() for anything. ~Daniil On Fri, Aug 5, 2011 at 11:39 PM, David Talmage wrote: > 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 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 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 >> >> ... >> > ... >> ... > ___ > maemo-developers mailing list > maemo-developers@maemo.org > https://lists.maemo.org/mailman/listinfo/maemo-developers > ___ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: QtCreator, libraries, and multiple platforms
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 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 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 > >> ... > > ... > ... ___ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: QtCreator, libraries, and multiple platforms
Hi all! I agree that three project files are the way to go: Main project file: TEMPLATE = subdirs SUBDIRS = library application CONFIG += ordered Then use TEMPLATE= lib and TEMPLATE=app in library and application subdirectories project files. This is how you declare your library for your application http://doc.qt.nokia.com/latest/qmake-project-files.html#declaring-other-libraries Thanks, Daniil On Thu, Aug 4, 2011 at 12:48 PM, Ville M. Vainio 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 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 >> ___ >> maemo-developers mailing list >> maemo-developers@maemo.org >> https://lists.maemo.org/mailman/listinfo/maemo-developers >> > ___ > maemo-developers mailing list > maemo-developers@maemo.org > https://lists.maemo.org/mailman/listinfo/maemo-developers > ___ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: QtCreator, libraries, and multiple platforms
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 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 > ___ > maemo-developers mailing list > maemo-developers@maemo.org > https://lists.maemo.org/mailman/listinfo/maemo-developers > ___ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: QtCreator, libraries, and multiple platforms
On Wed, 2011-08-03 at 15:03 -0400, ext David Talmage 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. What does that mean, you "can't link"? Also, you'll have to decide whether those two binaries belong together or not. If they do, then you should probably make them one project using the SUBDIRS template (note: I don't know if this actually works on Symbian). Then you can link to the library using $$OUTPWD (and you should probably link it in statically, so only the application needs to be deployed). If application and library do not belong together (i.e. the library serves other purposes as well), then you just have to install the library first, after which it will be in a place where the linker can find it when building the application. Christian ___ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers
QtCreator, libraries, and multiple platforms
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 ___ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers