COMPILING AND TESTING SANE

For debugging purpose, or to evaluate a new SANE's version before installing it, you may have to compile it and run locally. It involves:

These instructions are Linux/unix oriented.


prerequisites

You'll need to have a C compiler installed with some development packages such as:

On most distributions installing installing the libusb-devel package will also install all the needed dependencies.

If you intend to get the sources through CVS, you'll need to check if the 'cvs' tool is installed.


Preparing environment

Compiling and testing SANE can be done with any user account. You'll need a directory where the sources will be put. Say we are working with a regular user account. We're going to create a 'testing' directory where all the experiments will take place. Then we 'cd' to it.

command window


Getting sources

using CVS

Latest SANE version can be obtained through CVS, see SANE's CVS access page.


downloading archives

You can download the archives corresponding to the needed version at SANE on alioth.debian.org. An archive of the latest development tree is available here. Then unpack the sources in the 'testing' directory you created.



Configuring for compilation

In the command shell, 'cd' to the top directory of the sources have been installed. Then run the 'configure' script that will check and prepare for the compile:
running configure


When the configuration is successfully done you should have the following ouput:

successful configure


You'll note in this output that the configure script detected another SANE's installation. This is harmless for the tests we're going to do.

Otherwise something went wrong. The 'configure' script will ouput an error telling what is failing.



Compiling

Compiling is now just a matter of typing the 'make' command:
make



A successfull build ends like this: build success


In case of error, you'll have to figure out what is going on ...



Running the compiled version

By using the LD_LIBRARY_PRELOAD environment variable which tells the C library to load a specific library prior to execute a program, we can force scanning programs to use the SANE version we have compiled. To ease tests, the following scripts run the required backend in color preview mode (rts8891, lexmark or genesys) and log all debug data in a file called 'backend'-scan.log, the produced picture is in 'backend'-scan.pnm. These scripts must be placed in the top directory of the compiled sources.

You can use them as a basis for tests scripts. For instance you could give the '--resolution' or '--mode' option to change color mode and resolution.