Difference between revisions of "CompSciWeek14-15"
Line 28: | Line 28: | ||
rpm -ql fftw-3.2.1-3.1.el6.x86_64 |
rpm -ql fftw-3.2.1-3.1.el6.x86_64 |
||
+ | |||
+ | == Example 1 == |
||
+ | |||
+ | Installing pdftk (developer Makefile) |
||
+ | |||
+ | mkdir ~/build && cd ~\build |
||
+ | wget https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk-2.02-src.zip |
||
+ | |||
+ | Unpacking the zip file can (and often does) clobber files in your current directory, so it's always safest to unpack it in a new directory: |
||
+ | |||
+ | mkdir pdftk && cd pdftk |
||
+ | unzip pdftk-2.02-src.zip |
||
+ | ls |
||
+ | |||
+ | In this case, pdftk was nice enough to put all their files in a subfolder, so we can get rid of the temp directory. |
||
+ | |||
+ | cd .. |
||
+ | mv pdftk/pdftk-2.02-src |
||
+ | rmdir pdftk |
||
+ | |||
+ | If you read the license information, you'll note that pdftk is covered by a GPL copyright. This means you have the freedom to modify and re-distribute the source (but not to change the license). The GPL is sometimes called a 'copyleft', since it is a clever hack on copyright perpetrated by Richard Stallman, the founder of the GNU project. |
||
+ | |||
+ | Make is a small language that lists the shell commands required to 'make' the 'targets'. A make target can be anything, but usually is the name of an executable file (or a file at an intermediate step) that will be built during the compilation process. Some standard options to make are |
||
+ | |||
+ | make -j 8 -C $PWD install |
||
+ | |||
+ | The '-j 8' flag tells make to run in parallel on 8 processors. The '-C' flag tells make what directory to run make from. Here, it's for illustration, since the default is to run in the current directory. The name 'install' is the target to build. It is not a real file, but instead just has a list of commands that copy the compiled program into the filesystem. The great thing about make is that it knows what order to make all the files in. |
||
+ | |||
+ | == Example 2 == |
||
+ | |||
+ | Installing fftw (autotools) |
||
+ | |||
+ | A quick search turns up the main page for [http://www.fftw.org/download.html fftw], the '''Fastest Fourier Transform in the West'''. |
||
+ | |||
+ | mkdir ~/build && cd ~/build |
||
+ | wget ftp://ftp.fftw.org/pub/fftw/fftw-3.3.4.tar.gz |
||
+ | |||
+ | This is a tar (tape archive) that has been gzipped (usually given the endearing name 'tarball'). You can read the contents with |
||
+ | |||
+ | tar tzf fftw-3.3.4.tar.gz | less |
||
+ | tar xzf fftw-3.3.4.tar.gz |
||
+ | |||
+ | The first command lists the contents. It is really helpful to make sure that all the files in the tarball are in their own directory. Most tarballs should be packed this way. Ones that aren't will put files in your current directory, and may clobber other files you had there before. |
||
+ | |||
+ | cd fftw-3.3.4 |
||
+ | less README |
||
+ | |||
+ | The second line is absolutely critical, since almost every package has some installation quirk that you won't know about until it's too late -- or until you read the instructions, either way. |
||
+ | You'll notice this file says configure, make, make install. This means the package uses gnu autotools! |
||
+ | |||
+ | Autotools are a standard set of installation scripts that follow the general install commands above. The configure part is the most important, since it gives you a chance to put in details about your own environment. In addition to reading all install instructions, you should also run |
||
+ | |||
+ | ./configure --help |
||
+ | |||
+ | This will give you a list of options that tell the compile process what compilers to use and where to find libraries and include files that the package may well depend on. The standard ones (CFLAGS, etc.) are shown in the graphic at the top of this page. |
||
+ | |||
+ | ./configure --with-pic --enable-float --prefix=$HOME |
||
+ | |||
+ | The second part of autotools is (sometimes GNU) make, covered above. |
||
+ | |||
+ | make -j4 install |
||
+ | |||
+ | == Example 3 == |
||
+ | |||
+ | Installing gromacs (CMAKE) |
||
= Fourier Transforms = |
= Fourier Transforms = |
Revision as of 13:25, 3 December 2014
Contents
Installation Woes
- Python packages (ex: sympy)
- GNU Autotools + make-based process (ex: FFTW)
- Cmake: a developer-friendly (not user-friendly?) alternative (ex: cgal)
- Non-standard makes (ex: NAMD2 and NWChem)
- Tinkering with open-source
- The DL on Software Licenses
- Apache, BSD, GPL, Microsoft, FDL, Creative Commons
- The open-source that isn't: Canvas
The single most important idea for compiling and installing new software is to remember that the installation works for the developer's environment, and it will for you, too if your environment is setup correctly. Often times this is easier said than done.
- Package Dependencies (pdftk depends on libgcj)
- and versions of those packages - this is usually the worst part
- Shell variables
- PATH, CFLAGS, LDFLAGS, LD_LIBRARY_PATH
- Compiler version
- Machine architecture
Tips:
To find a package owning a file (on linux systems with rpm)
rpm -qf /usr/lib64/libfftw3.so.3
To find all files associated with a package
rpm -ql fftw-3.2.1-3.1.el6.x86_64
Example 1
Installing pdftk (developer Makefile)
mkdir ~/build && cd ~\build wget https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk-2.02-src.zip
Unpacking the zip file can (and often does) clobber files in your current directory, so it's always safest to unpack it in a new directory:
mkdir pdftk && cd pdftk unzip pdftk-2.02-src.zip ls
In this case, pdftk was nice enough to put all their files in a subfolder, so we can get rid of the temp directory.
cd .. mv pdftk/pdftk-2.02-src rmdir pdftk
If you read the license information, you'll note that pdftk is covered by a GPL copyright. This means you have the freedom to modify and re-distribute the source (but not to change the license). The GPL is sometimes called a 'copyleft', since it is a clever hack on copyright perpetrated by Richard Stallman, the founder of the GNU project.
Make is a small language that lists the shell commands required to 'make' the 'targets'. A make target can be anything, but usually is the name of an executable file (or a file at an intermediate step) that will be built during the compilation process. Some standard options to make are
make -j 8 -C $PWD install
The '-j 8' flag tells make to run in parallel on 8 processors. The '-C' flag tells make what directory to run make from. Here, it's for illustration, since the default is to run in the current directory. The name 'install' is the target to build. It is not a real file, but instead just has a list of commands that copy the compiled program into the filesystem. The great thing about make is that it knows what order to make all the files in.
Example 2
Installing fftw (autotools)
A quick search turns up the main page for fftw, the Fastest Fourier Transform in the West.
mkdir ~/build && cd ~/build wget ftp://ftp.fftw.org/pub/fftw/fftw-3.3.4.tar.gz
This is a tar (tape archive) that has been gzipped (usually given the endearing name 'tarball'). You can read the contents with
tar tzf fftw-3.3.4.tar.gz | less tar xzf fftw-3.3.4.tar.gz
The first command lists the contents. It is really helpful to make sure that all the files in the tarball are in their own directory. Most tarballs should be packed this way. Ones that aren't will put files in your current directory, and may clobber other files you had there before.
cd fftw-3.3.4 less README
The second line is absolutely critical, since almost every package has some installation quirk that you won't know about until it's too late -- or until you read the instructions, either way. You'll notice this file says configure, make, make install. This means the package uses gnu autotools!
Autotools are a standard set of installation scripts that follow the general install commands above. The configure part is the most important, since it gives you a chance to put in details about your own environment. In addition to reading all install instructions, you should also run
./configure --help
This will give you a list of options that tell the compile process what compilers to use and where to find libraries and include files that the package may well depend on. The standard ones (CFLAGS, etc.) are shown in the graphic at the top of this page.
./configure --with-pic --enable-float --prefix=$HOME
The second part of autotools is (sometimes GNU) make, covered above.
make -j4 install
Example 3
Installing gromacs (CMAKE)
Fourier Transforms
Read through the page on Fourier transforms.
The Monte Carlo Method
- Integrals of the form: <math>\int \frac{f(x)}{g(x)} g(x) dx</math>
- Computing pi
- Parallelizing with MPI4Py