Differences between revisions 1 and 6 (spanning 5 versions)
Revision 1 as of 2009-06-25 21:23:11
Size: 3176
Editor: 41-62
Comment:
Revision 6 as of 2020-10-20 12:18:40
Size: 2300
Editor: maegger
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= How can I compile/install additional software on a linux tardis workstation? =
Regular (non-root) users cannot use the commands {{{apt-get}}}, {{{aptitude}}} or {{{dpkg}}} in order to install precompiled .deb-packages on a tardis machine. However, you may download the source code, compile it and install the desired software in your home-directory. The following description may vary as the case arises (the README and INSTALL files in the source code directory usually give detailed information).
#rev 2020-09-08 stroth
#rev 2018-10-30 stroth
Line 4: Line 4:
 * Download source code
 * Enter source code directory and execute {{{./configure --prefix=/home/$USER/package}}}. The configure script checks for all necessary dependent libraries and creates all make files. If {{{./configure}}} fails or if you prefer a particular library over another you must set the necessary path variables.
= How can I compile/install additional software on a managed linux workstation? =
Line 7: Line 6:
 * Remark: Most libraries are contained in {{{/usr/lib/}}} and don't need to be specified. If a desired library is not found, you may check {{{/usr/pack/}}} or [[http://www.sepp.ee.ethz.ch/sepp-debian/|www.sepp.ee.ethz.ch/sepp-debian/]] for the path (more friendly: you can also use the command {{{sepp}}} for that). Only system administrators with elevated privileges (a.k.a. ''sudo'' or ''root'' privileges) are allowed to use the commands `apt`, `apt-get` or `dpkg` to install pre-compiled .deb-packages on a managed linux client.
Line 9: Line 8:
 * {{{./configure --help}}} shows you which variables can be set. Here are the most important ones:
 ||<tablewidth="763px" tableheight="118px">'''Variable''' ||'''Meaning''' ||
 ||{{{PREFIX}}} ||toplevel directory path, should be in your homedirectory. It is an argument of the configure script, e.g. {{{./configure --prefix=/home/$USER/package}}} ||
 ||{{{CFLAGS}}} ||C-Compiler options (usually {{{gcc}}} on Linux), e.g. include directory specifications. For an include directory use {{{-I}}} (capital i) option, e.g. {{{CFLAGS=-I<inlcude-directory>.}}} You may use multiple {{{-I/path}}} in this variable, use whitespace for separation. ||
 ||{{{CXXFLAGS}}} ||C++-Compiler options (usually {{{g++}}} on Linux), e.g. include directory specifications ||
 ||{{{LDFLAGS}}} ||linker flags. Use {{{-L}}} option for link-time-directory and {{{-Wl,-rpath,}}} (will be passed to {{{ld}}}) for run-time directory (both directories are the same), e.g. {{{LDFLAGS="-L<link-directory> -Wl,-rpath,<link-directory>"}}} Remark: The {{{-Wl,-rpath,}}} option is for linux, on solaris you may want to use {{{-R}}} instead. Use whitespace as separation for more paths. ||
As a possible way around this restriction, most software can be built from its source code and installed without elevated privileges to a custom location. Details to install software from its source code are typically listed in accompanying files named `README` and `INSTALL`, the following describes a generic installation process:
Line 17: Line 11:
 Hint: You may use {{{pkg-config}}} to set these variables, check [[Workstations/Linux/Applications/PKGConfig|PKGConfig]] for more information. == Generic installation process ==
Line 19: Line 13:
 * Once the configure script terminated successfully, execute {{{make}}} in order to compile source code. On Solaris you must use {{{gmake}}} instead of {{{make}}}.
 * Execute {{{make install}}} in order to install software. Again, on Solaris you must use {{{gmake install}}}.
 * Download a source code archive, unpack it and enter the source code directory
 * Execute the command {{{ ./configure --prefix=/home/$USER/package }}}
 . The `configure` script checks for dependencies necessary to build the software and creates the so-called `Makefile`. If it fails due to missing dependencies, install those first and set the necessary environment variables to make them available (see table below)
 * `configure --help` lists options and environment variables possible to pass to the script
 * Execute the command `make` to build the software
 * Execute the commande `make install` to install it
Line 22: Line 20:
 * In conclusion, here is an example of the whole process (tcsh on Linux):
 {{{
> setenv CFLAGS "-I<include-path>"
> setenv LDFLAGS "-L<link-directory> -Wl,-rpath,<link-directory>"
> ./configure --prefix=<path>
...
> make
...
> make install
...
>
||''Variable''' ||'''Meaning''' ||
||`PREFIX` ||Toplevel directory path where the software is going to be installed||
||`CPPFLAGS` ||C preprocessor environment variable to add directories containing library headers in a custom location||
||`LDFLAGS` ||Linker environment variable to add directories containing libraries installed in a custom location||


== Simplified example ==
The directory `opt` serves as the location for all custom-built software in the following examples.

=== Install a software where all dependencies are available ===
{{{#!highlight bash numbers=disable
./configure --prefix=/home/$USER/opt
make
make install
Line 34: Line 35:
 Remark: {{{setenv}}} is used in tcsh which is the standard shell on tardis workstations. If you use bash you may want to use the command {{{export}}} instead.
=== Install software depending on previously built libraries ===
{{{#!highlight bash numbers=disable
export CPPFLAGS=-I/home/$USER/opt/include
export LDFLAGS=-I/home/$USER/opt/lib
./configure --prefix=/home/$USER/opt
make
make install
}}}

----
[[CategoryLXSW]]

How can I compile/install additional software on a managed linux workstation?

Only system administrators with elevated privileges (a.k.a. sudo or root privileges) are allowed to use the commands apt, apt-get or dpkg to install pre-compiled .deb-packages on a managed linux client.

As a possible way around this restriction, most software can be built from its source code and installed without elevated privileges to a custom location. Details to install software from its source code are typically listed in accompanying files named README and INSTALL, the following describes a generic installation process:

Generic installation process

  • Download a source code archive, unpack it and enter the source code directory
  • Execute the command  ./configure --prefix=/home/$USER/package 

  • The configure script checks for dependencies necessary to build the software and creates the so-called Makefile. If it fails due to missing dependencies, install those first and set the necessary environment variables to make them available (see table below)

  • configure --help lists options and environment variables possible to pass to the script

  • Execute the command make to build the software

  • Execute the commande make install to install it

Variable

Meaning

PREFIX

Toplevel directory path where the software is going to be installed

CPPFLAGS

C preprocessor environment variable to add directories containing library headers in a custom location

LDFLAGS

Linker environment variable to add directories containing libraries installed in a custom location

Simplified example

The directory opt serves as the location for all custom-built software in the following examples.

Install a software where all dependencies are available

./configure --prefix=/home/$USER/opt
make
make install

Install software depending on previously built libraries

export CPPFLAGS=-I/home/$USER/opt/include
export LDFLAGS=-I/home/$USER/opt/lib
./configure --prefix=/home/$USER/opt 
make
make install


CategoryLXSW

FAQ/CompileInstallAdditionalSoftware (last edited 2020-10-20 12:18:40 by maegger)