Difference between revisions of "CompilingRHEL"

From Inkscape Wiki
Jump to navigation Jump to search
(Added info about correctly configuring gc. otherwise inkscape cannot compile)
(removed - outdated)
Line 1: Line 1:
= Building Inkscape on RHEL4 =

This page documents the process I used to build Inkscape 0.47 on Red Hat Enterprise Linux, Version #4 (RHEL4.)
Many consider RHEL4 to be an archaic operating system.<br>
I prefer to view it as mature, stable and predictable. <tt>:-)</tt>
I do not believe there is much about this procedure which is specific to RHEL4.<br>
It would probably work on any good Linux installation.
I performed this process on 19-FEB-2010 so this information is
already out of date.
--[[User:Wcrocke|Bill Crocker]]
= Motivation =
The company I work for is not free to run the latest OS versions.
We are constrained by our major application vendors.
That leaves us stuck on RHEL4,
which appears to come bundled with Inkscape 0.44
Meanwhile I'm watching all sorts of cool Inkscape tutorials on the web, but
they use later versions.
My sys-admins would not consider an
Inkscape upgrade due to the contamination issue noted below.
The build process documented here avoids system installs
by using a local install directory.
This is an old-school build as I download and compile source code
and do not use any RPMs.
= List of packages =
Following is the list of packages I used.
Compiling this list was no small feat
and took over 15 hours. I consider it a miracle I
was able to converge on a compatible set of packages and compiler.
The packages are listed here in the order in which I built them.
Some packages, like gc6.8,
have no dependencies and could be built at any time.
The pango-1.24.5 package, on the other hand, requires cairo-1.8.8
and so must be built after the cairo package.
Not all of the packages listed here are the latest versions
available at the time I performed the build.
In several cases I had to back off one or two years because my
compiler (gcc 3.4.4) did not like the more recent versions.
{| class="wikitable" border="0" cellpadding="0" cellspacing="0" style="font-family:Courier"
Please do not change any of these package numbers without confirming a compatible set.
= Do not contaminate your computer =
I recommend that you use a local installation directory
instead of installing packages in the standard system directories.
When you add new files (or replace existing) files
in system directories you are effectively contaminating
the computer. Programs that used to work may not work any longer
and you may not realize that harm has been not until
the trail has grown cold. (We have all had this happen,
especially on Windows; You go to run some program and it
does not work any more.)
Certainly, if you are experimenting, this is the right move.
Also, you do not need sudo or the root password.
= Build directory layout =
Pick an empty directory in which to download
and build all packages.
In addition to a separate build directory for each package,
add one additional sub-directory to server as the
installation point.
The package directories will be created when you de-tar the
= Preparing your shell environment =
The following assumes that your root build directory
is <tt>"/home/me/inkscape"</tt> and that it has a sub-directory
named <tt>"install"</tt> which will serve as the installation point.
:setenv INSTDIR "/home/me/inkscape/install"
:setenv CXXFLAGS "-I${INSTDIR}/include"
:setenv CPPFLAGS "-I${INSTDIR}/include"
:setenv LDFLAGS "-L${INSTDIR}/lib -lm"
:setenv PKG_CONFIG_PATH "${INSTDIR}/lib/pkgconfig"
:setenv PATH "${INSTDIR}/bin:${PATH}"
Why do we need these settings?
There are package dependencies.
For example, we build <tt>pango</tt>, <tt>cairo</tt> and <tt>jasper</tt>
early in the build-order and they will be used to
build <tt>gtk+</tt> later in the build order.
That explains <tt>CXXFLAGS</tt>(compilation flags),
<tt>CPPFLAGS</tt>(more compilation flags), <tt>LDFLAGS(link flags)</tt> and
<tt>PKG_CONFIG_PATH</tt>(used at link time, I guess)
I set <tt>PATH</tt> because some packages install programs
in the <tt>${INSTDIR}/bin</tt> directory. These programs are
used by later packages to determine version information.
Therefore, they must be found along the <tt>PATH</tt>.
That is also why I recommend a <tt>rehash</tt> after building each package.
I set <tt>LD_LIBRARY_PATH</tt> for the same reason.
For these programs to run they must find all
required libraries, some of which were installed
in the <tt>${INSTDIR}/lib</tt> directory.
I added the math library "-lm" to <tt>LDFLAGS</tt> to work
around the jasper library idiosyncrasy as noted below.
= Which compiler =
I used gcc version 3.4.4
= How to build a package =
The following procedure works for most packages,
but it does not work for all of them.
The exceptions are noted in sections later in this document.
So, you should not build any packages until you have read
this entire document.
Download the compressed tar file to the root directory.
Uncompress the file.
:<tt>gunzip xyz-1.2.3.tar.gz</tt>
De-tar the file. This will create a dedicated sub-directory in which to build the package.
:<tt>tar xvf xyz-1.2.3.tar</tt>
Change to the package directory.
:<tt>cd xyz-1.2.3</tt>
Configure the package.
:./configure -prefix ${INSTDIR}
:make install
Update your shells program cache.
If you want to ''rebuild'' a component you will need
to do the following first:
:make clean
:make distclean
= Package idiosyncrasies =
== Build order and dependencies ==
The packages must be built and installed in the documented order.
When built in the documented order <tt>./configure</tt> should not complain (and abort) about any dependency violations.
See the section on <tt>./configure</tt> later in this document.
== When building jasper-1.701.0 ==
1: By default, jasper builds to a static library, but packages which use jasper
expect a shared build so an additional argument must be added to the <tt>./configure</tt> command.
:<tt>./configure --prefix ${INSTDIR} --enable-shared</tt>
2: The gtk configure script aborted the first time I tried it because the required jasper library
could not be found, but the real problem was that the
<tt>./configure</tt> test for availability failed to link because
it did not include the standard math library "-lm".
So, I added -lm to LDFLAGS and then it was happy.
The lesson here is to always check the <tt>config.log</tt> file
for the ''real'' <tt>./configure</tt> failure story.
== When building gc4.8 ==
''(added by kubaraczkowski after installing into CentOS 5.5, inkscape 0.48)''
1: For some reasons the gc has to be compiled with --disable-shared and --enable-static given to the ./configure script.
:<tt>./configure --prefix ${INSTDIR} --disable-shared --enable-static</tt>
2: Even with this set correctly you might need to tweak CPPFLAGS and LPFLAGS to point only to the gc include/lib folders. Somehow inkscape does not find the libgc even though it is installed...
== When building libxml2-2.7.6 ==
1: <tt>./configure</tt> complains about this at the end, but it does not appear to have any significant consequences.
:<tt>/bin/rm: cannot remove `libtoolT': No such file or directory</tt>
== When building libxslt-1.1.26 ==
1: <tt>lbxsltv</tt> uses <tt>${INSTDIR}/bin/xml2-config</tt> to determine the version of the <tt>libxml(2)</tt>
library which is available.  This is an executable which needs to be found along the PATH.
So, the bin sub-directory of the install location has to be added to the <tt>PATH</tt>.  Thus the above <tt>"setenv PATH ..."</tt>
2: <tt>./configure</tt> complains about this at the end, but it does not appear
to have any significant consequences.
:<tt>/bin/rm: cannot remove `libtoolT': No such file or directory</tt>
3: The <tt>libxsl</tt> package builds libraries '''and''' the program <tt>xsltproc</tt>.
I could not get <tt>xsltproc</tt> to link, but it is not required
to build Inkscape, so I edited the <tt>Makefile</tt>
and removed it so that the make would complete.
Note: <tt>Makefiles</tt> are made by <tt>./configure</tt>. That is what it does.
== When building inkscape-0.47 ==
1: Surprising compilation error in one of the source files.
:document.cpp:185: error: ISO C++ forbids casting between pointer-to-function and pointer-to-object
So I hacked line 185 from this:
to this:
= Surviving <tt>./configure</tt> =
1: If <tt>./configure</tt> tells you that it can't find a dependent package,
that may not be the real problem. Always check the <tt>config.log</tt> file for the real story.
As noted above, when <tt>./configure</tt> told me that it could not find
the <tt>jasper</tt> package, a look in the <tt>config.log</tt> file revealed that
the logic used to determine the existence of the <tt>jasper</tt>
package involved building a little test program. That test program
failed to link because it could not find symbols like <tt>pow</tt> and <tt>floor</tt>.
I new these came from the math library and fixed the problem by
adding <tt>"-lm"</tt> to the <tt>LDFLAGS</tt> environment variable.
2: The first time I tried to build Inkscape (6 months ago) <tt>./configure</tt> said (something like) this:
:<tt>Dependency (gmodule-2.0 >= 2.21.1) not met.</tt>
This effort ended in frustration because I could not find the <tt>gmodule</tt>
package anywhere on the web. This time I determined that <tt>gmodule</tt>
is actually a library and it is provided by the <tt>glib-2.22.3</tt>
package. (At the end of the build process the <tt>install/lib</tt> directory
contained 38 library files (*.so), but I had only built 22 packages.)
3: And, um, oh yes... '''Always check the <tt>config.log</tt> file.'''
= The final list of library dependencies =
Following is the list of dependencies for the final Inkscape executable.
Note that the library versions listed in this table bear no correspondence
to the package from which they were built.
For example, we built libgtkmm from the package gtkmm-2.18.2, but got the library libgtkmm-2.4.so.1
This just adds to the confusion.
= My operating system =
>uname -a<br>
Linux juno 2.6.9-89.0.9.ELsmp #1 SMP Wed Aug 19 08:06:10 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
>cat /etc/issue<br>
Red Hat Enterprise Linux WS release 4 (Nahant Update 8)<br>
Kernel \r on an \m

Latest revision as of 14:48, 28 May 2019