Compiling the EMC2 simulator on an old Red Hat 8 Box.
I wanted to have an emc simulator running on my old rh8 box.
As everything was out of date, I had to compile more than 25 packages, and there was many pitfalls to avoid.
Here are the lessons learned.
Shared libraries
The biggest problem comes from the shared libraries.
When you compile a package, it is usually installed in /usr/local with its libraries in /usr/local/lib.
But at runtime, the libraries are often loaded from other directories. And as there are older packages lying around, the wrong one is always picked up :(.
So ldd is your friend.
For each shared library installed in /usr/local/lib, check it with ldd. for example:
There, libXft.so uses the original libexpat.so lib, but a new libXrender.so
The classical symptom of using a wrong library is some undefined symbols...
Do not forget to edit /etc/ld.so.conf; especially add to it "/usr/local/lib".
Run ldconfig each time you install a package. As it is very easy to forget that, I put it in a makefile. But as ldconfig requires root privileges, I have put it setuid: "# chmod +s /sbin/ldconfig". Beware of security implications...
Old versions
You will need to remove old packages that go in your way. I found that creating a directory "old" in "/usr/include", "/usr/lib" and "/usr/bin", and moving the offending files in it was convenient. This allows, if you made a mistake, ro revert back your changes. Don't forget to ldconfig...
Packages versions and order of compilation
Many packages are dependant upon some package having a certain version. This is mostly trial and error...
Also, if you recompile a package, you must usually recompile all the other ones depending upon it. This can be rather lengthy.
Compilation steps
*Create a directory "gtk" and download the following in it (Google is your friend...):
pkg.ok:
cd $(PKG); make uninstall
cd $(PKG); make distclean
cd $(PKG); ./configure --enable-shared --enable-static
cd $(PKG); make
cd $(PKG); make install
/sbin/ldconfig
touch pkg.ok
LIBICONV=libiconv-1.11
libiconv.ok: pkg.ok
cd $(LIBICONV); make uninstall
cd $(LIBICONV); make distclean
cd $(LIBICONV); ./configure --enable-shared --enable-static
cd $(LIBICONV); make
cd $(LIBICONV); make install
/sbin/ldconfig
touch libiconv.ok
GETTEXT=gettext-0.16
gettext.ok : libiconv.ok pkg.ok
cd $(GETTEXT); make uninstall
cd $(GETTEXT); make distclean
cd $(GETTEXT); ./configure --enable-shared --enable-static
cd $(GETTEXT); make
cd $(GETTEXT); make install
/sbin/ldconfig
touch gettext.ok
XPROTO=xproto-7.0.11
xproto.ok: pkg.ok
cd $(XPROTO); make uninstall
cd $(XPROTO); make distclean
cd $(XPROTO); ./configure --enable-shared --enable-static
cd $(XPROTO); make
cd $(XPROTO); make install
/sbin/ldconfig
touch xproto.ok
RENDERPROTO=renderproto-0.9.3
renderproto.ok: pkg.ok
cd $(RENDERPROTO); make uninstall
cd $(RENDERPROTO); make distclean
cd $(RENDERPROTO); ./configure --enable-shared --enable-static
cd $(RENDERPROTO); make
cd $(RENDERPROTO); make install
/sbin/ldconfig
touch renderproto.ok
XRENDER=libXrender-0.9.4
xrender.ok: pkg.ok renderproto.ok libiconv.ok
cd $(XRENDER); make uninstall
cd $(XRENDER); make distclean
cd $(XRENDER); ./configure --enable-shared --enable-static
cd $(XRENDER); make
cd $(XRENDER); make install
/sbin/ldconfig
touch xrender.ok
FREETYPE=freetype-2.3.5
freetype.ok: pkg.ok libiconv.ok
cd $(FREETYPE); make uninstall
cd $(FREETYPE); make distclean
cd $(FREETYPE); ./configure --enable-shared --enable-static
cd $(FREETYPE); make
cd $(FREETYPE); make install
/sbin/ldconfig
touch freetype.ok
LIBXFT=libXft-2.1.12
libxft.ok: pkg.ok xproto.ok libiconv.ok freetype.ok
cd $(LIBXFT); make uninstall
cd $(LIBXFT); make distclean
cd $(LIBXFT); ./configure --enable-shared --enable-static
cd $(LIBXFT); make
cd $(LIBXFT); make install
/sbin/ldconfig
touch libxft.ok
FONTCONFIG=fontconfig-2.4.2
fontconfig.ok: pkg.ok libiconv.ok freetype.ok
cd $(FONTCONFIG); make uninstall
cd $(FONTCONFIG); make distclean
cd $(FONTCONFIG); ./configure --enable-shared --enable-static
cd $(FONTCONFIG); make
cd $(FONTCONFIG); make install
/sbin/ldconfig
touch fontconfig.ok
MESA=Mesa-7.0.1
mesa.ok: pkg.ok libiconv.ok xrender.ok libxft.ok
cd $(MESA); make realclean
cd $(MESA); make linux-x86
cd $(MESA); make install
/sbin/ldconfig
touch mesa.ok
PNG=libpng-1.2.8
libpng.ok: pkg.ok libiconv.ok
cd $(PNG); make clean
cd $(PNG); cp scripts/makefile.linux Makefile
cd $(PNG); make
cd $(PNG); make install
/sbin/ldconfig
touch png.ok
JPEG=jpeg-6b
jpeg.ok: pkg.ok libiconv.ok
cd $(JPEG); make distclean
cd $(JPEG); ./configure --enable-shared --enable-static
cd $(JPEG); make
cd $(JPEG); make install
/sbin/ldconfig
touch jpeg.ok
TIFF=tiff-3.7.4
tiff.ok: pkg.ok libiconv.ok jpeg.ok
cd $(TIFF); make uninstall
cd $(TIFF); make distclean
cd $(TIFF); ./configure --enable-shared --enable-static
cd $(TIFF); make
cd $(TIFF); make install
/sbin/ldconfig
touch tiff.ok
GLIB=glib-2.12.13
glib.ok: pkg.ok libiconv.ok
cd $(GLIB); make uninstall
cd $(GLIB); make distclean
cd $(GLIB); ./configure --enable-shared --enable-static --with-libiconv=gnu
cd $(GLIB); make
cd $(GLIB); make install
/sbin/ldconfig
touch glib.ok
CAIRO=cairo-1.2.6
cairo.ok: pkg.ok libiconv.ok glib.ok png.ok jpeg.ok tiff.ok mesa.ok
cd $(CAIRO); make uninstall
cd $(CAIRO); make distclean
cd $(CAIRO); ./configure --enable-shared --enable-static
cd $(CAIRO); make
cd $(CAIRO); make install
/sbin/ldconfig
touch cairo.ok
POPPLER=poppler-0.5.9
poppler.ok: pkg.ok libiconv.ok cairo.ok fontconfig.ok
cd $(POPPLER); make uninstall
cd $(POPPLER); make distclean
cd $(POPPLER); ./configure --enable-shared --enable-static --enable-cairo-output
cd $(POPPLER); make
cd $(POPPLER); make install
/sbin/ldconfig
touch poppler.ok
PANGO=pango-1.16.4
pango.ok: pkg.ok libiconv.ok cairo.ok poppler.ok fontconfig.ok
cd $(PANGO); make uninstall
cd $(PANGO); make distclean
cd $(PANGO); ./configure --enable-shared --enable-static
cd $(PANGO); make
cd $(PANGO); make install
/sbin/ldconfig
touch pango.ok
ATK=atk-1.9.1
atk.ok: pkg.ok libiconv.ok cairo.ok pango.ok
cd $(ATK); make uninstall
cd $(ATK); make distclean
cd $(ATK); ./configure --enable-shared --enable-static
cd $(ATK); make
cd $(ATK); make install
/sbin/ldconfig
touch atk.ok
GTK=gtk+-2.10.13
gtk.ok: pkg.ok libiconv.ok atk.ok
cd $(GTK); make uninstall
cd $(GTK); make distclean
cd $(GTK); ./configure --enable-shared --enable-static
cd $(GTK); make
cd $(GTK); make install
/sbin/ldconfig
touch gtk.ok
*The first time, build each package by hand in the order of the Makefile.
For each package, do a configure..., make, make install, ldconfig, and check
that the generated libraries use the packages installed before, and not the old ones!
I had also to create by hand "/usr/local/lib/pkgconfig/x11.pc":
TCL=tcl8.4.15/unix
tcl.ok:
cd $(TCL); make distclean
cd $(TCL); ./configure --enable-shared --enable-static
cd $(TCL); make
cd $(TCL); make install
/sbin/ldconfig
touch tcl.ok
TK=tk8.4.15/unix
tk.ok: tcl.ok
cd $(TK); make distclean
cd $(TK); ./configure --enable-shared --enable-static
cd $(TK); make
cd $(TK); make install
/sbin/ldconfig
touch tk.ok
PYTHON=Python-2.4.4
python.ok: tcl.ok tk.ok ../sources/gtk/gtk.ok
cd $(PYTHON); make distclean
cd $(PYTHON); ./configure --enable-shared --enable-static
cd $(PYTHON); make
cd $(PYTHON); make install
/sbin/ldconfig
touch python.ok
EMC=emc2.1/src
emc.ok: python.ok
cd $(EMC); make clean
cd $(EMC); ./configure --enable-simulator --enable-run-in-place --with-python=/usr/local/bin/python2.4 --with-tclConfig=/usr/local/lib/tclConfig.sh --with-tkConfig=/usr/local/lib/tkConfig.sh
cd $(EMC); make
/sbin/ldconfig
touch emc.ok
and proceed as before up to the point where you have a working python 2.4
if all went well, goto <tt>emc2.1/src, and start it:
$ ../scripts/emc ../configs/sim/axis.ini