Compiling Fortran-77 code in Ubuntu-16

Leave a comment

Fortran-77 is a very old code, who lives in 32-bit computer.

In Ubuntu-16, the compiler g++, gcc, or gfortran are “basically the same” (as far as I understand, correct me if I am wrong.) that they only support fortran-95.

In order to compile Fortran-77 code, I tried many way, but the only way is install g77 from external source, and add -m32 for the compiling flag.

The g77 compiler can be downloaded in here (I download from the web, If I violated some copy right, please let me know):

https://drive.google.com/file/d/0BycN9tiDv9kmR1dhUjZKS0tzTk0/view?usp=sharing

or, people can search in google by

 g77_x64_debian_and_ubuntu.tar.gz

 

people need to extract, change the mod of install.sh to be executable.

 tar -xzvf g77_x64_debian_and_ubuntu.tar.gz
 cd g77_x64_debian_and_ubuntu
 chmod +x ./install.sh
 ./install.sh

 

Somehow, you may face an error in apt-get, saying

Errors were encountered while processing:
g77-3.4-doc 

you can remove that by

cd /var/lib/dpkg/info
sudo rm g77-3.4-doc*
sudo dpkg --remove --force-remove-reinstreq g77-3.4-doc

Thanks (here)

Hope it help. :)


 

Auto mount hard disk on startup (ubuntu)

Leave a comment

ubuntu get the mounting list at

/etc/fstab

by editing this file, we can mount HD at startup.

First, we backup the fstab

$sudo cp /etc/fstab /etc/fstab.backup

Then, make an empty directory under /media

$sudo mkdir /media/XXX

Then find your hard disk

$sudo fdisk -l

for example, in my computer:

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b1af1

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 920002047 460000000 83 Linux
/dev/sda2 920002558 976771071 28384257 5 Extended
/dev/sda5 920002560 976771071 28384256 82 Linux swap / Solaris

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000d9f50

Device Boot Start End Blocks Id System
/dev/sdb1 63 390732929 195366433+ 7 HPFS/NTFS/exFAT
/dev/sdb2 390732930 976768064 293017567+ 7 HPFS/NTFS/exFAT

we can see i have 2 hard disks, the first one is system. we can see them at /dev. We want to mount /dev/sdv1, which is ntfs format.

Then edit fstab. Open the fstab, we add  a line at the end

/dev/sdb1        /media/XXX   ntfs   rw,nouser,auto    0   0

That is! for detail of that, please refer to https://help.ubuntu.com/community/Fstab . to test it, just type in the terminal

#sudo mount -a

If everything is ok, then you can see the drive appear on desktop. Now you are safe to restart and see the effect.

However, if there is a problem. DON’T RESTART!! and recover from the backup.

installing ROOT

Leave a comment

ROOT is a data analysis program developed by CERN.

Here i will explain a easy way to get root running on Ubuntu 10.04 and Mac OSX. this is NOT an installation, so, the path of the folder is important. don’t move.

first download the source file from the root website. then unzip it. inside the directory.

./configure --help

to identify the architecture of your machines, for me, i am on ubuntu with intel core i5. thus

./configure linuxx8664gcc --with-fftw3-incdir=/usr/local/lib

the –with, is link to the FFTW library. by unknown reason, i installed FFTW but the configure cannot find it, so i have to tell it. you can check the path just after you install the FFTW.

sudo make

after that, you should run

. bin/thisroot.sh

this link the library, then you can run root anywhere by

root

if you experience that you have to type “. bin/thisroot.sh” every time to get root running, then you can edit ~/.bashrc. (nano ~/.bash) add this anywhere:

#ROOT configuration
cd ~/root-5.30
. bin/thisroot.sh
cd

since the terminal will run ~/.bashrc on startup, so, this code will call the root. now, you can run root everytime and anywhere while you started terminal.

for Mac OSX the command line is:

./configure macosx64
sudo make

In Mac OSX, the ~/.bashrc is not there by default. and the terminal may run /etc/bashrc intead of ~/.bashrc even you created it. so, edit /etc/bashrc by

sudo nano /etc/bashrc

install gnuplot

Leave a comment

on Mac, install gnuplot has no difficulty. download the source code, unzip it. open terminal, go to the unzipped folder, and type.

./configure
sudo make
make install

the command ./configure is checking your system, see weather there are required libraries to run the gnuplot. after the ./configure, it will show you the installation configuration. make is build up the installation component, then install.

in Ubuntu, the process is the same. however, since Ubuntu does not has build in X11 terminal, which is used to real time display. the following command will install X11 terminal.

sudo apt-get install libx11-dev

After install the X11 terminal, run the ./configure again and you can see the X11 is enabled.