reddit / emacs

Build Emacs from source on Linux without installing depencies

Pale_Emphasis_4119 · 2022-04-01 07:08
I would like to build Emacs from source on a Linux machine on which I don't have root access. So I cannot guarantee I would be able install the needed dependencies. Is there a emacs source repo in which the dependent libs are already included. I know that I can deactivate some options during configure to reduce dependencies, but I do want the full fledged emacs not the minimal version.
clintm · 2022-04-01 07:17
I've had to do this a couple of times, though it's been a few years. It boils down to building each dependency with `--prefix` set to a directory in your home directory somewhere and pointing emacs at it with `--cflags` and `--ldflags` or the equivalent for emacs. I just wanted the curses interface, so it wasn't too hard.
Pale_Emphasis_4119 · 2022-04-01 08:05
Thanks for the idea. Do you know if there is a already a script or makefile. And also how did you manage the dependency with build-essentials package.
seregaxvm · 2022-04-01 10:31
Try to compile statically on other machine?
arthurno1 · 2022-04-01 11:30
You maybe don't need to build deps, if you are on a gnu/linux machine already, chances are big that dependencies are already installed. Check first what you need. You probably already have jpeg, png, svg, gtk, etc installed. Hardly to find any machine today without those, unless it is some constrained distribution. Secondly, you don't need to build Emacs with all dependencies. You can build Emacs just with what you have/need. Check ./configure --help. Typically, you can use --with-* and --without-* to turn on/off dependency. You can build Emacs without Gtk, png, jpeg, svg, compressed docs, xrdb, etc etc. Be sure to turn off anything you don't use for less dependency needed. Also, it is not just dependencies you will need. For building Emacs you will need a set of tools, compiler, linker, latex, etc, installed. Be sure they are present too. Finally, if you have all the tools, but are missing some compiled dependency, you can still compile that particular dependency on your home gnu/Linux machine, or find it elsewhere, and transfer the binary to use with your Emacs to the work computer. Or simply install at home the same distro as used at work and statically compile Emacs and just transfer binaries to your home dir at work. > It boils down to building each dependency with --prefix set to a directory in your home directory somewhere and pointing emacs at it with --cflags and --ldflags or the equivalent for emacs. --prefix is given to configure script, and is supported to install the Emacs to specific location other than the system default. However, it is fully possible and usable to run Emacs directly from the source directory where it is compiled, so there is no need to even install Emacs. Compiling and installing all the tools and dependencies for Emacs in a home directory, on a restricted machine, is probably not possibly and certainly not practical. Do you want to compile the entire Gtk and install in your home directory? Probably not.
jsled · 2022-04-01 11:45
I've used gentoo prefix to do something simliar, just let it manage the dependency tree in user-space, local to my homedir. Unfortunately, it doesn't have an obvious/simple way to tie back to the system-provided basic libraries, so you'll build /everything/ from the ground up, and perhaps incompatibly. Anyways, depending on what OS/distro you're running, you should be able to use it to install emacs' build-time dependencies, perhaps a "-devel" packages, and then just manually build the one or two packages that aren't provided by your system (if any), or at a too-old version. Good luck.
clintm · 2022-04-01 16:24
Oh, well that's different. The machines I did it on already had a compiler, make / automake / libtool, etc. which is afaik is a lot of the `build-essentials` package. edit: didn't answer your first question. From memory, it's `./autogen.sh` and then `./configure` but the instructions are in the `INSTALL` file.
jaredj · 2022-04-01 19:27
pkgsrc.org supports "unprivileged use and installation"
mavit0 · 2022-04-03 00:03
How modern is your Linux distribution? If you have, say, Podman, you can build and run inside a container that has the dependencies, no root access required.