My Location Message Board E-Mail
pcbypaul
pc software, repair
      return to
    Homepage
bg

 
WP Clipart

Not Just for Geeks Anymore
Scripts 'N Tips
Xterm Use
Firefox Updating
update Java
Firefox Keys
Themes offline
Start Firefox
Kill Firefox
Firefox 16x16
Firefox Problems
Compiling
Compile wxPython
Disk Usage
CD Player
cdArray
Find-Installed
Backgrounds
Gimp Splash
Links
LinuxPackages
IceWalkers
Freshmeat
Linux Today
Slashdot
        from source code



  I've done it on three occassions (2 different versions, 2 different machines) and I almost got it right on my first atempt this time. So not exactly charmed -- but since I seem to have it about right I thought it best to archive my experience for my own good, and perhaps some others would benefit from such documentation as well.




Background and Prep

  My latest foray was on a stock Slackware-10.2 installation. Slack comes with Python 2.4.1 and gtk+2-2.6.1. What I compile for us here today is wxGTK-2.6.1.0 and wxPython-2.6.1.0. I obtained them from the same package (wxPython) from http://www.wxpython.org/.

 [Update -- last tested with gtk+2-2.8.12 and wxPython-2.6.2.1. All went as before except wxPython build. See the note near the end . . . Only other difference is that I did not bother to build the svg component in "contrib".]

  There are instructions but they are slanted toward developers who want to build outside of their usual libs dir, for multiple versions and testing. I just wanted to get the darn thing to work. So here we will begin the two-part process of building wxGTK, and then wxPython -- the toolkit and the bindings for Python, respectively.



Checkinstall
  I will be using checkinstall several times during this build. I use version 1.5.3 from Slackware, but you don't have to be running Slack to use it. If you are unfamiliar with checkinstall -- get familiar. Since you are reading this page it is sure to be useful for you. It can make packages out of source code you compile that are easy to uninstall and install. And is very simple to use. It is available at: http://asic-linux.com.mx/~izto/checkinstall/ If you are running Slackware, the 1.5.3 build is in /extra/checkinstall. For 10.2, the url for Perdue's mirror is: checkinstall folder.






  First up is wxGTK. As soon as you unpack the source tarball you're ready to configure. Just cd to the directory you expanded and issue a configure command. Here's the long line I used:

./configure --prefix=/usr --with-gtk --enable-geometry --enable-sound \
--with-sdl --enable-display --disable-debugreport --enable-optimize \
--enable-unicode --enable-debug_flag --with-libjpeg=builtin --with-libpng=builtin \
--with-libtiff=builtin --with-zlib=builtin --with-expat=builtin --without-odbc








  I would consider the above a "typical user's build" in that it is as optimized and as portable as is safely possible. Lots of libs are built-in. It is not set for debugging, yet the "--enable-debug_flag" is there for python to use to send error messages without just crashing.

  ODBC gave me fits in the past, due to the unicode implimentation. I got a work-around going once -- but it was not well-tested and so I avoid it now. Slackware is using UCS2, while several distros have already gone with UCS4 for Python unicode (16 and 32 byte.) I'm not sure if wx has trouble due to such "growing pains", but UCS4 will in all likelyhood be the norm soon. But not just yet. I'm just as sure that ODBC in the next WX release will be easier to compile. Anyway -- if all goes well, you should see something like the following after the configure runs:

