This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
workshops:hpcprac1 [2015/06/28 14:37] kevin created |
workshops:hpcprac1 [2021/12/09 16:42] (current) |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | =====Practical 1: Linux Shell===== | + | =====Practical 1: Linux Shell for Programmers===== |
| **Aim:** to build and install in your //home// directory a library and and application. | **Aim:** to build and install in your //home// directory a library and and application. | ||
| + | |||
| + | ====Slides==== | ||
| + | |||
| + | The slides for this morning' | ||
| ====Logging in==== | ====Logging in==== | ||
| - | Download and install putty-ssh and connect to '' | + | Download and install putty-ssh and connect to '' |
| ====Build and install zlib library==== | ====Build and install zlib library==== | ||
| Line 11: | Line 15: | ||
| Create a '' | Create a '' | ||
| + | mkdir src | ||
| + | | ||
| Copy the zlip source code tar file from my home directory. | Copy the zlip source code tar file from my home directory. | ||
| + | |||
| + | cp / | ||
| + | |||
| + | Fill in the ??? with the correct path and file name. | ||
| + | |||
| + | Move the tar file into the new directory: | ||
| + | mv zlib-1.2.8.tar.gz src/ | ||
| + | |||
| + | > Note that the version available is probably newer than 1.2.8 --- modify these instructions accordingly. | ||
| + | |||
| + | Untar the file | ||
| + | |||
| + | cd src | ||
| + | tar zxvf zlib-1.2.8.tar.gz | ||
| + | |||
| + | Load the correct environment variables using the tool " | ||
| + | |||
| + | module load gcc/??? | ||
| + | |||
| + | **Fill in the correct information for the ??? above.** | ||
| + | |||
| + | Prepare your own local directory structure: | ||
| + | cd ~ | ||
| + | mkdir local | ||
| + | cd local | ||
| + | mkdir bin lib share include | ||
| + | |||
| + | Configure the compile environment: | ||
| + | |||
| + | cd zlib-1.2.8 | ||
| + | ./configure --prefix=~/ | ||
| + | |||
| + | Compile zlib using the tool " | ||
| + | |||
| + | make install | ||
| + | |||
| + | Verify that everything is in '' | ||
| + | |||
| + | ls -R ~/local | ||
| + | | ||
| + | |||
| + | ====Build a simple application using your own zlib==== | ||
| + | |||
| + | Copy the '' | ||
| + | |||
| + | > You should be able to work out what the commands are by now | ||
| + | |||
| + | Edit the '' | ||
| + | |||
| + | #include " | ||
| + | |||
| + | to | ||
| + | |||
| + | #include " | ||
| + | | ||
| + | and change the name of the '' | ||
| + | |||
| + | Now compile the object file (ends in '' | ||
| + | |||
| + | gcc -c -o zpipe.o -I ~/ | ||
| + | |||
| + | This should find the '' | ||
| + | |||
| + | > Try the '' | ||
| + | |||
| + | Now build the '' | ||
| + | |||
| + | gcc -o zpipe -I ~/ | ||
| + | |||
| + | > The **order** of the command line options and arguments is important | ||
| + | > The commands to //link// the library file must come **after** the commands to // | ||
| + | |||
| + | | ||
| + | If there are no errors and '' | ||
| + | |||
| + | You can test the new '' | ||
| + | |||
| + | ./zpipe < test > test.z | ||
| + | ./zpipe -d < test.z > test2 | ||
| + | cmp test test2 | ||
| + | |||
| + | There should be no difference between '' | ||
| + | |||
| + | ====Install zpipe==== | ||
| + | |||
| + | Now it is inconvenient that you have to always be in the '' | ||
| + | |||
| + | Install '' | ||
| + | |||
| + | cp zpipe ~/local/bin | ||
| + | | ||
| + | To make sure that the shell can find '' | ||
| + | |||
| + | export PATH=~/ | ||
| + | | ||
| + | Now you need only type '' | ||
| + | |||
| + | cd | ||
| + | zpipe --help | ||
| + | |||
| + | To make sure that each time you login that the '' | ||
| + | |||
| + | nano .bash_profile | ||
| + | | ||
| + | And add (or edit the existing line) to have: | ||
| + | |||
| + | PATH=$HOME/ | ||
| + | export PATH | ||
| + | |||
| + | |||
| + | ====References==== | ||
| + | |||
| + | * '' | ||
| + | * [[http:// | ||
| + | |||
| + | |||