Linux Configure/Make, --Prefix

Linux configure/make, --prefix?

Do configure --help and see what other options are available.

It is very common to provide different options to override different locations. By standard, --prefix overrides all of them, so you need to override config location after specifying the prefix. This course of actions usually works for every automake-based project.

The worse case scenario is when you need to modify the configure script, or even worse, generated makefiles and config.h headers. But yeah, for Xfce you can try something like this:

./configure --prefix=/home/me/somefolder/mybuild/output/target --sysconfdir=/etc 

I believe that should do it.

DESTDIR and PREFIX of make

./configure --prefix=***

Number 1 determines where the package will go when it is installed, and where it will look for its associated files when it is run. It's what you should use if you're just compiling something for use on a single host.



make install DESTDIR=***

Number 2 is for installing to a temporary directory which is not where the package will be run from. For example this is used when building deb packages. The person building the package doesn't actually install everything into its final place on his own system. He may have a different version installed already and not want to disturb it, or he may not even be root. So he uses

./configure --prefix=/usr

so the program will expect to be installed in /usr when it runs, then

make install DESTDIR=debian/tmp

to actually create the directory structure.



make install prefix=***

Number 3 is going to install it to a different place but not create all the directories as DESTDIR=/foo/bar/baz would. It's commonly used with GNU stow via

./configure --prefix=/usr/local && make && sudo make install prefix=/usr/local/stow/foo

, which would install binaries in /usr/local/stow/foo/bin. By comparison,

make install DESTDIR=/usr/local/stow/foo

would install binaries in /usr/local/stow/foo/usr/local/bin.

./configure and make: is there a common flag to the output filename, and what does --prefix do?

--prefix=/path relocates many components of the installation path. Typically prefix has a default value of /usr/local, leading to binary executables being installed into ${prefix}/bin. If you wanted them to be installed in the system path, you would set --prefix=/usr and then the executables would go into /usr/bin

This is in accordance to the Automake / Autoconf packaging conventions, which is detailed in the GNU coding standards.

As for the symlink, odds are it follows a naming pattern that is fixed within the install routines, either by code or by the linked library name. Often linked libraries have their names chosen based on the programs that load them moreso than the libraries they link to, so changing the name is not advisable. The linking is probably being done since you are probably installing into /usr/local/bin, and the libraries are also probably installing into a /usr/local/lib<something> path. Without further details (and a second question should be a second post) it's hard to comment on it. I'd say changing the name would probably not be good for the executables in /usr/local/bin

Yes, you can alter the output names of the executables with the --program-prefix=value command, which in my example would install valuecp instead of cp.

configure --prefix option for cross compiling

Yes you are right, --prefix is the path for working environment. Just use --prefix=/usr. You can check in which folder path make install command will install your binary by installing in DESTDIR. For example if you use --prefix=/usr and make install DESTDIR=/home/me/arm/build/target_fs, then the binaries will be installed in the folder /home/me/arm/build/target_fs/usr. And If you just run make install, then the binary will be installed in your prefix i.e. in "/usr".

As you are cross-compiling, I think it doesn't matter which prefix you use, because anyways you will be installing in DESTDIR and then copying the binary files manually to your target.

Configuring install path: prefix=[PREFIX] not fully understood

It should be the first one --prefix=/usr/local but to install files in that location you need root privileges. So you need to either change to the root account su or use sudo if you are a sudo user aka sudo make install. Only do that for the install phase, don't build like that.

Also /usr/local is usually the default install location so you don't usually need to specify that. Normally you only use --prefix to install into a different location like --prefix=/opt or your home folders: --prefix=$HOME/3rdparty.

Incidentally, if you install into your home folder you won't need root privileges.



Related Topics



Leave a reply



Submit