Configured wxWidgets 2.6.1 for `i686-pc-linux-gnu'

  Which GUI toolkit should wxWidgets use?                 GTK+ 2
  Should wxWidgets be compiled into single library?       no
  Should wxWidgets be compiled in debug mode?             no
  Should wxWidgets be linked as a shared library?         yes
  Should wxWidgets be compiled in Unicode mode?           yes
  What level of wxWidgets compatibility should be enabled?
                                       wxWidgets 2.2      no
                                       wxWidgets 2.4      yes
  Which libraries should wxWidgets use?
                                       jpeg               builtin
                                       png                builtin
                                       regex              builtin
                                       tiff               builtin
                                       zlib               builtin
                                       odbc               no
                                       expat              builtin
                                       libmspack          no
                                       sdl                yes
                                       gnomeprint         no


  As you can see, I do not use Gnome (hence Gnomeprint is disabled.)

  If configuration went well for you, then we have the one tricky part left for those of us who are just doing a straight install: we need to run make from the present directory, but also run make for a few other controls separately. But go ahead and type

	make

  That gives me about an hour to kill. My last build was on a P4 2Ghz that runs at an average clip. Obviously your time will vary. When that is done we will install the "base" and then build the other controls.





  When your "make" completes, take a moment to enjoy that feeling. That part was the most likely for something to go wrong -- at least the way I install wx. More on that later. We will now employ that handy tool "checkinstall" to get a package of the wxGTK base.


  Instead of typing "install", simply type:

	checkinstall


  Checkinstall asks a few questions as it proceeds, but following the prompts is rather intuitive. When it has completed the wxGTK base will be installed and a package built in your present directory. Remember where that is, as we will be using it later. One last tip for the initial build, after checkinstall runs and both installs and creates your package -- type:

	ldconfig

  The above will ensure that your newly installed library files will be available to the system. That is needed for the next section, those extra widgets I mentioned earlier. This should NOT be necessary, because we are installing the libs into the standard location. But why take a chance?

  The next part is where things may seem a bit tedious, but I install in this manner to avoid any linking errors that can be tough to figure out. What we will be doing is installing the extra widgets separately, with the libraries already installed for wx. If you did not do it this way you would have to add the temporary location of the libraries to your LD_LIBRARY_PATH, and also worry about getting hard-coded paths in wx that would, upon full install, be in error. Some folks set the -rpath flag to avoid that possibility, but I prefer the method I describe below.






Installing the extra widgets

  Once the "base" install of wxGTK is installed we have to cd to a few lower directories to run make on a few things. They are stc, gizmos, animate and I also did svg. Below is a composite image of the directory structure and at the bottom are the directories I listed above.




  Being in the top directory after running "make", you have to cd to the dirs we are after one at a time. In each you will run "make" and checkinstall.

	cd contrib/animate/src
	make
	checkinstall


  Repeat the above for each of the 4 directories I listed above. Remember what each one is named as you run checkinstall. Now here is the tedious part --

  What we are going to do is pull the base and the other 4 packages aside, then uninstall all of them from your system. I use xpkgtool on Slackware, but you can use any tool you are familiar with. Then expand the five packages and combine the four extra widgets with the base package.

  This just means to add the lib and include files into the wxGTK package from the others, and append the linking routines that are in the install/install.sh script on Slackware. When they are all combined into one, you then rebuild the package. CD to the directory and run makepkg  packagename, or repack as the package type you are using.

  And finally, reinstall the combined package. You can run ldconfig again, just to be sure . . .

  Congratulations, wxGTK-2.6.1.0 is installed.
Now you have to install the Python bindings. This part is easy.





            Installing wxPython



cd to the wxPython directory, then run the following command:

checkinstall python setup.py UNICODE=1 EP_ADD_OPTS=1 install


  NOTE: latest (2.6.2.1) version I compiled for Slackware-curent (2/27/06) errored out compiling glcanvas. If you need (and you also have the problem) -- you will have to find a work-around. I was not using glcanvas, so I set the build command not to use it, as shown below.

checkinstall python setup.py UNICODE=1 EP_ADD_OPTS=1 BUILD_GLCANVAS=0 install

  And, believe it or not, you are done. You can then store the package you just made (should have been named, on Slackware, wxPython-2.6.1.0-i386-1.tgz) along with the other combined wxGTK package you made. Keep those two packages safe, and if you need to install wxPython on a similar/replacement machine, you can use them instead of going through all this again : )




  This may seem like a convoluted manner in which to install wxGTK and wxPython, but I avoid linking errors during compilation, I don't have to add paths to the system and I don't have to alter the way wx functions (ie -rpath.) It is also much easier to pin down a problem if something goes wrong during the build.

  I have seen scripts to do this, but they are usually distro-specific. The method described here can be adapted to most anything. Of course, if you have a package manager you trust, use that . . . but personally I do not trust automated package management.
  I use Slackware. I configure things myself -- then I Slack.


Tux Pages created and served by Linux Graphics made/edited by the Gimp   Created with the Gimp byPaul