This file contains some common problems/questions regarding Qsieve
and provides answers and hints to solve them.

Q: Question/Problem
A: Answer/Solution
---------------------------------------------------------------------------

Q1: We have problems to compile on Cygwin!

A: - Have you tried ./configure to create a makefile?
   - if "./configure && make && make install" doesn't work,
     try "./configure" from inside the package directory.
     Edit "Makefile.sample" and try "make -f Makefile.sample"


Q2: Where does Qsieve place its files?

A: By default, persistent files are placed in the current working directory,
   and temporary files are placed in "/tmp".  These values can be changed in
   the configuration file.  If an environment variable "QSIEVE_CFG" is
   defined, then the file given there is used as configuration file. If no
   such environment variable exists, then "qsieve.cfg" in the current
   working directory will be used. If no configuration file is found, then a
   warning message is emitted.


Q3: Binaries have been successfully compiled on Cygwin/Linux, but they do
   not function properly!

A: For Qsieve versions < 3.0: first check, whether a "/tmp" directory
   exists. If not, create a folder named "/tmp" and try again. (see also Q2)

   If the problem still exists, then you may have compiled the wrong
   binaries for your computer. There are many different optimization levels
   triggered by the makefile. Optimization is done at compile-time to gain
   maximum performance.  For example, if "3D-Now!" instructions are enabled,
   then the resulting binaries will only run on computers which do support
   "3D-Now!" instructions.

   You can either try to compile a more generic version of the binaries or
   you compile different versions for each machine.

   Please keep also in mind, that static binaries are linked against the
   GMP-library that was provided at compile-time. In most cases this should
   be no problem (except for performance reasons). But if you link against
   tuned versions of GMP, then the resulting binaries are machine-dependent.


Q4: After upgrading to Cygwin 1.5.11-1, Qsieve fails to work properly!

A: - see http://www.mail-archive.com/cygwin@cygwin.com/msg44295.html
     try to upgrade Cygwin to a newer version or -- at least -- upgrade your
     cygwin.dll to a recent snapshot.


Q5: [obsolete for Qsieve-3.0] Qsieve client aborts with a message, saying
   that "opening communication_stream "/tmp/... failed" or that
   "communication stream is in error state". Why this? What to do?

A: First check, whether a "/tmp" directory exists. If not, create a
   folder named "/tmp" and try again. (see also Q2)

   Does the problem still exist? -- My guess is, that the client was
   connected via Internet and not via LAN.  If this assumption is correct,
   then most probably the connection was temporarily broken. If IP-addresses
   change during data transfers, such errors/failures are detected (but not
   resolved).

   Restart the client manually, or preferable, write a tiny script:
    1. call client
    2. wait 2 minutes
    3. check, whether connection to server can be established
    4. on success: goto 1.

   Additionally you can monitor periodically the state of the client. On
   Linux you can use a cronjob for this task.  If the client is idle for too
   long, kill it and trigger a restart.

   Take a look to the ./contrib directory for such scripts.


Q6: I want to setup a Qsieve status webpage under the apache httpd-2.0.x
   webserver. How to do this under Linux?

A: - first ensure, that APACHE and PHP are installed
   - php should be compiled with gd and png support
   - then goto the directory, where the apache "http.conf" is located
   - edit http.conf
   - restart the apache daemon

  for example:
  ------------
    if host.conf has the following entries
   ...
    AddType application/x-httpd-php .php
    NameVirtualHost *:80
    <VirtualHost *:80>
      DocumentRoot /place-where-qsieve-is-installed/share/qsieve/html
      ServerName qsieve
      DirectoryIndex qsieve-status.php
    </VirtualHost>
   ...
    and the /etc/hosts has an entry like
    "127.0.0.3       qsieve"

    then the webservice is locally available under
    "http://qsieve/"
    whenever a Qsieve server is up and running.

    If you define additionally in qsieve.cfg:
    "XMLStatusFile = /place-where-qsieve-is-installed/share/qsieve/html/status.xml"
    then a logfile of the latest factorizations is shown whenever the Qsieve
    server cannot be connected. (Since the webinterface directory might be a
    read-only location, you may have to move the webinterface to another
    place or edit the php-script.)


Q7: Qsieve segfaults on SuSE 9.0!

A: If you have compiled a statically linked version of Qsieve using "gcc
   version 3.3.1 (SuSE Linux)", then most probably broken exception handling
   is causing the segmentation fault. You can try using dynamic linking:
   "./configure --enable-shared" or use another compiler version.
   (see also: http://gcc.gnu.org/ml/gcc-help/2004-04/msg00069.html)


Q8: I get compile errors like "mpz_wrapper.H: error: ambiguous overload for
    'operator<<'". What to do?

A: See the README file, it contains info about how to compile Qsieve!
   Newer versions of GMP have already C++-support. You may need to modify
   the "gmp.h" header file to allow QSIEVE to use its own I/O-functions:

   The std::ostream& operator<< declarations must be deactivated;
   simply replace the following line (near the operator<< declarations) 
     #ifdef __cplusplus
   by
     #if defined(__cplusplus) && !defined(USER_GMP_WRAP)
   and everyone is happy again...

   For gmp-4.1.2 to gmp-4.1.4 you can also proceed as follows:
    1. cp gmp.h gmp.h.orig
    2. patch gmp.h < gmp.h.patch


Q9: The compiler complains about "error: register specified for 'XMM6' isn't
    suitable for data type"!

A: Most probably you have forgotten to tell the compiler to allow SSE
   instructions.  You can do that by specifying appropriate CPUFLAGS in the
   Makefile. Either use "-march=<cputype>", where <cputype> is pentium3,
   pentium4, athlon-xp (or any other architecture that supports SSE), or by
   specifying "-msse" or "-msse2".


Q10: My compiler doesn't accept "-march=athlon-64". How can I compile SSE2
    support anyway?

A: You can try to specify "-march=athlon-xp -msse2" instead of
   "-march=athlon-64". For gcc-3.2.x and gcc-3.3.x this should work.
   Newer releases of gcc should accept "-march=athlon-64".
   For other compilers I don't know...


Q11: I have started the Qsieve server on my Cygwin system. I have started a
     net-client on another computer, but it cannot connect to the server!
     What is wrong?

A: First, please check, whether a local net-client can connect to you local
   Qsieve server [-> see README for the setup].  If this works, does the
   external net-client use the correct IP address?  Also, don't forget to
   open tcp port 12364 on your Windows firewall, so that the external client
   is allowed to connect to the server.
   (The ports for Qsieve are hard-coded in the binaries, you can lookup the
   source file "qsieve-fwd.H" for the actual values.)
