Can binaries built from source be installed on a second machine

compilingexecutablemakesoftware installation

I'm not sure if this is the best place to ask this – please point me in the right direction if there's a better place.

Let's say, hypothetically, that I have two machines – A is a development machine, and B is a production machine. A has software like a compiler that can be used to build software from source, while B does not.

On A, I can easily build software from source by following the usual routine:

./configure
make

Then, I can install the built software on A by running sudo make install. However, what I'd really like to do is install the software that I just built on B. What is the best way to do that?

There are a few options that I have considered:

  1. Use a package manager to install software on B: this isn't an option for me because the software available in the package manager is very out of date.
  2. Install the compiler and other build tools on B: I'd rather not install build tools on the production machine due to various constraints.
  3. Manually copy the binaries from A to B: this is error-prone, and I'd like to make sure that the binaries are installed in a consistent manner across production machines.
  4. Install only make on B, transfer the source directory, and run sudo make install on B: this is the best solution I've found so far, but for some reason (perhaps clock offsets), make will attempt to re-build the software that should have already been built, which fails since the build tools aren't installed on B. Since my machines also happen to have terrible I/O speeds, transferring the source directory takes a very long time.

What would be really nice is if there were a way to make some kind of package containing the built binaries that can be transferred and executed to install the binaries and configuration files. Does any such tool exist?

Best Answer

Using what you have so far and if the makefile is generated with GNU autotools, I would set the target location or install path with

./configure --prefix=/somewhere/else/than/the/usual/usr/local

and then run

make && make install

and finally copy the files from the prefix folder to the usr/ folder in the other machine. This is assuming both machines have the same architecture, if not, then use the according cross toolchain.

Related Question