Linux source make install

How to compile and install programs from source

This is an issue that really limits my enjoyment of Linux. If the application isn’t on a repository or if it doesn’t have an installer script, then I really struggle where and how to install an application from source. Comparatively to Windows, it’s easy. You’re (pretty much) required to use an installer application that does all of the work in a Wizard. With Linux. not so much. So, do you have any tips or instructions on this or are there any websites that explicitly explain how, why and where to install Linux programs from source?

«Comparatively to Windows, it’s easy. You’re (pretty much) required to use an installer application that does all of the work in a Wizard. With Linux. not so much.» There’s the weak point in the question. With Windows, you rarely get the source code, so you’re at the mercy of whomever made the package. If you think about this, it’s not that much different from saying «there was no Linux package, so I have to build from source», ie. there wasn’t a way to get it to begin with. Building from source is usually a last resort in *nix-land, but rarely an option in Windows-ville.

That being said. +1 bump for asking a common question that should be answered for all newcomers to *nix systems. 🙂 Building from source sometimes means the difference between fixing a nasty bug and just suffering until the next software release. It’s really not that bad, and as many here have pointed out, once you know what to look for and how to do it, fairly painless.

5 Answers 5

Normally, the project will have a website with instructions for how to build and install it. Google for that first.

For the most part you will do either:

  1. Download a tarball (tar.gz or tar.bz2 file), which is a release of a specific version of the source code
  2. Extract the tarball with a command like tar zxvf myapp.tar.gz for a gzipped tarball or tar jxvf myapp.tar.bz2 for a bzipped tarball
  3. cd into the directory created above
  4. run ./configure && make && sudo make install
  1. Use git or svn or whatever to pull the latest source code from their official source repository
  2. cd into the directory created above
  3. run ./autogen.sh && make && sudo make install

Both configure and autogen.sh will accept a —prefix argument to specify where the software is installed. I recommend checking out Where should I put software I compile myself? for advice on the best place to install custom-built software.

Typically people who want the «bleeding edge» software will pull the release from the version control software (like git, subversion, or CVS). This is «bleeding edge» because it’s probably untested, unlike a released tarball, which has (probably) been vouched for as working (at least mostly). Make sense?

@Matt, sure it makes sense but I think the comment was directed more at the fact that Sandy now made it appear as if there’s an autogen.sh in every git’d/svn’d trunk.

Читайте также:  Ralink driver kali linux

And a chicken in every pot. or something like that. Heck, every once in a while, I come across software without a configure script, too. If there were an easy, unified way of doing it, we wouldn’t need packages 😉

Matt is absolutely right, this is why I said «for the most part», and first advocated looking up the project’s website. The autogen.sh/configure advice will hold for pretty much every GNOME module, and a ton of other projects, too. Some projects don’t use automake, and will only have Makefile, and you will just run make && sudo make install . Some Python projects will only have a setup.py, which you will call to install (since there is no real compile setup). There are plenty of other build/install systems out there, too. Hopefully README or INSTALL files will explain exactly what to do.

I just want to add that there are package managers that compile packages from source, and handle all package dependencies, flags, etc..

In Debian, the apt-get package manager can install from source too: APT HOWTO: Working with source packages (Same goes for Ubuntu, Linux-mint and everything else based on Debian)

The Gentoo distribution uses the portage package manager, which compiles the whole system from source only: Portage Introduction.

Slackware can compile packages but I don’t know if there’s any package manager for this in there.. =)

Anyway you can always compile packages manually like Sandy mentioned above =) Also it must be possible to use apt-get or portage package managers in any other distro.

To say «the apt-get package manager can install from source» is incorrect. The quoted section describes how one can create a Debian package from Debian sources. Not arbitrary upstream sources.

I think it’s just best to read the documentation coming with that specific program or application that you’re wanting to install. Usually there are readmes/READMEs inside the tarballs (the application source archive which you can usually download) or maybe even INSTALL files to read and learn about what is the preferred way of installing said application. In short: RTFM 😉

I came here because the the README gave all the requirements to build under Linux, but only has Windows install instructions. The accepted answer worked for me and probably works most of the time. I think it’s almost better advice to try the ./configure route and go to the README if it doesn’t work (i.e. missing a dependency and you can’t read the compiler output).

A summary for using the Ports Collection in FreeBSD:

Ports are organized by category so if you don’t know what category the port is in you have to find it first:

cd /usr/ports make search name=myport 

Sometimes there are too many entries that way. I personally prefer:

find /usr/ports -name myport* -print -depth 2 

Use the * when searching since there are often multiple versions of a port available. The depth argument ensures your return results aren’t needlessly cluttered with matches you are unlikely to want.

Configuration

Often, you’ll want to do some configuration; software such as Apache and Postgres practically require it. There are three main choices: command line, environment and make configuration files. To get started with the command line:

