Archive for the ‘unix’ Category

Running the Mosaic Browser on a Modern Linux
March 30, 2012

Yesterday I got inspired by the 18th Anniversary of Philippine Internet and Netscape running on an old computer. I decided to try Mosaic on my Linux box. Mosaic, the predecessor of Netscape and so many other browsers.

Here is how I built it on Ubuntu Precise Pangolin (12.10) beta 64-bit:

  • Downloaded the modernized Mosaic source code. The PNG patch is no longer available.
  • Installed dependencies: sudo apt-get install libmotif-dev libxmu-dev libjpeg-dev libgd2-xpm-dev
  • Manually downloaded and compiled lpng1058.tar.bz2from http://libpng.sourceforge.net . Good thing the old PNG libraries compatible with old source are still being maintained.
  • Renamed the definitions ofgetline in ./libnut/url-utils.h ./libnut/url-utils.c ./libwww2/HTInit.c . It is already present in the standard C library.
  • Compiled with make linux.
  • The compile will have warnings about assigning pointers (64-bit) to int. While this is dangerous, it doesn’t stop this Mosaic from running – but it does segfault for some pages. It might be better on a 32-bit machine.
  • The link will fail because the current libpng does not have the deprecated function png_read_init. Instead, copy paste the gcc -o Mosaic line and replace the -lpng with the compiled libpng.a. Also include the system’s libm.a (in my case, /usr/lib/x86_64-linux-gnu/libm.a) since libpng.a is statically compiled. Otherwise, the link will fail with undefined reference to `pow’.

Then, run ./Mosaic. It will have errors like Warning: Cannot convert string “-adobe-courier-medium-r-normal-*-14-*-*-*-*-*-iso8859-1” to type FontStruct which don’t seem to prevent it from running.

On some sites, I get a core dump. I think it’s because the code was linked against the current libpng.h, but I don’t have time to investigate it. Take a look!

libpng warning: Application was compiled with png.h from libpng-1.0.6 or earlier
libpng warning: Application  is  running with png.c from libpng-1.0.58
libpng error: The png struct allocated by the application for reading is too small.