Linking With Gtk And Running On Any Linux

From WxWiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

I spent time understanding how to compile a wx application for binary delivery on any linux distrib. I did not solve all problems, but this is a start. Please consider that I compiled wxwidgets with gtk2 statically monolithic (--disable-shared --enable-monolithic)

  • Remember that GTK is licensed under LGPL, which essentially means that in order to link it to your application _statically_, your application will have to be (L)GPL-licensed.
    • You should note that in most cases (if not all cases), GTK is linked dynamically. Using the --disable-shared option of configure with wxGTK links wxGTK into your program statically, but not GTK+ itself, which will usually still be linked dynamically. --Tierra 09:28, 7 August 2007 (PDT)

Basic Steps

Using the command line prompt in root mode, do:

wxWidgets 2.9.2

wxGTK 2.8.12

NB.

If you want wxMediaCtrl (mediaplayer), you'll probably change the script to:

  • apt-get install libgconf2-dev
  • apt-get install libgstreamer0.10-dev
  • apt-get install libgstreamer-plugins-base0.10-dev
  • ../configure --with-gtk --enable-debug --enable-mediactrl

You can install in a specific directory with:

  • --prefix=/path/to/INSTALL_XYZ

If you get a gtk+-2.0.pc error this can be found in:

  • apt-get install libgtk2.0-dev

Good luck - Steve Cookson

Some Information

I've added to my configure command the following options : --with-gtk --with-libpng=builtin --with-zlib=builtin --with-libjpeg=builtin --with-regex=builtin --with-expat=builtin

without these "builtin", the sample apps claims for libpng.so.2 while libpng.so is present, and the radiobox/buttons/notebook etc. did not appear correctly.

  • I had to update my binutils package in order to link the opengl sample.
  • Do not try to link purely static with all libs. First they are not fully compatible at run time, second you will have a BIG problem finding the order of all -l* in the link command.
  • Look at tldp.org some info about linking on linux.
  • The command "nm -Bog /usr/lib/*" will give you all functions declared in all libraries (use grep to select).
  • The command "ldd myapplication" will give your all shared libraries needed by this program.

Riccardo Cohen. PS: Please feel free to add anything to improve this topic.

Solution 1

by Milan Kupcevic

If you do not need OpenGL, use wxGTK2-static-devel rpm from http://timeit.sourceforge.net/, compile your super-application on virgin RedHat 8.0 (i386) for i386 binary (it will run on x86_64 too) and on virgin Yellow Dog 3.0 for ppc binary; your binaries will work on virtually all i386, x86_64, and ppc linux distros in use today.

It was reported that these binaries run on:

  • i386 distros:
    • Red Hat Linux 8
    • Red Hat Linux 9
    • Red Hat Enterprise Linux 3
    • Fedora Core 1
    • Fedora Core 2
    • Mandrake Linux 9
    • Mandrake Linux 10
    • Suse 8.1
    • Suse 9
    • Sun JDS 2003 Linux
    • Sun JDS 2 Linux
    • Ubuntu Linux 4
    • Ubuntu Linux 5
  • ppc distros:
    • Yellow Dog 3
    • Yellow Dog 4
    • Mandrake Linux 9.1
    • Ubuntu Linux 4
    • Ubuntu Linux 5

Feel free to add your distribution if binaries compiled this way work on it.