Читайте также:  Alt linux network manager

this will list the default configuration options. If you like the defaults you are ready to compile and install. If not,

will bring up a dialog box where you can select which options you want. (Don’t become confused with this and make configure which configures your port with your chosen options!) This is often sufficient but for some software, like Apache, there is often complex configuration that a simple dialog won’t handle. For this, you also should look at the Makefile(s) which will sometimes give you some additional targets for make that will give you more information. To continue the Apache example

make show-modules make show-options make show-categories 

will give you information on setting up you chosen modules, thread options and the like. If your port’s defaults are mostly fine and you just want to change a few things, you can also just pass key=value pairs like environment variables:

make MYVBL1=MYVAL1 . install clean 

Also, you can set switch options via the -D option:

make -D MYVAR -D MYOTHERVAR . install clean 

For complex configuration however the command line won’t work well and you’re better neither of the first two methods will be effective. In this case you can make a configuration file and pass that to make with the __MAKE_CONF variable. FreeBSD has a default configuration file: /etc/make.conf which usually contains information on previously installed ports and other system settings. To begin, create a file with your ports options, call it ~/myport.mk and then combine that file with /etc/make.conf:

cat /etc/make.conf ~/myport.mk >> ~/make.myport.conf 

you can then double check your configuration:

make showconfig __MAKE_CONF=~/make.port.conf 

and if everything looks good:

make install clean __MAKE_CONF=~/make.myport.conf 

BEWARE! If you need to adjust your configuration settings after make configure or an installation in whole or part you absolutely must clear your configuration first:

Failure to do so will result in unexpected interactions between the ports subsystem, your port’s make defaults and your desired configuration.

That’s kind of a lot for a summary, but the complexity of configuration is mostly about the app, not the port. Bash for example, doesn’t really have any options.

Installation

make build make install make clean 

which is just more typing.

That’s pretty much it. Obviously there is more you can do such as recursively listing dependencies and configuration options, update with patches and so on. Here I will refer you to the Ports section of the Handbook, the port subsystem’s man page (good info on additional make targets) and the make man page.

Источник

How to install make on Ubuntu

The ”make” command in Linux is used to compile and manage a collection of applications and files from source code. It allows developers to use the terminal to install and collect a variety of programs. It also manages and reduces the amount of time that is required for the compilation. The make command’s primary goal is to break down a huge program into smaller pieces and assess whether or not it needs to be recompiled. It also gives the essential instructions for recompiling them.

The make command is used to execute the makefile which is a unique file that includes the shell commands we write to keep the project running. It includes executable targets and instructions and is not permitted to generate several makefiles. It’s best if you make a separate directory for it. It maintains track of recently updated files, so only update those that are needed. As a result, this article will show you how to install the make package on Ubuntu.

Читайте также:  Драйвер xerox workcentre 3550 linux

How to install the Make package on Ubuntu

Before installing the make package, it is better to update your already installed packages; otherwise, you may find compatibility issues with some software. You can do that by typing.

This command will provide you with the information of all outdated packages that can be upgraded to the newer version, so this is highly recommended before installing any new package. Make package comes in default in the Ubuntu OS, so you should verify if it is already installed before considering installing it. You can verify it by typing the below-mentioned command in the terminal.

Text Description automatically generated

If the make package is not installed in Ubuntu due to any reason, you will get the error as shown below.

Text Description automatically generated

You can install the make package by typing.

Text Description automatically generated

Your system should have a make directory; otherwise, you cannot use the make package. You can verify that by typing.

Text Description automatically generated

If the directory is available then you can use the “make” utility; if it displays an error as shown below then there is a way to solve this problem as well:

Text Description automatically generated

By installing the build-essential package you get rid of this error. It is also known as a meta-package, and you can use it to install a make package and several other packages as well. Many packages are dependent and linked with this package, and you can’t install them without installing the meta-package first. For its installation, you need to type the following command in the terminal.

Text Description automatically generated

After its installation, you should check the make version to verify if it is properly installed or not. You can also verify the make directory that you won’t see if it is not working correctly before. You can check the version as discussed before by typing the command.

And you can check the make directory, use:

Text Description automatically generated

As of now, you can see both the version and the directory, the make package is now correctly installed, and you can use it as per your requirement.

Conclusion

The make command in Linux is used to compile and manage a collection of applications and files from source code. It allows developers to use the terminal to install and collect a variety of programs. It also manages and reduces the time that is required for the compilation process for large projects. In this article, we have shown you how you can install the make package, and some of the solutions have also been discussed if you are not able to install this package

About the author

Taimoor Mohsin

Hi there! I’m an avid writer who loves to help others in finding solutions by writing high-quality content about technology and gaming. In my spare time, I enjoy reading books and watching movies.

Источник

Оцените статью
Adblock
detector