This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How Do I Get Patser To Compile On Linux/Osx?

Hello -

I am having trouble compiling the Patser (v3e) motif search tool from the Stormo lab. I've tried on BioLinux 7 and OSX 10.6 with the same general error message:

$ make
gcc -O2          -DOPTIONS    -c -o options.o options.c
gcc -O2          -DOPTIONS    -c -o main.o main.c
In file included from options.h:24,
                 from main.c:14:
definitions.h:31:1: warning: "INFINITY" redefined
In file included from /usr/include/math.h:28,
                 from options.h:18,
                 from main.c:14:
/usr/include/architecture/i386/math.h:76:1: warning: this is the location of the previous definition
gcc -O2          -DOPTIONS    -c -o command-line.o command-line.c
In file included from options.h:24,
                 from command-line.c:10:
definitions.h:31:1: warning: "INFINITY" redefined
In file included from /usr/include/math.h:28,
                 from options.h:18,
                 from command-line.c:10:
/usr/include/architecture/i386/math.h:76:1: warning: this is the location of the previous definition
gcc -O2          -DOPTIONS    -c -o parse-line.o parse-line.c
In file included from options.h:24,
                 from parse-line.c:15:
definitions.h:31:1: warning: "INFINITY" redefined
In file included from /usr/include/math.h:28,
                 from options.h:18,
                 from parse-line.c:15:
/usr/include/architecture/i386/math.h:76:1: warning: this is the location of the previous definition
gcc -O2          -DOPTIONS    -c -o parse-line-help.o parse-line-help.c
In file included from options.h:24,
                 from parse-line-help.c:14:
definitions.h:31:1: warning: "INFINITY" redefined
In file included from /usr/include/math.h:28,
                 from options.h:18,
                 from parse-line-help.c:14:
/usr/include/architecture/i386/math.h:76:1: warning: this is the location of the previous definition
parse-line-help.c: In function ‘pl_Help’:
parse-line-help.c:27: error: invalid storage class for function ‘print_directions’
parse-line-help.c: At top level:
parse-line-help.c:44: warning: conflicting types for ‘print_directions’
parse-line-help.c:44: error: static declaration of ‘print_directions’ follows non-static declaration
parse-line-help.c:37: error: previous implicit declaration of ‘print_directions’ was here
make: *** [parse-line-help.o] Error 1

Note: the tar.gz file linked to above is a tarbomb so it is wise to put it in a separate directory before extracting.

motif

1 answer

The problem is that the "print_directions" function is declared inside another function, as indicated in the following warning:

parse-line-help.c:44: error: static declaration of ‘print_directions’ follows non-static declaration

To fix this you need to delete line27 from parse-line-help.c and paste it in at line 17.

The original source file is as follows:

/* Copyright 1997, 2002 Gerald Z. Hertz
 * May be copied for noncommercial purposes.
 *
 * Author:
 *   Gerald Z. Hertz
 *   gzhertz AT alum.mit.edu
 */


#ifndef OPTIONS
#include <stdio.h>
#include <stdlib.h>
#else
#include "options.h"
#endif
#include "parse-line.h"


/* Call the function "print_directions". */
int pl_Help(
     void *variable,     /* Address of the variable to be updated. */
     int argc,           /* Number of variables on the command line. */
     char *argv[],       /* The table of command line strings. */
     int i,              /* The index to the current command line string. */
     int k)              /* Index to current position of the current string. */
{
  static void print_directions(void);

  if (k != 0)
    {
      fprintf(stderr, "\"%s\" (item %d on the command line) ", argv[i], i);
      fprintf(stderr, "does not match any of the legal options.\n\n");
      return(NO);
    }
  else
    {
      print_directions();
      exit(0);
    }
}

/* Page the directions. */
static void print_directions(void)
{
  FILE *fp;                    /* Pointer to the paging format. */
  char *pager;                 /* Value of the environment variable PAGER. */
  void text_directions(FILE *fp);      /* The text of the directions. */


#ifndef unix
  text_directions(stdout);
#else
  /* Determine the format for printing the directions. */
  pager = getenv("PAGER");

  /* Determine the pointer to the printing format. */
  if (pager == (char *)NULL)
    fp = popen("more", "w");
  else
    fp = popen(pager, "w");

  /* Print the directions and close. */
  if (fp == (FILE *)NULL) fp = stdout;
  text_directions(fp);
  if (fp != stdout) pclose(fp);
#endif
}

The patched source file should look as follows:

/* Copyright 1997, 2002 Gerald Z. Hertz
 * May be copied for noncommercial purposes.
 *
 * Author:
 *   Gerald Z. Hertz
 *   gzhertz AT alum.mit.edu
 */


#ifndef OPTIONS
#include <stdio.h>
#include <stdlib.h>
#else
#include "options.h"
#endif
#include "parse-line.h"

static void print_directions(void);

/* Call the function "print_directions". */
int pl_Help(
     void *variable,     /* Address of the variable to be updated. */
     int argc,           /* Number of variables on the command line. */
     char *argv[],       /* The table of command line strings. */
     int i,              /* The index to the current command line string. */
     int k)              /* Index to current position of the current string. */
{

  if (k != 0)
    {
      fprintf(stderr, "\"%s\" (item %d on the command line) ", argv[i], i);
      fprintf(stderr, "does not match any of the legal options.\n\n");
      return(NO);
    }
  else
    {
      print_directions();
      exit(0);
    }
}

/* Page the directions. */
static void print_directions(void)
{
  FILE *fp;                    /* Pointer to the paging format. */
  char *pager;                 /* Value of the environment variable PAGER. */
  void text_directions(FILE *fp);      /* The text of the directions. */


#ifndef unix
  text_directions(stdout);
#else
  /* Determine the format for printing the directions. */
  pager = getenv("PAGER");

  /* Determine the pointer to the printing format. */
  if (pager == (char *)NULL)
    fp = popen("more", "w");
  else
    fp = popen(pager, "w");

  /* Print the directions and close. */
  if (fp == (FILE *)NULL) fp = stdout;
  text_directions(fp);
  if (fp != stdout) pclose(fp);
#endif
}

Making this edit should allow you to compile with no errors on linux and OSX.

Log in to answer this question.