Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1199801
  • 博文数量: 49
  • 博客积分: 10237
  • 博客等级: 上将
  • 技术积分: 2764
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-02 16:19
个人简介

满随天外云卷云舒 静观庭前花开花落

文章分类

全部博文(49)

文章存档

2013年(18)

2012年(9)

2011年(1)

2010年(5)

2009年(3)

2008年(13)

分类: LINUX

2013-06-19 09:39:33


Alas some of the wave propagation codes I use on my v10.04 and v11.10 Ubuntu Linux systems require the outdated g77 compiler.

However, g77 is no longer being maintained and was last made to support GCC 3.4.  More recent Ubuntu versions use GCC 4.X and so dropped g77 from their default package manager lists.  Took a little bit to figure out how to get the relevant stuff installed and working on these computers, as I still needed the GCC 4.X for other content on the machines.  Here's what I did:

The overall summary is, to get g77 and its libraries you have to temporarily modify an apt-get repository list file, install g77 (which automatically also installs its GCC 3.4 dependencies which won't interfere with your gcc 4.x), and then set the repository file back to its original state.  Also, there's an additional little fix to install g77 in Ubuntu 11.10 that wasn't in Ubuntu 10.04 (I haven't tried the versions of Ubuntu in between): a few libs moved location, so you simply use an environment variable to tell g77 where they are.  Steps detailed below:

sudo vi /etc/apt/sources.list, then append the following lines to end of file:

## temporarily adding these to install G77 which is no longer supported:

deb hardy universe

deb-src hardy universe

deb hardy-updates universe

deb-src hardy-updates universe

sudo aptitude update

sudo aptitude install g77 blcr-dkms: blcr-util: dkms: fakeroot: libcr0: libibverbs-dev: openmpi-common:

(Those entries with colons afterward prevent those packages from being removed to match the outdated setup, which we don't wish to do)

sudo vi /etc/apt/sources.list again and comment out those above lines at end of file.

sudo aptitude update

If you're running Ubuntu 11.10 (but this is not needed for 10.04; I don't know about versions in between, the error is about finding libs crt1.o, crti.o and lgcc_s):

Before running make (or g77 in general) you'll need to enter the following line in your shell (note this is bash style here, mod as needed for other shells):

#export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:/usr/lib/gcc/x86_64-linux-gnu/4.6 (it does not work for my ubuntu 11.10.this solution from another website)

export LIBRARY_PATH=/usr/lib/i386-linux-gnu:/usr/lib/gcc/i686-linux-gnu/4.6

 (this is my solution for my computer,please check your path to the gcc and crt1.o, crti.o, crtn.o )


(Note that is not the more common variable LD_LIBRARY_PATH...)

If you plan to do a lot of g77 compiles you might wish to add that LIBRARY_PATH line to your ~/.bashrc file, but for just one or two compiles I personally choose not to do so.

Note that executables made with this g77 may rely by default on shared object libraries of g77/gcc 3.4, so if you copy your executable over to other modern Linux systems (say another 10.04 or 11.10 box -- e.g. I use mine in a cluster), you may get a runtime error about shared object files.  The solution is to install g77 on that other system as well by the same instructions above, so that the shared object files exist.  It goes pretty quickly after the first time.

阅读(4013) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~