1

I am trying my best to have a working compiler on a fresh ubuntu installation, without having access to root privileges on the machine (my user is also not on the sudoers list). To me, this is totally non-trivial. I cannot found any portable gcc for ubuntu (or linux in general) nor any recipe to create it.

Since on a freshly installed ubuntu you don't even have make, and there's no compiler to build it, at least I found out that I could download the make-x.xx.deb file with apt-get download make (it doesn't require sudo, of course, since it just downloads the deb package), extract it with dpkg -x (dpkg -i --force-not-sudo does not work...) and manually point to the extracted binary.

I tried the same with gcc, downloading also all the packages that apt-get install would have downloaded. Unsurprisingly, it didn't work. Not even adding to PATH, LD_LIBRARY_PATH, LIBRARY_PATH, COMPILER_PATH many folders did the magic. Fixing one problem after the other, the final insurmountable error with paths tricks was /usr/bin/ld: cannot find /usr/lib/x86_64-linux-gnu/libmvec_nonshared.a

As I expected, the gcc compiler is hardcoded to look for at least one library in a place I cannot write anything (/usr/lib/...). Maybe there're also others I don't know about that would fail later.

I tried also to download a prebuilt binary of clang from the LLVM website. The problem is that the clang compiler, without any gcc installed, is completely non-functional. I can make it look to the gcc headers extracted from the .deb files above, but it finally fails because it cannot find a ld executable on the system for the linking phase (I had to remove the manually extracted gcc from the path for other problems).

So here I am, asking for suggestions: how to install gcc (or any other decent compiler/build environment) on ubuntu without admin privileges? I cannot think it's not already solved as a problem [to add fuel to the fire, on windows is easy and possible with a couple of downloads from official websites].

The only idea I came up with is to build it on another identical machine on which I have admin privileges, using the --prefix and the --disable-shared switches, and find a reasonable place to store the resulting package (after a tar.gz treatment) online. But the resulting script does not look legit, when you see it is going to download a compiler from an unknown personal website...

1 Answers1

0

Finally I got notice of a way to install without admin privileges make+gcc on a freshly installed ubuntu, without having to become crazy writing my own bash scripts to extract from .deb files. I just had to rely on conda!

First, install miniconda (does not require privileges)

Second, use conda to install make, gcc, ... (all available on the anaconda official channel, also!).