Static build of mc



I'm on a web host shared server that I like VERY much: O2Switch (o2switch.fr) They give a LOT of functionality for the money, including shell access. Unfortunately they don't have mc installed and are not willing to install it.

I've tried to find other ncurses-based file managers and editors but nothing even comes CLOSE to mc and what it does for me. I've got the python ranger file manager to work but I DON'T know and don't have time to learn vim key-bindings so it's almost useless to me. mc simply works the way I do and I would really like to get it working on this environment. The hosting company says I'm free to put on there things that I can get to run within the limitations of being a standard user. I can't run package installers, nor can I compile anything. I've gotten other small statically-linked programs to run fine in my user environment. So I would like a statically-linked, user-environment version of mc (even if some of the more esoteric features don't fully work - though what's esoteric for me may not be for someone else).

They told me that the server is a CentOS 6 box. I see traces of CloudLinux and CageFS in my user space as well.

So I created a VirtualBox CentOS 6.8 machine (Win 10 Pro host). I installed the mc yum package and it runs fine in my VM. So then I tried to copy the appropriate files to my web hosting user space (/etc/mc >>> ~/etc/mc, ~/usr..., and so on). Unfortunately it complained about the version of glibc (2.12) on the server. I saw ONE statically linked mc on the web here: https://github.com/linux-static/linux-static-i386/downloads but it will only run if placed under /opt and I don't have access to that on my user space (in .Cagefs there is an /opt. I tried putting it there, but mc wouldn't start, complaining of something missing/wrong version...sorry don't remember the details - I've tried SO MANY things)

While I have a programming background (IBM mainframe assembler and COBOL and LOTS of various scripting), none of it is in Linux so I've been getting a crash, self-taught course in linking/loading elf-style, etc. I'm still in WAY over my head though.

It looked like I was going to need to compile it myself. So I tried to compile it statically on my CentOS box using hints from this site: https://namelythehedgehog.wordpress.com/2010/04/20/compile-static-copy-of-midnight-commander/ where he suggests this configure line:

./configure --with-glib-static --without-x --disable-shared --enable-static \
    CC='gcc -static -static-libgcc -fno-exceptions' \
    CXX='g++ -static -static-libgcc -fno-exceptions' \
    LDFLAGS='-Wl,-static -static -lc' \
    LIBS='-lc'

The CentOS 6.8 had a problem with glibc versions and the mc source version I tried (4.8.17). So I read more and found out that I really needed to have the static versions of glibc as well so I went to create a user-space static version of glibc. I couldn't get that to work with my CentOS VM and VirtualBox with CentOS is is EXTREMELY painful. So I fell back to my xubuntu VM and succeeded in compiling the latest glibc to a non-system directory. So I modified the configure line to the following:

./configure --with-glib-static --without-x --disable-shared --enable-static \
    CC='gcc -static -static-libgcc -fno-exceptions' \
        CXX='g++ -static -static-libgcc -fno-exceptions' \
        LDFLAGS='-Wl,-static -static -L/root/myglibc/build/lib -lc' \
        LIBS='-L/root/myglibc/build/lib -lc'

For good measure and because it wasn't finding a static glibc, I also did:

export GLIB_LIBDIR=/root/myglibc/build/lib
export LD_LIBRARY_PATH=/root/myglibc/build/lib

The end result though is still the same message:

configure: error: Cannot find static glib

and it stops right there. If I look in /root/myglibc/build/lib, there is a libc.a so I really am at the end of my understanding and patience and time. I can't imagine that there is NOT a solution, but I need help from people who know this MUCH better than I do.

So, if any of you smart people can point out to me the error of my ways or point me to other copies of statically linked mc that should work (that I can simply do copies of the relevant files into my user-space), please let me know. I'll be very grateful and I promise to pass on my eventual success to others in my same situation.

Many thanks in advance!


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]