2009-10-11 01:21:06 +00:00
|
|
|
Common Setup
|
|
|
|
============
|
2009-10-10 15:10:05 +00:00
|
|
|
|
2009-10-14 01:06:18 +00:00
|
|
|
To be able to build qpdf and run its test suite, you must have either
|
2009-10-14 01:20:46 +00:00
|
|
|
Cygwin or MSYS from MinGW (>= 1.0.11) installed. If you want to build
|
|
|
|
with Microsoft Visual C++, either Cygwin or MSYS will do. If you want
|
|
|
|
to build with MinGW, you must use MSYS rather than Cygwin.
|
2009-10-10 15:10:05 +00:00
|
|
|
|
2009-10-11 01:21:06 +00:00
|
|
|
As of this writing, the image comparison tests confuse ghostscript in
|
|
|
|
cygwin, but there's a chance they might work at some point. If you
|
|
|
|
want to run them, you need ghostscript and tiff utils as well. Then
|
|
|
|
omit --disable-test-compare-images from the configure statements given
|
2009-10-14 01:20:46 +00:00
|
|
|
below. The image comparison tests have not been tried under MSYS.
|
2009-10-10 15:10:05 +00:00
|
|
|
|
2009-10-11 01:21:06 +00:00
|
|
|
Building with MinGW
|
|
|
|
===================
|
2009-10-10 15:28:33 +00:00
|
|
|
|
2009-10-11 01:21:06 +00:00
|
|
|
QPDF is known to build and pass its test suite with MSYS-1.0.11 and
|
|
|
|
gcc 4.4.0 with C++ support. You can fully configure and build qpdf in
|
|
|
|
this environment, though cygwin is required to run the test suite.
|
|
|
|
You will most likely not be able to build qpdf with mingw using
|
|
|
|
cygwin, though it's possible that it could be made to work with gcc
|
|
|
|
-mno-cygwin.
|
2009-10-10 15:28:33 +00:00
|
|
|
|
2009-10-11 01:21:06 +00:00
|
|
|
From your MSYS prompt, run
|
2009-10-10 18:06:26 +00:00
|
|
|
|
2009-10-11 15:06:44 +00:00
|
|
|
./configure --disable-test-compare-images --enable-build-external-libs --with-buildrules=mingw
|
2009-10-20 01:46:56 +00:00
|
|
|
|
|
|
|
or
|
|
|
|
|
|
|
|
./config-mingw
|
|
|
|
|
|
|
|
and then
|
|
|
|
|
2009-10-11 01:21:06 +00:00
|
|
|
make
|
2009-10-10 18:06:26 +00:00
|
|
|
|
2009-10-14 01:20:46 +00:00
|
|
|
Add the absolute path to the libqpdf/build directory to your PATH.
|
|
|
|
Make sure you can run the qpdf command by typing qpdf/build/qpdf and
|
|
|
|
making sure you get a help message rather than an error loading the
|
|
|
|
DLL or no output at all. Run the test suite by typing
|
2009-10-10 18:05:01 +00:00
|
|
|
|
2009-10-14 01:20:46 +00:00
|
|
|
make check
|
2009-10-10 18:05:01 +00:00
|
|
|
|
2009-10-14 01:20:46 +00:00
|
|
|
If all goes well, you should get a passing test suite.
|
2009-10-10 18:05:01 +00:00
|
|
|
|
2009-10-11 01:21:06 +00:00
|
|
|
Building with MSVC .NET 2008 Express
|
|
|
|
====================================
|
2009-10-10 18:05:01 +00:00
|
|
|
|
2009-10-11 01:21:06 +00:00
|
|
|
These instructions would likely work with newer version of MSVC or
|
|
|
|
with full version of MSVC. They may also work with .NET 2005. They
|
2009-10-14 01:20:46 +00:00
|
|
|
have only been tested with .NET 2008 Express. You may follow these
|
|
|
|
instructions from either Cygwin or from MSYS.
|
2009-10-10 18:05:01 +00:00
|
|
|
|
2009-10-11 01:21:06 +00:00
|
|
|
You should first set up your environment to be able to run MSVC from
|
|
|
|
the command line. There is usually a batch file included with MSVC
|
|
|
|
that does this. From that cmd prompt, you can start your cygwin
|
|
|
|
shell.
|
2009-10-10 18:05:01 +00:00
|
|
|
|
2009-10-11 01:21:06 +00:00
|
|
|
Configure as follows:
|
2009-10-10 18:05:01 +00:00
|
|
|
|
2009-10-11 01:21:06 +00:00
|
|
|
CC=cl CXX="cl /TP /GR" CPPFLAGS=-DHAVE_VSNPRINTF ./configure --disable-test-compare-images --enable-build-external-libs --with-buildrules=msvc
|
2009-10-20 01:46:56 +00:00
|
|
|
|
|
|
|
or
|
|
|
|
|
|
|
|
./config-msvc
|
|
|
|
|
|
|
|
and then
|
|
|
|
|
2009-10-11 01:21:06 +00:00
|
|
|
make
|
2009-10-10 18:05:01 +00:00
|
|
|
|
2009-10-11 01:24:48 +00:00
|
|
|
The -DHAVE_VSNPRINTF is really only required for things that include
|
|
|
|
zutil.h from zlib. You don't have to worry about this when compiling
|
|
|
|
against qpdf with MSVC -- only when building zlib. It's harmless to
|
|
|
|
include with the rest of the qpdf build.
|
|
|
|
|
|
|
|
Once built, add the full path to the libqpdf/build directory to your
|
|
|
|
path and run
|
2009-10-11 01:21:06 +00:00
|
|
|
|
|
|
|
make check
|
|
|
|
|
|
|
|
to run the test suite.
|
2009-10-10 18:05:01 +00:00
|
|
|
|
|
|
|
If you are building with MSVC and want to debug a crash in MSVC's
|
|
|
|
debugger, first start an instance of Visual C++. Then run qpdf. When
|
|
|
|
the abort/retry/ignore dialog pops up, first attach the process from
|
|
|
|
within visual C++, and then click Retry in qpdf.
|
2009-10-11 01:21:06 +00:00
|
|
|
|
|
|
|
A release version of qpdf is built by default. You will probably have
|
|
|
|
to edit msvc.mk to change /MD to /MDd to build a debugging version.
|
2009-10-11 13:24:08 +00:00
|
|
|
Note that you must redistribute the Microsoft runtime DLLs. Linking
|
|
|
|
with static runtime won't work; see "Static Runtime" below for
|
|
|
|
details.
|
|
|
|
|
2009-10-14 01:20:46 +00:00
|
|
|
Runtime DLLs
|
|
|
|
============
|
|
|
|
|
|
|
|
Both build methods create executables and DLLs that are dependent on
|
|
|
|
the compiler's runtime DLLs. You can find out which DLLs are required
|
|
|
|
by using objdump. For any DLLs that are not standard on any Windows
|
|
|
|
system, you will need to copy those into the directory with the exe
|
|
|
|
and the qpdf DLL in order for the application to work outside the
|
|
|
|
development environment. You don't need KERNEL32.dll, or msvcrt.dll
|
|
|
|
as those are standard.
|
|
|
|
|
|
|
|
To discover which DLLs you need, you can run
|
|
|
|
|
|
|
|
objdump -p qpdf/build/qpdf.exe | grep DLL
|
|
|
|
|
|
|
|
To find the path to the DLL, you can use type -P, as in
|
|
|
|
|
|
|
|
type -P libgcc_s_dw2-1.dll
|
|
|
|
|
|
|
|
replacing libgcc_s_dw2-1.dll with whatever gcc DLL is shown, if
|
|
|
|
different. For MSVC, you will probably need two DLLs. Keep in mind
|
|
|
|
that Microsoft does not allow redistribution of the debugging DLLs.
|
|
|
|
qpdf's build does not depend on them by default, however.
|
|
|
|
|
|
|
|
Redistribution of the runtime DLL is unavoidable as of this writing;
|
|
|
|
see "Static Runtime" below for details.
|
|
|
|
|
2009-10-11 15:06:44 +00:00
|
|
|
Installing
|
|
|
|
==========
|
|
|
|
|
|
|
|
As of this writing, make install doesn't work with Windows since it is
|
|
|
|
hard-coded to use libtool. Until that time, you can install manually
|
|
|
|
by looking at the install target in Makefile and gathering up the
|
|
|
|
appropriate pieces by hand. If building with mingw, be sure to run
|
|
|
|
strip on the DLL and EXE files to make them much smaller. This is not
|
|
|
|
necessary with msvc since it stores debugging information in a
|
|
|
|
separate file. Note that, in both cases, compiling with debugging
|
|
|
|
flags adds extra data to the symbol table and not to the resulting
|
|
|
|
executables. (Compiling with debugging flags, with msvc, is distinct
|
|
|
|
from directing the compiler to use debugging runtime libraries, which
|
|
|
|
does make a difference.)
|
|
|
|
|
2009-10-11 13:24:08 +00:00
|
|
|
Static Runtime
|
|
|
|
==============
|
|
|
|
|
|
|
|
Building the DLL and executables with static runtime does not work
|
|
|
|
with either Visual C++ .NET 2008 (a.k.a. vc9) using /MT or with mingw
|
|
|
|
(at least as of 4.4.0) using -static-libgcc. The reason is that, in
|
|
|
|
both cases, there is static data involved with exception handling, and
|
|
|
|
when the runtime is linked in statically, exceptions cannot be thrown
|
|
|
|
across the DLL to EXE boundary. Since qpdf uses exception handling
|
|
|
|
extensively for error handling, we have no choice but to redistribute
|
|
|
|
the C++ runtime DLLs. Maybe this will be addressed in a future
|
|
|
|
version of the compilers.
|