Uncategorized
Installing f2c on a mac
Posted in Uncategorized on February 20th, 2009 by Hamish Rickerby – CommentsI have recently had to install f2c on my mac to convert Fortran to C code – for the gory details about this library check http://www.netlib.org/f2c/f2c.pdf
Also, don’t ask why I’m installing this – lets just say there is some maths that needs doing, and fortran has the libraries to help with it.
The installation process on the mac isn’t really catered for with the package, and it’s not available via macports. I found an install script at http://hpc.sourceforge.net/buildf2c but I found it doesn’t work as advertised.
Below is a fixed version of this script – hope this helps someone. This will download the source as well as build and install it.
#!/bin/sh ############################################################ # This UNIX script builds the f2c FORTRAN --> C translator # # under Mac OS X. # # Make this script executable with "chmod +x buildf2c" # ############################################################ echo "===================================" echo "Build f2c FORTRAN --> C translator." echo "===================================" echo "USAGE: ./buildf2c" ###################################### # Set trap to allow abort on signal: # ###################################### trap 'echo "Interrupted by signal" >&2; exit' 1 2 3 15 ######################################################## # 1. Download f2c source from Bell Labs. # # (Tar file is not visible - it's created on the fly.) # ######################################################## echo "--------------------------------------------" echo "1. Downloading f2c source from Bell Labs ..." echo "--------------------------------------------" # wget --passive-ftp ftp://netlib.bell-labs.com/netlib/f2c.tar curl http://netlib.sandia.gov/cgi-bin/netlib/netlibfiles.tar?filename=netlib/f2c -o "f2c.tar" echo "... done." ##################################### # 2. Uncompress f2c tarred archive: # ##################################### echo "-------------------------------" echo "2. Uncompressing f2c source ..." echo "-------------------------------" tar -xvf f2c.tar gunzip -rf f2c/* cd f2c mkdir libf2c mv libf2c.zip libf2c cd libf2c unzip libf2c.zip cd ../.. echo "... done." ############################################################### # 3. Prepare the unix makefiles for building the f2c library. # # Note: CC compiler switched from 'cc' to '/usr/bin/cc' # ############################################################### echo "-------------------------------------------" echo "3. Preparing makefiles for building f2c ..." echo "-------------------------------------------" sed 's/CC = cc/CC = \/usr\/bin\/cc/' f2c/libf2c/makefile.u > f2c/libf2c/makefile sed 's/CC = cc/CC = \/usr\/bin\/cc/' f2c/src/makefile.u > f2c/src/makefile echo "... done." ########################################## # 4. Create and install f2c header file. # # If you use a C++ compiler: make hadd # # Otherwise: make f2c.h # ########################################## echo "----------------------------------------------------" echo "4. Creating and installing f2c header file f2c.h ..." echo "----------------------------------------------------" cd f2c/libf2c make f2c.h if test ! -d /usr/local/include; then mkdir -p /usr/local/include fi cp f2c.h /usr/local/include/ echo "... done." ################################################ # 5. Create and install f2c library "libf2c.a" # ################################################ echo "-----------------------------------------------------" echo "5. Creating and installing f2c library "libf2c.a" ..." echo "-----------------------------------------------------" make if test ! -d /usr/local/lib; then mkdir -p /usr/local/lib fi cp libf2c.a /usr/local/lib/ ranlib /usr/local/lib/libf2c.a echo "... done." ###################################### # 6. Make executable f2c translator: # ###################################### echo "---------------------------------------------" echo "6. Creating and installing f2c translator ..." echo "---------------------------------------------" cd ../src make if test ! -d /usr/local/bin; then mkdir -p /usr/local/bin fi cp f2c /usr/local/bin/ ln -s /usr/local/bin/f2c /bin/f2c echo "... done." ################################################################ # 7. Install fc script: # # # # 1. Remove "-Olimit 2000" in the -O processing options within # # the 'fc' script. # # 2. Eliminate all references to the math library (-lm) in # # the script 'fc' since it is included the System framework # # and is linked by default under Mac OS X. # # 3. Eliminate '-u MAIN__' at the bottom of the 'fc' script. # # You will have to explitly load FORTRAN MAIN programs # # (explicitly mention the relevant .f or .o file). # ################################################################ echo "---------------------------" echo "7. Installing fc script ..." echo "---------------------------" cd .. mv fc fc.orig sed 's/ -Olimit 2000//g; s/ -lm//g; s/ -u MAIN__//g' fc.orig > fc chmod +x fc cp fc /usr/local/bin/ ln -s /usr/local/bin/fc /bin/fc ln -s /usr/local/bin/fc /bin/f77 echo "... done." ######################### # 8. Install man pages: # ######################### echo "---------------------------" echo "8. Installing man pages ..." echo "---------------------------" cp f2c.1t /usr/share/man/man1/f2c.1 echo "... done." ################ # 9. Clean up: # ################ echo "------------------" echo "9. Cleaning up ..." echo "------------------" cd src make clean cd ../libf2c make clean cd ../.. echo "... All done!" ############################################# # 10. Test f2c on your FORTRAN source code: # ############################################# echo "======================================================" echo "======================================================" echo "======================================================" echo " === To test f2c on your FORTRAN source code: ===" echo " === cd ~/wherever/your/code/is ===" echo " === 1. f2c myprog.f ===" echo " === cc -O -o myprog.exe myprog.c -lf2c ===" echo " === myprog.exe ===" echo " === 2. fc -O -w -o myprog.exe myprog.f ===" echo " === myprog.exe ===" echo "======================================================" echo "======================================================" echo "======================================================" exit
Zazzle discount vouchers / codes
Posted in Uncategorized on December 27th, 2008 by Hamish Rickerby – CommentsI received a package I ordered from Zazzle today and it contained some discount vouchers that I won’t be using. Codes below – tell me if they don’t work so I can update the post to show they are gone.
- $10 (USD I assume) orders of over $10 or more – expiring 31st Dec 2008 – ZAZZLE10GIFTAYJTRYRM and ZAZZLE10GIFTDFWCINBI
- $5 off purchase of $50 or more (I reckon this is multi-use) expiring 18th Jan 2009 – ZAZZLEWINTER
Enjoy!
Car tries to climb fence in Reading
Posted in Uncategorized on December 10th, 2008 by Hamish Rickerby – CommentsSick
Posted in Uncategorized on January 8th, 2007 by Hamish Rickerby – CommentsI’m off work sick today. It really hit me yesterday, I was feeling so crappy last night, and today is sort of on par, but I get the sense I’m getting better. Although this does give me the opportunity to catch up on some feeds that I haven’t looked at in a bit.
I seem to be sneezing a lot, and have runny nose, and a headache, and blocked sinuses. I put getting sick down to my last couple of weeks of drinking a lot, not eating well and not sleeping much. I think being generally run down has taken its toll on my immunity, and now I’m paying the price.
I wonder if I’ll ever learn.
I got back in touch…
Posted in Uncategorized on October 27th, 2006 by Hamish Rickerby – Comments…with a friend from New Zealand a couple of days ago. I hadn’t heard from or seen him since October 2006, and it was good to hear from him. I had to do some digging as I had an old email address, but I found a newer one and things are good.
ALSO, I’m going to London tonight (assuming I’m feeling better by mid afternoon) to see a couple of old friends. One I saw about 6 or so weeks ago, but one I haven’t seen in nearly 7 years. It’ll be cool to catch up with her again.
I really like finding out what people are up to, I think I might have to keep on top of this goal, recontacting people, restablishing friendship – it’s great.
Grrrrr.
Posted in Uncategorized on July 18th, 2006 by Hamish Rickerby – CommentsI had a bad experience with a plumber. In short, he replaced parts of a hot water cylinder that weren’t busted, and left me with no hot water after working at my place for over 4 hours. I’ve been getting statements from them saying it’s overdue, I’ve called them twice, and they’ve said both times they’ll get the manager to call me back, and they haven’t. So, I’m writing a letter, with the help of my editing staff and I’ll get my parents to post it (as I’m no longer in the country).
Anyway, if you are in NZ I recommend AGAINST using Mr Plumber

