How to do a release build with wxWidgets?

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
Otto
In need of some credit
In need of some credit
Posts: 4
Joined: Sun Jul 03, 2011 3:35 pm

How to do a release build with wxWidgets?

Post by Otto » Sun Jul 03, 2011 3:56 pm

Hi, I'm a beginner in C++ and wxWidgets.

I made a small application and I need a release build to share the application with other people.
If I choose the release target in Code::Blocks IDE, the only output file produced is the executable for the app, but nothing wxWidgets related. I would like to share wxWidgets too, as a library (either dynamic or static), so people won't have to download and install it themselves. Just like those applications in wxWidgets screenshots page.

OS: Debian Linux 6
wxWidgets: 2.8.10
Code::Blocks: 10.05

DavidHart
Site Admin
Site Admin
Posts: 3998
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: How to do a release build with wxWidgets?

Post by DavidHart » Sun Jul 03, 2011 4:27 pm

Hi,

That's a faq. The answer is in various old threads e.g. http://forums.wxwidgets.org/viewtopic.php?f=19&t=21095

Basically, trying to distribute all your app's dependencies is windows-think. The Linux way is to use each target distro's packaging mechanism to install your app. That packaging mechanism will almost always automatically take care of its dependencies e.g. wxWidgets.

Otherwise you are setting yourself the task of producing a binary, both of your app and of wxWidgets, that will work for each version of each distro...

Regards,

David

Otto
In need of some credit
In need of some credit
Posts: 4
Joined: Sun Jul 03, 2011 3:35 pm

Re: How to do a release build with wxWidgets?

Post by Otto » Sun Jul 03, 2011 5:25 pm

Hi, thanks for your answer.

If I understand correctly, you said I should distribute only that executable file and let the packing mechanism take care of wxWidgets. But then, wouldn't I have to build a package for each mechanism (deb, rpm and others)? The executable alone will only complain the library is missing.


About this part:
DavidHart wrote:Otherwise you are setting yourself the task of producing a binary, both of your app and of wxWidgets, that will work for each version of each distro...
You're saying I would need a specific build for every distro?
How does eg Firefox release binaries? Not talking about packages distros have in their repositories, but the binaries in Firefox page: http://www.mozilla.com/firefox/all.html


I downloaded the Ginkgo Cad application listed in wxWidgets page just to check how the release was done. It has lots of dependencies included. This sounds awkward because it makes the download big and the user might already have the dependencies installed. Also, if a different application requires common dependencies, he will have to download again. But it makes it a lot easier to use IMO.

DavidHart
Site Admin
Site Admin
Posts: 3998
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: How to do a release build with wxWidgets?

Post by DavidHart » Sun Jul 03, 2011 6:28 pm

But then, wouldn't I have to build a package for each mechanism (deb, rpm and others)?
Yes indeed. But then ideally you should anyway.
You're saying I would need a specific build for every distro?
Yes, and for every release of that distro. e.g. you're using debian squeeze. It's possible, but not guaranteed, that a squeeze binary will work on lenny; and I'd bet money that it won't on etch. Similarly, a squeeze binary might work on ubuntu natty (though probably not on maverick/lucid/karmic etc), but it almost certainly won't work on fedora or openSUSE or... Different distros use different libraries, and/or store them in different locations. And different library versions eventually prevent a binary from working on different releases. Oh, and don't forget i386 versus x86_64.

I'm not saying it's impossible for a single binary to work on different distros/releases. But usually they won't; and the more complicated the app, the less compatible it's likely to be.
How does eg Firefox release binaries?
I don't know in detail, but firefox uses xul internally, which is designed to be cross-platform etc.

Otto
In need of some credit
In need of some credit
Posts: 4
Joined: Sun Jul 03, 2011 3:35 pm

Re: How to do a release build with wxWidgets?

Post by Otto » Sun Jul 03, 2011 8:39 pm

It's hard to accept that :|

Just to make some tests, how could I build the application with wxWidgets, static and dynamic? For dynamic, do I just have to copy the wxWidgets libs outputted by ldd to the same dir as the executable or that can cause path problems?
Also for Windows.

DavidHart
Site Admin
Site Admin
Posts: 3998
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: How to do a release build with wxWidgets?

Post by DavidHart » Sun Jul 03, 2011 9:25 pm

Just to make some tests, how could I build the application with wxWidgets, static and dynamic?
I don't know C::B but I expect there are options you can set.
For dynamic, do I just have to copy the wxWidgets libs outputted by ldd to the same dir as the executable or that can cause path problems?
The executable path won't be in the library path unless you make it happen at either when building, or by setting the LD_LIBRARY_PATH to that dir in the terminal that will run the app.

ouch67
Earned some good credits
Earned some good credits
Posts: 135
Joined: Sun Mar 23, 2008 12:09 am

Re: How to do a release build with wxWidgets?

Post by ouch67 » Tue Jul 05, 2011 7:28 pm

In C::B if you set up everything correctly, you just have to change the lib search directories to the whatever link type that your trying to do and change add/remove the WXUSINGDLL define from the compiler settings and that's it. It's quite simple really.

You can set up multiple build targets for this as well. (and I highly recommend you do as it's so easy to set up and it can save time later.) For instance in my project I have a debug version, working release version and an final release version.

the debug and working release versions use DLL linking to make developing faster as it reduces linker time, while the final release statically links because the actual performance of the app becomes faster.

Otto
In need of some credit
In need of some credit
Posts: 4
Joined: Sun Jul 03, 2011 3:35 pm

Re: How to do a release build with wxWidgets?

Post by Otto » Wed Jul 06, 2011 12:00 am

Sorry for the noob question:
Is that in project > build options > (desired target) > Linker settings > Link Libraries - Add?


I added all .so (Linux) related to wx and did a rebuild, but nothing changed.

ouch67
Earned some good credits
Earned some good credits
Posts: 135
Joined: Sun Mar 23, 2008 12:09 am

Re: How to do a release build with wxWidgets?

Post by ouch67 » Wed Jul 06, 2011 3:34 pm

You shouldn't have to change the libraries you link at all. Just change the search directory and add/remove that define.

If your Link Libraries settings contains files with extensions on them, and/or paths your doing it wrong. you just need the file specified without that stuff. Use the Search Directories tab to specify where the libraries are. The compiler/linker will know what extension you want. (don't forget add/removing that define, it will get confused if you don't.)

Also I believe .so is static object... Which is not the library itself which should have a .a extension anyway.

Post Reply