Building software from source
Installing software into your own home directory is a normal thing to do on a shell account, and it is how you get an eggdrop, a bouncer, or any tool the box does not already have. You do not need root for any of it — you need --prefix.
What is already here
gcc, make, autoconf, automake, libtool, pkg-config, git and the Tcl development headers are installed system-wide. For the two things most people build, there are helper scripts that do the whole job:
ss-build-znc ss-build-eggdrop
Use those unless you specifically want to build by hand. What follows is the general pattern for everything else.
The pattern
mkdir -p ~/src ~/opt cd ~/src git clone https://github.com/someone/thing.git cd thing ./configure --prefix=$HOME/opt/thing make make install
--prefix is the whole trick: it tells the build to install into your home directory instead of /usr/local, which you cannot write to. Some projects use ./autogen.sh first to generate configure; some use CMake (cmake -DCMAKE_INSTALL_PREFIX=$HOME/opt/thing ..); a few just have a Makefile, where make PREFIX=$HOME/opt/thing install usually works.
For a tarball rather than a git repository:
cd ~/src curl -O https://example.org/thing-1.2.3.tar.gz tar xzf thing-1.2.3.tar.gz cd thing-1.2.3
Making the result runnable
Add your own bin directories to your PATH, once, in ~/.bashrc:
export PATH="$HOME/bin:$HOME/opt/thing/bin:$PATH"
Then source ~/.bashrc, or just log in again. If a program cannot find its own libraries afterwards, it was linked against something in your prefix and needs to be told where to look:
export LD_LIBRARY_PATH="$HOME/opt/thing/lib:$LD_LIBRARY_PATH"
Building inside your plan limits
Compiling is the most resource-hungry thing most accounts ever do, and it is where people meet their memory ceiling for the first time.
- Memory is a hard limit, and it is now tighter than a build. Compiling an eggdrop peaks at about 140 MB, measured on this box. That fits the 256 MB ceiling on Power and Staff; it does not fit Standard (128 MB), and Basic and Newbie are nowhere near. If a compile dies with no explanation, that is what happened — there is no swap for user processes, so the kernel does not slow you down first, it stops the process. On the smaller plans, ask staff rather than fighting it: the build helpers can be run for you, and this is a known rough edge rather than something you are doing wrong.
make -jmultiplies the problem. Every parallel job is another compiler process with its own memory. On a small plan, plainmakeis often the only thing that finishes.make -j2is a reasonable ceiling here even on a large plan; the box has 2 cores and other people are using them.- Compilers are foreground processes while you sit and watch them, so a long build occupies a slot. Starting a build in a screen session moves it to your background allowance instead, which is usually what you want if it takes more than a few minutes.
- Build directories are large.
~/src/thingcan easily be several times the size of the installed program. Delete it, or at leastmake clean, when you are done.
When it fails
configure: error: ... not found- A development library is missing. You cannot
apt-get installit — ask staff. If it is a reasonable dependency, it can be added system-wide for everyone. Permission deniedduringmake install- You forgot
--prefixand it is trying to write to/usr/local. Re-run configure with the prefix and build again. - Killed, with no message
- Memory ceiling. Try again without
-j, or ask about a larger plan. - It builds but will not start
- Usually
LD_LIBRARY_PATH, or a config file the program expects in a system directory — most accept--configor an environment variable to point elsewhere.
If it listens on a port
Anything you build that accepts incoming connections needs a port assigned from the Ports page. Binding to a port you picked yourself will appear to work and be unreachable from outside, because the firewall only opens ports the system has allocated to you.