Thursday, August 20, 2009

g77 in Ubuntu Linux

We need to use g77 compiler rather than gfortran on modern Linux distribution. However, g77 is replaced by gfortran in modern gcc package.

According to "build g77 from source" in gfortran.org, we need to build one from older version of gcc: v3.4.6

Our environment is Ubuntu 9.04(jaunty), gcc 4.3.3

※ Install g77



Get "gcc-3.4.6.tar.gz" into a folder, and then key in
tar xvzf gcc-3.4.6.tar.gz
mkdir bin
mkdir run
cd bin
../gcc-3.4.6/configure --enable-languages=c,f77 --disable-checking --prefix=$HOME/g77/run
make CC=/usr/bin/gcc
make install


Then g77 compiler should be $HOME/g77/run/bin/g77


★ However, in this command:
make CC=/usr/bin/gcc
may encounter error message:

In function 「open」,
inlined from 「collect_execute」 at ../../gcc-3.4.6/gcc/collect2.c:1537:
/usr/include/bits/fcntl2.h:51: 錯誤: call to 「__open_missing_mode」 declared with attribute error: open with O_CREAT in second argument needs 3 arguments
make[1]: *** [collect2.o] Error 1
make[1]: Leaving directory `/home/cjclab/g77-3.4.6/bin/gcc'
make: *** [all-gcc] Error 2

solution is changing one line in $HOME/g77/gcc-3.4.6/gcc/collect2.c
from
redir_handle = open (redir.0_WRONLY | 0_TRUNC | 0_CREAT);)
to
redir_handle = open (redir.0_WRONLY | 0_TRUNC | 0_CREAT,0777);)


similar post ref here

※ using g77 to compile



When compiling with g77, you must add -static parameter to avoid link to libg2c0/libg2c.so.0. For example, compile test.f and turn into test.out:
$HOME/g77/run/bin/g77 -static test.f -o test.out

otherwise, you may encounter error message like this:

./test.out: error while loading shared libraries: libg2c.so.0: cannot open shared object file: No such file or directory



p.s. We were tring to compile CNS(Crystallographic/NMR Refinement Software), but actually in CNS version 1.21, binary installation is provided, so no need to compile by ourselves.

Monday, August 10, 2009

Linux sound setting(CMI8738)

Sound Card: C-Media CMI8738
OS: Ubuntu Linux 9.04

When running the browser(firefox), the music player(totem) have no sound; on the other hand, when running the music player, the flashplayer in the browser(ex. YouTube) have no sound.

Only one will work at a time.

solution:


change the sound properties(gnome-sound-properties) all to "ALSA (Advanced Linux Sound Architecture)" not those "C-Media CMI8738 ...." and I set "default mixer channel" as "C-Media CMI8738(Alsa mixer)".

Saturday, August 1, 2009

CCP4: database access failure

When opening the CCP4 program, it alerts "DatabaseLock", "Each project database file can only be opened by one CCP4I at a time." like below:
DatabaseLock

When running the project, it alerts "Database Access Failure", "This instance of CCP4i no longer has control of the current database." like below:
Database Access Failure

Over the whole internet, there is only one page giving suggestion to solve this problem: delete ccp4.LOCK. However, it is not helpful by deleting the similar file called "database.LOCK".

The helpful solution is: Delete the folder "CCP4_DATABASE", which is in the project folder and contains the file "database.LOCK". The program shall create a new one automatically and every thing may be fine.

solved by x4base.

Wednesday, June 24, 2009

stop X window

stop X Window on Ubuntu Linux:

sudo /etc/init.d/gdm stop

ex. before manually install NVIDIA video card driver. Chinese Ref here.

Tuesday, June 23, 2009

template setup

Background images in this template are taken from

http://www.blogskins.com/info/108732
Notebook look [[dg]]
Contributed by: sigurros on September 9th, 2006 at 3:18 am


This template is based on Blogger default template "Minima", created by Douglas Bowman, with css style changes below:


body{
background-color: #ffffff;
background-image: url('http://img34.imageshack.us/img34/9100/botninnbl4.jpg');
...
}

#outer-wrapper {
background: url(http://img34.imageshack.us/img34/2130/headerinnyb1.jpg) no-repeat;
height: 700px;
top: 0px;
left: 0px;
.......
}

#header-wrapper{
position: absolute;
top: 170px;
left: 560px;
width: 510px;
z-index: 2;
height: 174px;
}
#main-wrapper{
position: absolute;
top: 280px;
left: 560px;
width: 510px;
z-index: 2;
height: 174px;
line-height: 21.5px;
}

#sidebar-wrapper{
position:absolute;
top: 263px;
left: 290px;
width: 230px;
z-index: 2;
padding: 2px;
}

#sidebar-wrapper .ul{
line-height: 21.5px;
}


After all, create a template from scratch is a nightmare...
Special thanks to the Blogger structure figure from ref here.