Wednesday Jun 20, 2007

Django (actually MySQL-python) and RPATH

A kind soul in the linker group has finally implemented a way to patch Solaris binaries to change their RPATH setting. This will make it much easier for me to cope with the variety Solaris packages I need to assemble to make my various pet projects work. Ali's blog entry shows what it's all about, with a full explanation of both the problem and the solution.

The last time I got bit by this was less than a week ago. I was trying to get django to run on my Solaris desktop. Django is a Python web application framework (named after Django Reinhardt). Django needs a database, I picked MySQL. The python driver for MySQL uses the native MySQL libraries, which I have available in /usr/sfw, cool. I configure the python MySQL driver with a pointer to /usr/sfw/lib, everything builds, but when I run Django, no joy. I eventually figure out it can't find the mysql shared libraries at run time. My best answer last week was to write a start up script wrapper around my Django experiments.

#!/bin/sh
export LD_LIBRARY_PATH
LD_LIBRARY_PATH=/usr/sfw/lib
python manage.py runserver 0.0.0.0:8000

But with Ali's help, I can try to patch the poorly made _mysql.so file to contain the RPATH that it should have had from the beginning. Of course, Python is fun. I dig up /usr/lib/python2.4/MySQL.blah.blah.egg which is a zip file with _mysql.so inside it. I unzip it, patch _mysql.so using rpath, and rezip it, and replace the previous .egg file in /usr/lib. Yippee!! No more need for a start-up script.

Now you might also ask how Python uses a .so file from inside a zip file? A simple pmap command tells us.

% pmap $(pgrep python) | grep mysql
FE780000     168K r-x--  /usr/sfw/lib/libmysqlclient_r.so.12.0.0
FE7B8000      88K rwx--  /usr/sfw/lib/libmysqlclient_r.so.12.0.0
FE7E0000      40K r-x--  /home/quenelle/.python-eggs/MySQL_python-1.2.2-py2.4-solaris-2.11-sun4u.egg-tmp/_mysql.so
FE7F8000      24K rwx--  /home/quenelle/.python-eggs/MySQL_python-1.2.2-py2.4-solaris-2.11-sun4u.egg-tmp/_mysql.so

Interesting. It seems to dynamically unzip the file into my home directory when a python program needs to use that module. Very clever (in a twisted, inefficient sort of way).

Tuesday Jun 12, 2007

SXDE 5/07 -- Solaris Express Developers Edition

SXDE 5/07 – Solaris Express Developer's Edition 5/07

A new update to Solaris Express Developer Edition is out. It has the latest and greatest Solaris Nevada build, along with all the development tools you could ever want. Well, I dunno, I can want a lot, but there's a bunch of tools in there. My favorite parts are Sun Studio 12 and Solaris Nevada, but on the same DVD you get Netbeans 5.5 fully loaded, including the Creator RAD web development tool and other goodies.

I'll take this opportunity to review some of my own personal favorite features of Sun Studio 12 and Solaris Nevada.

Sun Studio 12

The part of Sun Studio 12 that I was most directly involved with recently is the compiler support for the dwarf debugging format. We finished support for C++ and Fortran using dwarf, and now it will be much easier to maintain compatibility between Sun tools and the gcc tool suite. Dwarf also has “location lists” which we can use in the future to support local variables in optimized code. We were hoping to get this feature in for Sun Studio 12, but it didn't make it in time. Look for optimized locals support in a future Sun Studio Express release.

One of the most visible changes in Sun Studio 12 is the new IDE. The debugger GUI has been rewritten to use the latest Netbeans, and to be much more like Visual Studio in some ways. Boy you should have heard the discussions we had about that! But it turns out that Visual Studio seems to be geared towards beginning developers, and that's something we need to get better at. There are lots of changes in the new version, and lots of things for us still to implement, but give it a try, and let us know what you think.

Other major new features include a new Thread Analyzer tool for finding data races in threaded programs, and the Linux version of our product now includes all the compilers! Having Linux compilers allows more people than ever to give Sun Studio a try, and see what they've been missing. Especially a “real” Fortran compiler!

Solaris Nevada

A lot of the Nevada features I like are also in Solaris 10 by now, but I'm not sure which. I've been starting to use ZFS filesystems on my group's file server, and I just remembered one of my favorite new features. It's the -h option. That's it, just one option. In reconfiguring filesystems, I end up running 'du' and 'df' commands over and over and over. It's always a pain in the butt because the output of those commands is normally in blocks. What the hell is a “block”? I never quite trusted the OS to give me an implementation independent answer. But the -h option stands for “human” format. You get size numbers displayed as 27.3K for kilobytes or 52G for gigabytes, and the number is rounded to an appropriately small numbr of significant figures. I never realized how annoying those block counts and sig figs were until I started to get used to the -h output.

I also like a lot of the Gnome desktop features in Solaris. There's a feature called gDesklets that I was reading about the other day. I had them confused with panel applets (which are also cool), but desklets let you put clever little clocks or graphs on your background in a similar fashion to what Apple popularized with their “Gadgets” feature. You can code your gDesklets in a scripting language (python), so they should be easy to create.

Another thing that comes to mind is the remote desktop support in Gnome (aka Vino). Lots of people where I work use VNC for working from home. But if you go back and forth between home and office, it's not really seamless to use the vncviewer program when you're already on your local desktop. So people will shut down all their apps when they go back and forth. There's a 'remote desktop' feature that allows you to start up a VNC session and transfer all your desktop windows into the remote server. Then when you shut down the VNC session they go back to being local windows. That feature makes moving between the office and another location so much easier.

Of course, these are the just some of the features. The new Network Automagic configurator, wider support for wireless drivers, Gnome 2.16, etc. For a list of lots more new stuff in SXDE, look here.

About

Chris Quenelle

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today