That depends on where your "other" version of glib came from. I see that this is a forum for discussing Debian -- so if you have this problem from packages, that's just wierd. If you have this problem from compiling up glib from source, without cleaning out prior versions, well, that's where your problem is.
The debian route would be to use dpkg --purge to totally remove the offending package. But then dpkg will also want to remove other things in addition. Try checking out the --force options: there is a way that apt can force a package removal irrespective of dependencies: it has to in some circumstances.
If your older version of glib comes from a source package, you could either "make uninstall" from that package's source directory, or you will have to hunt down the issue manually. A tool that will help you with the latter (but will require a lot of reading and patience) is strace. If you can place a trace on the command that produces the error you see below, you will be able to check on all files that are touched by the script, and hence, perhaps find your problem and kill it.