What does "make install" actually do?
Hey all,
For some classes I have to use the ACE_OS library. I have really had no issues, but I have always wondered why you have to do "make install" what does this command do? Does it have something to do with shared libraries? I know on the school computers sometimes I cannot run programs that I have compiled with and ACE_OS dependency, but if I type $setenv LD_LIBRARY_PATH /path/to/ace_os5.6.5.so then it will run fine (I obviously dont have root access on these machines, so I could never figure out how to make this "cannot find shared object" error go away permanently Thanks, crab |
Quote:
The Makefile is essentially a list of instructions, saying how programs should be compiled/linked/installed/whatever. That's a very simplified way of stating it, but that's what "make install" does. |
Quote:
So, in short, to compile a program you usually do "make", and to install it after compiling you do "make install". Usually you do need root permissions if you want to install to / Quote:
But, you can safely assume that "make install" will install the program or whatever you just built in your system. Quote:
You can automate this process. But this entirely depends on how do you work. If you login in command line mode and you use bash as your shell, then you just need to add this into your ~/.bash_profile file: Code:
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/path/to/whatever/" It just depends on how do you login and your shell of choice. |
The make install step of the installation process, just copies the compiled programs, the man pages, the shared objects and so on... to their specific locations. External programs compiled from source are usually installed in /usr/local by default but this is not a general rule. It depends on the developer's choice. Obviously, if you don't have root privileges, you cannot install a software into directories owned by root.
Anyway, you can specify a custom installation directory in the configure step, usually: Code:
./configure --prefix=/home/crab To avoid this you can install the program into the source directory itself and then create link to the executables in the $HOME/bin directory (on most distribution it is already in the PATH) and create/modify the environment variables needed by the program to run. LD_LIBRARY_PATH is one of these variables. It contains the path (multiple paths separated by colon) of the shared objects (libraries) that are not in standard locations like /lib, /usr/lib, /usr/lib64 and so on. If you want to make the modification permanent, just add Code:
setenv LD_LIBRARY_PATH /path/to/ace_os5.6.5.so |
'make install' does only what is defined for it in the Makefile. If the Makefile doesn't have a section for it, then it does nothing.
Commonly 'make install' will be run as root and be responsible to copy the relevant executables and configuration files in proper places on the system, so that any user can use it. When installing an application into /usr/bin (a location in the $PATH of all users), then the application can be launched without having to specify the full pathname. If you omit the 'make install' step, then you need to launch the application either by going to the specific directory (and even running it like './appname') or by giving the full pathname. Linux Archive |
Wow, thanks so much to all. I guess this is a case of the simple explanation was not the one I ever thought of!
It makes sense now, thanks to everyone for the thorough responses! Crab |
Somewhere nearby, you'll find a file named: Makefile. Open it up, and have a look inside. (But don't touch anything...)
You'll find the word install in there somewhere... it's what we call a make target. You'll also probably find other make-targets, like all and clean. In any case, the essential information that you find in a Makefile is: "what depends on what, and if you determine that something needs to be rebuilt, how do you do it?" Thus, for example, when you say make install, the "make" utility is going to find that target, and work backwards to see what prerequisites there are, and to determine whether those prerequisite steps have already been done. For instance, if the program hasn't been compiled yet, that will happen first, then the stuff will be "installed." (And the Makefile will specify exactly how to do that.) make is one of those utilities for which the concept is intuitively simple, and the implementation can be quite complex indeed. (And we haven't even touched on configure!) In any case, we can usually stick to the "intuitively simple," namely, "it just works." You can just tell it what to make, and ... sit back and watch the pretty blinking lights. |
Quote:
Again, thanks for the awesome answers - you guys have really helped me get this a lot better. |
All times are GMT -5. The time now is 01:57 AM. |