Building a linux wx app that runs on other PC's but mine Topic is solved

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
Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Building a linux wx app that runs on other PC's but mine

Post by Jorg »

Hi,

I recently asked on the wx-dev mailinglist how to get rid of libglitz which is an open GL lib that keeps haunting my app. I do not use it, but yet on other platforms (e.g. Ubuntu) this lib now needs to be installed to make my trivial app work.

Then i decided to download the wxGTK 2.6.1 (devel) RPM and link against the .so that the wx-config in /usr/bin tells me to link to. Now I am close, but still no cigar. wxScintilla I use requires 2.6.3 minimum. Bummer! There is no wxGTK 2.6.2 (3) to be found in Yast unfortunately.

So my questions are,

1) Is there an official wxGTK2.6.3.rpm somewhere?
2) How can I minimize the dependencies? I can choose for a lot of build-in options, but when I decide to configure without openGL like --without-opengl and STILL it wants to link some obscure openGL library I guess that is not really working for me.

I tried the autopackage way explained on the mailinglist, but that didn't even got me as far as rebuilding wxWidgets. It failed miserably.

Any help from diehard linux guru's??

- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
Dandel1984
Knows some wx things
Knows some wx things
Posts: 40
Joined: Wed Jun 01, 2005 3:52 am

Post by Dandel1984 »

i don't know what it is doing, but did you try installing the library or static linking of it?
Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg »

Hi there, I have tried so many things but failed.

1) The wxGTK2.6.1 RPM floating around has a mismatch in the wxGTK2.6.1-devel. The devel wx-config thinks it is configured for unicode while the wxGTK-2.6.1 is an ansi build

2) Trying to minimize dependencies still gave me 22 libs that my app needs to link against

Is there any configure line that is guaranteed to build a wx lib that has as minimal dependencies as possible? Also, somehow the libglitz (some openGL lib) keeps linking to my app.

Regards,
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Post by DavidHart »

Hi Jorgen,
Any help from diehard linux guru's??
It doesn't look like there are any around :(. I am certainly not a guru, but here goes:

First about your libglitz dependency. I've checked my (tarball) builds on both SuSE 9.3 and 10.1, and neither wx-config --libs mentions libglitz. I wonder if it comes from the SuSE rpm wxGTK: are you sure you aren't accidentally using the wrong wx-config?
1) Is there an official wxGTK2.6.3.rpm somewhere?
No, and there can't be, as rpms are distro-specific (and many distros don't use them anyway). AFAIK your only two choices are to tell all users to install wxGTK themselves, either their distro's version or from the tarball; or to distribute your app with it statically linked. I think most people do the latter.
2) How can I minimize the dependencies?
You won't want to hear this, but the normal way is to use bakefile/autotools. At present you are presumably using the output from wx-config, which means everything that wxGTK needs. When using bakefile/autotools, you specify just the libraries that you want.

So why not use them? Well, probably 4 or 5 people in the world understand them both well-enough to write in them :(. Fortunately one of these is Francesco Montorsi, who has written the wxCode ones, and these can also be used elsewhere, without too much difficulty :). I know you had trouble doing this before, but it is actually quite easy once you know how; and it means that your users can just run ./configure as usual. If you want more details, just say.

Regards,

David
Dandel1984
Knows some wx things
Knows some wx things
Posts: 40
Joined: Wed Jun 01, 2005 3:52 am

Post by Dandel1984 »

i must also concure that premake helps a lot, and as for the configuration/compilation, try the following commands and see if it helps at all, for configuration and compilation...

wx-config --cxxflags
wx-config --libs

and as for the linking, try adding the flag "--static" for static links.
Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg »

Dandel and David,

Thanks for the input I will check it again, I know CMake can also remove libs that might be an idea. Simply remove some libs and see how far I can get. When I get some time today I will try it again!

- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg »

I think I solved the problems. For all who want to know how and what was going on I will explain a bit.

