Difference between revisions of "CompilingRHEL"

From Inkscape Wiki
Jump to navigation Jump to search
(removed - outdated)
 
(64 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= Greetings =


This page documents the process I used to build Inkscape 0.47 on RHEL4.
Many consider RHEL4 to be an archaic operating system.
I think of it as mature, stable and predictable.  :-)
= Background and Motivation =
The corporation 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 Red Hat Enterprise Linux (RHEL) Version #4,
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.
I performed this process on 19-FEB-2010 so this information is
already out of date.
= List of packages =
Following is the list of packages which I used.
The process by which I arrived at this list was no small feat
and took over 15 hours. I consider it a miracle that I
was able to find a compatible set of packages and compiler.
They are listed here in the order in which I built them.
This is not the only build order. You can't tell by looking,
but gc6.8 has no dependencies and so could be built at any time.
The pango-1.24.5 package, on the other hand, requires cairo-1.8.8
and so the cairo package must be built first.
Not all of the packages listed here are the latest version
which was available at the time that I performed the build.
In several cases I had to back out 1 or 2 years because my
compiler of choice (gcc 3.4.4) did not like the more recent versions.
#libpng-1.2.41<br>
#pixman-0.17.4<br>
#freetype-2.3.9<br>
#fontconfig-2.8.0<br>
#cairo-1.8.8<br>
#glib-2.22.3<br>
#pango-1.24.5<br>
#jasper-1.701.0<br>
#atk-1.29.4<br>
#gtk+-2.17.0<br>
#libsigc++-2.2.0<br>
#gob2-2.0.16<br>
#glibmm-2.22.0<br>
#cairomm-1.6.4<br>
#pangomm-2.26.0<br>
#gtk+-2.18.7<br>
#gtkmm-2.18.2<br>
#gsl-1.13<br>
#gc6.8<br>
#libxml2-2.7.6<br>
#libxslt-1.1.26<br>
#lcms-1.19<br>
#inkscape-0.47<br>
Please do not change any of these package numbers without confirming compatibility above and below.
= How to find a package =
I'm sorry that I do not include the location where I found each library.
I did not think to write that information down at the time. Especially
since I had no confidence in this entire process.
I ''do'' remember that they were not hard to find.
Perform a google search for the string "lib<package-name download"
For example:
:<tt>"libgc download"</tt>
Or, perhaps:
:<tt>"gtkmm download"</tt>
You will get multiple hits, but
hopefully one near the top will link to
an obvious home page for the package.
Your looking for a list of compressed tar files.
Something like this:
<tt>
:gc6.6.tar.gz        09-Sep-2005 12:04      736K
:gc6.7.tar.gz        03-Mar-2006 12:43      738K
:gc6.8.tar.gz        12-Jul-2006 17:17      739K
</tt>
The .gz files will be decompressed with gunzip.
You could also download .bz2 files and decompress
with bunzip2.
= 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 no 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.)
The other problem I typically have is that I will build
a program and it will work fine, but you never really
know why it works (ldd does not show the whole story)
So, you distribute to your customers and it does not
work because their system library set does not match
yours.
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.
A package directory will be created when you de-tar the
download.
= 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.
<tt>
:setenv INSTDIR "/home/me/inkscape/install"
:setenv CXXFLAGS "-I${INSTDIR}/include"
:setenv CPPFLAGS "-I${INSTDIR}/include"
:setenv LDFLAGS "-L${INSTDIR}/lib -lm"
:setenv LD_LIBRARY_PATH "${INSTDIR}/lib:${LD_LIBRARY_PATH}"
:setenv PKG_CONFIG_PATH "${INSTDIR}/lib/pkgconfig"
:setenv PATH "${INSTDIR}/bin:${PATH}"
</tt>
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.
<tt>
:./configure -prefix ${INSTDIR}
</tt>
Compile.
<tt>
:make
</tt>
Install.
<tt>
:make install
</tt>
Update the shells program cache.
<tt>
:rehash
</tt>
If you want to ''rebuild'' a component you will need
to do the following first:
<tt>
:make clean
:make distclean
</tt>
= 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 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:
:<tt>reinterpret_cast<gpointer>(sp_document_reset_key),</tt>
to this:
:<tt>reinterpret_cast<gpointer>((void*)sp_document_reset_key),</tt>
= 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: One time I saw <tt>./configure</tt> say (something like) this:
:<tt>Dependency (gmodule-2.0 >= 2.21.1) not met.</tt>
The first time I tried to build Inkscape (6 months ago)
it 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 23 packages.)
= The final ldd =
Following is the ldd() of 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.
<tt>
:libgtkmm-2.4.so.1
:libatkmm-1.6.so.1
:libgdkmm-2.4.so.1
:libgiomm-2.4.so.1
:libpangomm-1.4.so.1
:libglibmm-2.4.so.1
:libcairomm-1.0.so.1
:libgtk-x11-2.0.so.0
:libgdk-x11-2.0.so.0
:libatk-1.0.so.0
:libgio-2.0.so.0
:libpangoft2-1.0.so.0
:libgdk_pixbuf-2.0.so.0
:libpangocairo-1.0.so.0
:libpango-1.0.so.0
:libfreetype.so.6
:libfontconfig.so.1
:libgobject-2.0.so.0
:libgmodule-2.0.so.0
:libxslt.so.1
:libz.so.1
:libxml2.so.2
:libcairo.so.2
:libsigc-2.0.so.0
:libgthread-2.0.so.0
:librt.so.1
:libglib-2.0.so.0
:libpng12.so.0
:libgsl.so.0
:libgslcblas.so.0
:libm.so.6
:libgomp.so.1
:libpopt.so.0
:libaspell.so.15
:libgc.so.1
:libstdc++.so.6
:libgcc_s.so.1
:libpthread.so.0
:libc.so.6
:libdl.so.2
:libX11.so.6
:libresolv.so.2
:libpixman-1.so.0
:libexpat.so.0
:libXrender.so.1
:libSM.so.6
:libICE.so.6
:libXinerama.so.1
:libXext.so.6
</tt>
= My operating system =
<tt>
>uname -a<br>
Linux juno.adsdesign.analog.com 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
</tt>

Latest revision as of 14:48, 28 May 2019