Compiling Scribus for the First Time
This guide is meant to be a user friendly, first timer's step by step guide to compiling Scribus. If you have never compiled a program before this is the guide for you. I once had the problems too. Linux documentation while it is usually good, sometimes assumes a certain level understanding of Linux, which not all new users have. (Everyone is a newbie at one time.) I have received some emails from users with packaging problems or compiling issues with Scribus. Moreover, with new "user-oriented" distributions like Lycoris, Lindows and Mandrake often do not include in their default installs all of the tools and libraries needed to compile programs properly.
"User friendly" is not meant as a knock on these newer distributions, as they get Linux in the hands of adventurous or curious Windows and Mac users, who want a stable, reliable OS without the hassles of spending hours setting up more traditional distros like Slackware or Debian. Moreover, in my short time with them, they do make a Linux desktop accessible and productive right away. Fortunately, Scribus has been through approximately 35 revisions since it was ported to Qt from Python when it was launched. Unlike compiling a compiler (very tricky) or some of the core libraries in Linux, once your workstation is setup properly, it compiles very reliably. Moreover, most of the newer distros Mandrake 8.2, RH 7.2 & 7.3, Suse 7.3& 8 etc have pretty stable versions of 2.9x gcc compilers. The 2.95+ versions have been around for quite a while and most distros have solved many of the bugs. Red Hat on 7.3 for example is on build 112, which has been extremely reliable.
Gcc 3.2 version has been just released and the next generation of distros will be based on this series. Wait a while for the bugs to be shaken out, but 3.2+ promises to be much better at optimizing code for newer AMD and Intel PIII and PIV processors. I have compiled Scribus with gcc 3.04, but find it is not as stable with 2.96
Caveats: 1) I have limited experience with these distros. I do not run them full time. I run RH 7.3, so most of this based on RH. 2) 90% of this done from the console or Xterm. 3) You are running under KDE. 4) You have the distro installation disks handy.
Step One Compiler and the GNU Tools
You need a compiler - obviously. Open a console or terminal window and simply type: gcc -v
You should get an output like:
[peter@vmware peter]$ gcc -v Reading specs from /usr/lib/gcc-lib/i386-redhat-Linux/2.96/specs gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-112)This indicates the compiler is installed and working.
If not, locate the gcc and gcc devel packages from your distro CD Rom. They should match the version which was included with your distro. Example: Mandrake 8.2 gcc-2.96-0.76mdk.rpm is the compiler and libstdc++2.10-devel-2.96-0.76mdk has the c++ development files. You also need the binutils package which includes the tools which the compiler uses such as the linker (ld) and (as). Type: ld -v at the command line to check you have them installed as well. Lastly, you need these packages as well:
- autoconf
- automake
- libtool
- pkgconfig
Once you have ensured you have all the tools. Proceed. If not install as needed, then it would be a good idea to run any kind of updater to make sure you have the latest versions from your distro. As an example, RH has released several updates to the compiler and basic system libraries. Having these updates might help you to avoid troubles or problems later on.
Step Two
Knowing which packages and libraries are needed. You need the so called "development" packages of the following libraries:
- QT - on redhat is qt-devel (The exact version depends on which version of KDE is installed.) Qt 2.3.1 or 2.3.2 is used for KDE 2.2.x. Qt 3.0.3 or 3.0.5 is used with KDE3. You can have both.
- Xfree-86-devel
- libstdc++-devel
- libtiff-devel
- libpng-devel
- zlib-devel
- libfreetype-devel might be needed depending on how Xfree was built by your distro
- lib-cups-devel might be needed if you have cups printing and this depends on how your distro supports printing.
- Optionally: liblcms-devel - This is the littlecms package which enables color management with Scribus.
The exact version depends on the one provided with your original distro. DO NOT try to upgrade version of the png packages with ones different from your distro. It can really mess up KDE and QT. You have been warned. Development packages are mostly files called header files which the compiler uses to build and link to the libraries already installed on your machine. Another way to check is to look in the /usr/include/ directory. You will see a whole bunch files with .h as the file extension. Not all headers are installed here. Qt is put in a separate /include directory by the packager.
Step Three - The Build Environment
Checking you build environment.
From the console type:
envHit Enter. You should have an output like this:[peter@vmware scribus-0.7.7]$ env PWD=/rpms/scribus-0.7.7 DBROOT=/home/peter/adabas XAUTHORITY=/home/peter/.Xauthority KONSOLE_DCOP=DCOPRef(konsole-2026,konsole) GS_LIB=/home/peter/.kde/share/fonts DBWORK=/home/peter/adabas/sql HOSTNAME=nec400 LD_LIBRARY_PATH=/home/peter/adabas/lib:/home/peter/adabas/lib: SESSION_MANAGER=local/vmware:/tmp/.ICE-unix/1335 QTDIR=/usr/lib/qt3-gcc2.96 KONSOLE_DCOP_SESSION=DCOPRef(konsole-2026,session-1) LESSOPEN=|/usr/bin/lesspipe.sh %s CXXFLAGS=-O2 -march=i686 USER=peter LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;0 1:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.b tm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31: *.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:* .bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;3 5:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35: KDE_MULTIHEAD=false MAIL=/var/spool/mail/peter INPUTRC=/etc/inputrc GTK_RC_FILES=/etc/gtk/gtkrc:/home/peter/.gtkrc:/home/peter/.gtkrc-kde XMODIFIERS=@im=none LANG=en_US COLORTERM= DISPLAY=:0.0 LOGNAME=peter SHLVL=5 LDFLAGS=-lm SHELL=/bin/bash HISTSIZE=1000 HOME=/home/peter TERM=xterm SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass DBCONFIG=/home/peter/adabas/sql PATH=/home/peter/adabas/bin:/home/peter/adabas/pgm:/home/peter/adabas/bin:/home/peter/adabas/pgm: /usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/peter/bin:/ usr/local/kde/lib/kde3:/usr/local/Acrobat5/bin CFLAGS=-O2 -march=i686 _=/usr/bin/envThe important thing to note is the QTDIR variable which points at the directory where Qt and its libraries are located. Scribus will not run or compile without this. You could have more than one Qt directory one for Qt2 and one for Qt3. On any system where you want to compile Scribus 0.6, where you have KDE 3 and Qt3, for example, you need to set QTDIR to the directory where Qt 2.3.x is located. You can set this temporarily like this:
export QTDIR="/usr/lib/name of qt2 dir"The other important thing is to make sure the /etc/ld.conf file contains a line with the same directory where Qt is. This file tells the linker where the library files are when compiling Scribus. This info is hardwired into Scribus, so do not move these files around. Here is mine:
/usr/lib /usr/kerberos/lib /usr/X11R6/lib /usr/lib/kde3 /usr/lib/qt-2.3.1/lib /usr/lib/qt-1.45/lib /usr/local/lib /usr/include /usr/include/kde /usr/i386-glibc21-linux/lib /usr/lib/qt3/lib /usr/lib/qt2/lib /usr/lib/sane /usr/lib/qt-3.0.5/libYou can only edit this as root, so if you need to make adjustments type: ksudo konqueror - Enter and put in the root password. Navigate to /etc and then open /etc/ld.conf with Kedit. Save this and there will be a backup made automatically with the name ld.conf~. Exit and return to the console. Type su - hit Enter. You are now running as root. Next type: /sbin/ldconfig Hit Enter. This will cause the disk to thrash for a second or two while it reads the new libraries. If you get a file not found error type: slocate ldconfig - Hit enter. This will find the location of the program. This reloads the ld cache so the linker can find the newly added directories. This is also a good idea to do if you add packages which have libraries which are needed for compiling. Lastly, check your path to see if /usr/local/bin is in the path. This is where Scribus puts the executible file. If it is missing from the path, go to the root of your home directory, open .bashrc in Kedit and add this directory to your PATH statement. This is usually setup as a default on most Linux workstations.
Step Four - Getting and extracting the source files.
Get the tarball from http://web2.altmuehlnet.de/fschmid/. Save this in a temporary directory. Then navigate to this directory:cd ~/nameoftempdirectory under your home directory.Then from the command line:
tar xfz scribus-0.x.x.tar.gzwhere x.x is the version number of Scribus This will untar and extract scribus into a separate set of directories. Then:cd ./scribus-0.x.xHit Enter
Step Five - Compiling
./configureHit Enter. This runs the autoconfigure scripts tailoring the makefiles to your environment.If you get errors they will look something like this.:
checking for Qt... configure: error: Qt (>= Qt 3.0.2) (library qt-mt) not found. Please check your installation! For more details about this problem, look at the end of config.log. Make sure that you have compiled Qt with thread support!Then type:
makeHit Enter. Grab a coffee. This is the compiling phase. This might take anywhere from 15-40 minutes on your workstation, depending on how many other programs and the speed of your processor are running. Compiling is processor intensive. After it is completed, type:
suHit Enter and then type in the root password. Hit Enter again. Type:
make installHit Enter. This will install the program's support files (docs, libraries etc.) in /usr/local/share/scribus.
When the installation is finished, type exit. Then type scribus from the command line and it will launch.
Your done!
Glossary
- gcc - The GNU Compiler Collection. The complete collection can compile C, C++, java, fortran, ADA and other languages. It is really the heart of open source software. Without a high quality compiler, much open source software would not exist. Most commercial compilers are expensive - at least several hundred dollars per package.
- Qt - a development enviroment from Trolltech, written in C++. KDE is almost 100% based completely on Qt. Qt can also be used for development on Macs and Windows with a commercial license from Trolltech.
- C++ - a modern high level language derived from C. A great many GUI programs excepting most gnome or GTK applications are written in C++
First Version 28 August 2002