The executable size stayed 400 Kb even when I said to my wxWidgets 2.6.3 build that I wanted everything STATIC. Well it built static using my own prefix which worked fine. But, GCC / LD works in mysterious ways .. all libraries were neatly listed as libs to add, but also in the library search path was /usr/lib and guess what, I also had wxGTK2.6.1 RPM installed. The library names are identical so it took those .so libraries. Whatever I tried, it did not want to take the libs I built myself .. Mind boggling.

I created a virtual PC with VMware containing a bare Suse 10.0 install. And after building there, it took the proper libs that I built, and with a big app of 6 Mb I must safely assume wxWidgets is statically linked.

As for libglitz, I tried to remove that from the packages in the new suse istall, and 200+ RPM's needed to be uninstalled to solve that dependency. So I must conclude libglitz needs to be there for suse.

The only way to build a good distrib package is starting with a clean OS and build against the libs you are given upon clean install. This way it is ensured that wxWidgets is linked properly with compatible libraries.

wxWidgets needs some work on that area. It is frustrated when wxGTK is already installed for 2.6.1 that there is no way to specify an alternative wxGTK. I do not know how the versions are resolved in Linux for seperate libraries, but it's worth looking at.

With regards,
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
chris
I live to help wx-kind
I live to help wx-kind
Posts: 150
Joined: Fri Oct 08, 2004 2:05 pm
Location: Europe

Post by chris »

Jorg wrote: wxWidgets needs some work on that area. It is frustrated when wxGTK is already installed for 2.6.1 that there is no way to specify an alternative wxGTK. I do not know how the versions are resolved in Linux for seperate libraries, but it's worth looking at.
Hi Jorgen,

I'm far from being a Linux guru, but the usual way to use different versions of any library (or executable) is to install them in your home directory and then setting the lookup paths for libraries and binaries.
If your Linux has 2.6.1 installed globally (i.e. in /usr/lib) and you want to link an app against 2.6.3, you'd compile wx yourself with
./configure --prefix=/home/username --exec-prefix=/home/username
make && make install
This will create the wx libs in /home/username/lib and a wx-config in /home/username/bin. The only thing left to do is:
1.: Tell your system to look in /home/username/bin first when looking for wx-config (so your makefiles don't use the global wx-config in /usr/bin).
2.: Tell your system to look in /home/username/lib for the .so libs when executing an app.

Solve this by adding
export PATH=~/bin:$PATH # lookup paths for binaries
export LD_LIBRARY_PATH=~/lib:$LD_LIBRARY_PATH # lookup paths for libs
in your .bashrc (or manually setting it in each session).
That way you may even install many different versions of wx by giving each of them an own prefix, i.e.
./configure --prefix=/home/username/wxGTK2.6.3-Unicode --exec-prefix=/home/username/wxGTK2.6.3-Unicode

and

export PATH=~/wxGTK2.6.3-Unicode/bin:$PATH
export LD_LIBRARY_PATH=~/wxGTK2.6.3-Unicode/lib:$LD_LIBRARY_PATH
If you did this (and relogin to make the changes in .bashrc work), type "wx-config --prefix" to check that the paths are correct. If they are, your makefiles should now link against your local wxGTK.

HTH, Chris

BTW: I'm not sure, but libglitz may come as a dependency from GTK itself, because apparently it's a backend for Cairo...
this->signature=NULL;
Game_Ender
Knows some wx things
Knows some wx things
Posts: 45
Joined: Wed Jun 15, 2005 5:47 pm

Post by Game_Ender »

On a debian based system you usually build your packages a chroot environment. This gives you a nice "clean" OS without all that virtualization hassle. I assume this is the way that RPM based distro's recommend you build packages too. Now you are only building a bare executable (kind of odd in the linux world), but it sounds like a chroot environment will give you what you want.

Chris's way is definitely the way to go if you wish to manage installs of multiple version of wxwidgets on linux. I run into similar wx-config headaches on OS X, so I just don't use wx-config. More control is better sometimes even if it takes you 5 more minutes to setup you project. I would also go for CMake over autotools, cmake looks much cleaner.
Post Reply