Redhat8Install - rmu75/linuxcnc-wiki GitHub Wiki


date: '2009-06-21T15:51:41' title: Redhat8Install

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:

$ ldd libXft.so
libfontconfig.so.1 => /usr/local/lib/libfontconfig.so.1 (0x4001f000)
libfreetype.so.6 => /usr/local/lib/libfreetype.so.6 (0x40053000)
libXrender.so.1 => /usr/local/lib/libXrender.so.1 (0x400ba000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x400c2000)
libc.so.6 => /lib/i686/libc.so.6 (0x42000000)
libexpat.so.0 => /usr/lib/libexpat.so.0 (0x401a0000)
libz.so.1 => /usr/lib/libz.so.1 (0x401c0000)
libdl.so.2 => /lib/libdl.so.2 (0x401cf000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

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...):

MesaDemos-7.0.1.tar.gz
MesaGLUT-7.0.1.tar.gz
MesaLib-7.0.1.tar.gz
atk-1.9.1.tar.bz2
cairo-1.2.6.tar.gz
fontconfig-2.4.2.tar.gz
freetype-2.3.5.tar.gz
gettext-0.16.tar.gz
glib-2.12.13.tar.gz
gtk+-2.10.13.tar.gz
jpegsrc.v6b.tar.gz
libXft-2.1.12.tar.gz
libXrender-0.9.4.tar.gz
libiconv-1.11.tar.gz
libpng-1.2.8.tar.bz2
pango-1.16.4.tar.gz
pkg-config-0.21.tar.gz
poppler-0.5.9.tar.gz
renderproto-0.9.3.tar.gz
tiff-3.7.4.tar.gz
xproto-7.0.11.tar.gz

*Uncompress and untar all.

*Create the following Makefile

all: gtk.ok

PKG=pkg-config-0.21

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":
prefix=/usr/X11R6
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

xthreadlib=

Name: X11 Description: X Library Version: 0.0 Requires: Requires.private: Cflags: -I${includedir} Libs: -L${libdir} -lX11 Libs.private:

to keep pkgconfig and configure happy.

  • When all of that is done, you will have a working GTK package. Create another directory named "emc" and get the following:
BWidget-1.8.0.tar.gz
Python-2.4.4.tgz
tcl8.4.15-src.tar.gz
tk8.4.15-src.tar.gz
  • Then create the following "Makefile":
all: emc.ok

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

  • Good luck :)

⚠️ **GitHub.com Fallback** ⚠️