Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

mc (Midnight Commander) in Kubuntu 9.10 (Karmic Koala) has a problem accessing .zip and other archives as a virtual file system. It has to do with a changed format of the output from unzip. Discussions offer a workaround, but that requires system (i.e. root) file access; my work box is locked down.

I have Ubuntu (without the K) 9.10 at home, and I downloaded the source package and made a code change that's a horrible hack (I would not dream of publishing) that would allow me to run my own correctly working copy of mc in a subdirectory of my $HOME. Alas, my "at home" box is configured differently, both in terms of processor(s) and KDE vs. Gnome; a transferred-over mc executable fails immediately with bus error.

Question, then:

Given

  • an Ubuntu box I completely control,
  • non-root on a KUbuntu box that has make and gcc and some other tools but not a complete development toolchain, such as the stuff underneath config
  • ability to download any packages I need
  • ability to create and muck around in my own $HOME tree

how can I build an mc that will run on my locked-down Kubuntu box?

share|improve this question
up vote 3 down vote accepted

Since mc gets built with autotools, you can configure the package in such a way that it does not install into a system, but a user directory which is writable by you. You do this by giving extra options to the ./configure call you issue. To see all available build options run

./configure --help

The magic bullet here is the PREFIX variable used: it (roughly) tells the build process where all your programs and support files get installed. This can be fine-tuned further.

When I build and install as user, I usually install into a PREFIX in $HOME/bin/progname.dir, while the executables go directly into $HOME/bin, so for your case

./configure --prefix=$HOME/bin/mc.dir --bindir=$HOME/bin

and then

make install

In your .profile file you should update your $PATH variable to include $HOME/bin/ by adding a line like

export PATH=$HOME/bin:PATH
share|improve this answer
    
Thanks! I'll give that a try tomorrow. I'm a little worried about GLIB. There are some GLIB 2.0 .so's on my system, but nowhere a glib-config. – Carl Smotricz Mar 2 '10 at 20:39
    
Drat! I'm still having problems. configure calls chk-config and that looks for GLIB. It wants a glib-config and can't find one. I made a separate question of that: superuser.com/questions/115671/… – Carl Smotricz Mar 4 '10 at 9:42
    
OK, I got it working. See my answer for details. Still, you got me well started, so here's my check mark for you. Thanks! – Carl Smotricz Mar 4 '10 at 10:14

Success! This is feedback for anyone else with similar problems.

As honk helpfully explained, configure can be helped along with some options. I found this wasn't quite enough, though: I had to manually change the links from ./config/ to config.sub, config.guess, install-sh and missing.

After that, I had lots of problems getting configure to find my glib 2.0. It turns out that configure calls chk-config and that has a number of different ways to find glib, none of which worked. I looked manually for the stuff it was trying to find and discovered that glib-2.0.pc was indeed available. I could make chk-config find it by pointing PKG_CONFIG_PATH to the directory containing all those .pc files.

I wrote a tiny shell script to provide configure with all the required environment variables and options. Here it is:

#!/bin/bash
my_root=/home/carl/MC
export PKG_CONFIG=$my_root/usr/bin/pkg-config
export PKG_CONFIG_PATH=$my_root/usr/lib/pkgconfig
OPTS=""
OPTS="$OPTS --disable-glibtest"
OPTS="$OPTS --enable-extcharset"
OPTS="$OPTS --enable-netcode"
OPTS="$OPTS --enable-charset"
# OPTS="$OPTS --with-glib-static"
# OPTS="$OPTS --with-glib-12=no"
./configure --prefix=$my_root $OPTS
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .