SUIF2 installation notes

Development March 23rd, 2007

SUIF2 is the infrastructure for compiler development. If you want to develop a compiler in 2 weeks, SUIF2 may be a good choice for you, at least in SUIF2 documentation, it looks quite powerful and easy to extend.

Setup the working environment

The distance of the dream and reality makes our lives more colorful. The SUIF2 can not pass the compilation in modern C++, for exmaple GCC -4.1.1-r3 in my Gentoo. I googled and found there is literarlly NO success story to compile SUIF2 with GCC 3.x, let alone GCC 4.x. I do believe some graduate students have ported it to the latest GCC as in-house work, but nobody would like to share this work. Ok, let’s face the reality, since gcc 2.96 would mess up my Gentoo’s profile, I decided to install RedHat 7.0 on my old Pentium III box.

It took a little while to find the legacy ISO, but the install procedure was quite smooth, the ugly text installation wizard reminded me the time in my college, some Linux fans scratched heads to make X works. The bottom line is a Linux box with GCC 2.96 and SSH access.

Prepare the dependencies

Besides the dependency on gcc 2.96, SUIF2 also depends on the graphviz and gv for the graphics output. I could not find the RPM for graphviz due to the “RPM dependency hell” of RedHat. This is just the option. Let’s move on.

Build the SUIF2

Just follow this HOWTO.

cd /path/to/the/expected/destination/of/suif2
tar xvfz ~/tmp/basesuif-2.2.0-4.tar.gz
cd nci
patch -p1 < /path/to/patches/gcc296.patch
./install
make setup
make

Done.

NOTICE install would setup the $NCIHOME to the current working directory, you may override it after the build.

Test drive

Here is a canonical helloworld in $NCIHOME/bin, create_suif_hello_world. If the indented output is generated, the basic suif2 environment is setup correctly.

To invoke the SUIF2, you still need PGI C Compiler front end, pgcpp1. You could get it from the SUIF2 website. And you might need to setup the LD_LIBRARY_PATH to load all SUIF2 and pgcpp’s shared objects. In my case, SUIF2 is installed in $HOME/opt:

export PATH=$PATH:$HOME/opt/nci/bin
export LD_LIBRARY_PATH=$HOME/opt/nci/lib:$HOME/opt/nci/solib

Now, for a road test, just prepare a helloworld.c, and run

c2suif helloworld.c

If you get helloworld.suif, Bravo!

What is the next?

The suif output is for the machine to parse, not readable for men. So we might need to install extra viewer for SUIF2.

cd ../
wget http://suif.stanford.edu/pub/suif/extras-2.2.0-4.tar.gz
tar xvfz extras*.tar.gz
cd nci
make

Extras would install several viewer for .suif file, for example, suif2c helloworld.suif would generate helloworld.out.c to inspect.

HOWTO secure your Meebo?

Network March 8th, 2007

Meebo is a Web 2.0 application that supports several IM protocols, AIM, Yahoo, MSN and GTalk. It paves the way for user who are behind the firewall to communicate with the rest world. However, as other IMs, the conversation between you and your buddies are not encrypted via SSL for the sake of server overload. the private talk is more or less like broadcast to the IT staff. How to secure my Meebo talk?

We can use SSH tunnel to encrypt the conversation. The idea is we run a proxy server in the trusted remote machine, and bring the proxy port(for example, 3128) to local by using the ssh tunneling, then use the localhost:3128 as the web proxy for all the Meembo traffic.

A trusted remote machine

First, we need a remote machine that is trusted. You can use your PC at home, or donate 1$ to Silence is defeat to open a unix account.

NOTE: Silence is defeat shutdown the PayPal payment right now, the following method is verified in one Linux box at home.

Install the proxy server

Grab the latest version of squid, and build it.

wget http://www.squid-cache.org/Versions/v2/2.6/squid-2.6.STABLE10.tar.gz
tar xvfz squid-2.6.STABLE10.tar.gz
./configure –prefix=${HOME}
make && make install

You need to setup the squid before run it. Open ${HOME}/etc/squid.conf.example, uncomment the http_port directive, enable the access to all users, and save it to ${HOME}/etc/squid.conf

http_port 3128
http_access allow all

You might need to change the port number to one non-used port; the allow all policy is not that scaring, since squid is not running in privileged mode, port 3128 is not open to the outside, only local users can access the proxy service. Run the service for you:

${HOME}/sbin/squid

Tunnel it

You need an SSH client, (OpenSSH for Linux, Mac OSX, Putty for Windows). For Linux, Mac OSX users,

ssh -L 3128:your_host:3128  user_name@your_host

and keep this terminal open. For Windows user, here is an illustrated HOWTO.

Test it

Change the connection setting of your browser to localhost 3128. You are all done.
Bonus: all the browser session are secured by SSH, you could even surf the porn site without the notice of the IT department, just for kidding. :-)

PyAWS 0.1.0 released

Gentoo March 4th, 2007

PyAWS was ready for release for about one week. I just managed to squeeze some time to wrap up the package, develop the web site, and boom, it is released.

PyAWS is a Python wrapper for the latest Amazon Web Service, forked from the code base of pyamazon. This library is intentionally designed for an eBook management tool to fetch the meta data from Amazon. Well, the tool is still in blueprint, I would like to roll up the sleeves after the PyAWS is stable enough.

Currently, PyAWS only supports E-Commerce Service, I hope this library benefits to the community, at least the python developers do not need suffer from traversing the DOM tree any longer. Other services are still in the plan, and last but not the least, they are not free. Once I collect enough fund, or Amazon would grant me the free access to the premium services, I would start coding on that.

Thanks to Comix and feedparser, the Web site is shamelessly copied from the two.