The developers of PCC (the Portable C compiler) released version 1.1.0 of the compiler and compiler library, so I decided to give it a run on my computer.
Source packages are available at ftp://pcc.ludd.ltu.se/pub/pcc/. To get a working compiler, one needs to build both pcc and pcc-libs. I followed the instructions for earlier versions of Ubuntu, with some modifications.
First, for uniformity reasons, everything will be installed in /usr instead of the default /usr/local. All libs go to /usr/lib instead of libexec. So, the ‘configure’ command looks like
./configure --prefix=/usr --libexecdir=/usr/lib.
for both packages. The order probably does not matter. I started with ‘pcc’. If ‘flex’ and ‘bison; are missing, the ‘configure’ script will not complain, but the build will fail. So we need to ‘sudo apt-get install flex bison’ before going any further. Compilation is lightning fast, but you can accelerate it a bit by using
make -j[number of cpu cores/threads]
Next, we install the compiled files to their places under /usr. Instead of doing ‘sudo make install’ I did ‘sudo checkinstall’.
The install of ‘pcc’ failed because of a conflict in /usr/share/man/man1/cpp.1, so I had to rename the man file and repackage the deb (here is a good guide).
The install of ‘pcc-libs’ went smoothly, but when trying to build a helloworld.c, pcc executable complained about not finding ‘crt1.o’ and ‘crti.o’. It turned out that it’s a well-known problem not yet solved in 1.1.0 (see discussion here). I just copied these files (together with ‘crtn.o’) from /usr/lib/i386-linux-gnu to /usr/lib/pcc/i686-pc-linux-gnu/1.1.0/lib, and repackaged this deb, too.
To add the final touch, I rebuilt both packages with ‘pcc’ instead of ‘gcc’ (by passing
CC=pcc to the ‘configure’ scripts). Here are the packages for i386:
And here are the packages for amd64:
* * *
Follow-up posts on this topic: