Subject: compile problem

From: Mustafa Akgul <[email-masked]>
Date: Mon, 18 Oct 2004 14:10:25 +0300 (EET DST)

Hello,

I am  having difficulty  in  compiling  sttaist,  StatistX, gtoolkit.
This on mandrake 10.0  with gcc 3.3.2

I have found  binaries  for StatistX, libFoundation and gtoolkit.

I could not find binaries  and  compilation gives

gcc -o statist statist.o menue.o procs.o funcs.o data.o plot.o
memory_handling.o -lm
data.o(.text+0x7d): In function `makefilename':
: warning: the use of `tmpnam' is dangerous, better use `mkstemp'
statist.o(.text+0x289): In function `main':
: undefined reference to `errno'
statist.o(.text+0x3c9): In function `finish':
: undefined reference to `errno'
menue.o(.text+0x272b): In function `data_menu':
: undefined reference to `errno'
menue.o(.text+0x2812): In function `data_menu':
: undefined reference to `errno'
menue.o(.text+0x2b7a): In function `manipulate_menu':
: undefined reference to `errno'
menue.o(.text+0x2c77): more undefined references to `errno' follow
collect2: ld returned 1 exit status
make: *** [statist] Error 1

Any suggestions?

Regards
Mustafa Akgul

---

From: Andreas Beyer <[email-masked]>
Date: Mon, 18 Oct 2004 18:51:51 +0200

Hi,

statist does not include the header file errno.h in which errno is 
defined. To me this seems to be a bug. I have attached a patch that 
should fix the problem. However, I cannot test it, because I don't have 
access to Mandrake.
Please, Mustafa: Could you test the patch and report if you were 
successful? Thanks!
To apply the patch go to statist-1.0.1/ and run:
$ patch -p0 < errno.patch

Andreas

-- 
--------------------------------------
   Dr. Andreas Beyer - [email-masked]
   http://www.imb-jena.de/~beyer
--------------------------------------
diff -d -b -C 2 src/iodefs.c src/iodefs.c
*** src/iodefs.c	2001-11-15 22:16:36.000000000 +0100
--- src/iodefs.c	2004-10-18 18:03:36.000000000 +0200
***************
*** 12,17 ****
  #include<stdio.h>
  #include<string.h>
! 
! extern int errno;
  
  #define FOPEN(name, mode, fp)                                     \
--- 12,16 ----
  #include<stdio.h>
  #include<string.h>
! #include <errno.h>
  
  #define FOPEN(name, mode, fp)                                     \
diff -d -b -C 2 src/statist.c src/statist.c
*** src/statist.c	2001-11-15 22:29:32.000000000 +0100
--- src/statist.c	2004-10-18 18:00:01.000000000 +0200
***************
*** 294,298 ****

! void out_err(int errno, char *modulname, int lno, char *fmt, ...) {
    va_list argptr;
    int error;
--- 294,298 ----

! void out_err(int errno_val, char *modulname, int lno, char *fmt, ...) {
    va_list argptr;
    int error;
***************
*** 300,304 ****
  
    va_start(argptr, fmt);
!   switch (errno) {
      case WAR: strcpy(line, 
      		_("> statist-warning ",
--- 300,304 ----
  
    va_start(argptr, fmt);
!   switch (errno_val) {
      case WAR: strcpy(line, 
      		_("> statist-warning ",
***************
*** 323,327 ****
    }
  
!   error = errno;
    if (lno != 0) {
      sprintf(where, 
--- 323,327 ----
    }
  
!   error = errno_val;
    if (lno != 0) {
      sprintf(where, 
***************
*** 341,345 ****
    }
    vfprintf(stderr, line, argptr);
!   if ( ((errno==MAT) || (errno==MWA)) && (log_set) ) {
      vfprintf(logfile, line, argptr);
    }
--- 341,345 ----
    }
    vfprintf(stderr, line, argptr);
!   if ( ((errno_val==MAT) || (errno_val==MWA)) && (log_set) ) {
      vfprintf(logfile, line, argptr);
    }
diff -d -b -C 2 src/statist.h src/statist.h
*** src/statist.h	2001-11-15 22:29:52.000000000 +0100
--- src/statist.h	2004-10-18 18:04:08.000000000 +0200
***************
*** 14,17 ****
--- 14,18 ----
  
  #include <stdio.h>
+ #include <errno.h>
  
  #include "gettext.h"
***************
*** 110,116 ****
  #ifdef SUNOS
  extern char *sys_errlist[];
! #define STRERROR(errno) sys_errlist[errno]
  #else
! #define STRERROR(errno) strerror(errno)
  #endif
  
--- 111,117 ----
  #ifdef SUNOS
  extern char *sys_errlist[];
! #define STRERROR(errno_val) sys_errlist[errno_val]
  #else
! #define STRERROR(errno_val) strerror(errno_val)
  #endif
  
***************
*** 241,245 ****

- extern int errno;
  extern void mywait();
  extern BOOLEAN myexist(char *name);
--- 242,245 ----
***************
*** 253,257 ****
  extern void out_d(char *fmt, ...);
  extern void out_r(char *fmt, ...);
! extern void out_err(int errno, char *modul, int lno, char *fmt, ...);
  extern void print_histo(REAL x[], int y[], int n);
  extern void finish();
--- 253,257 ----
  extern void out_d(char *fmt, ...);
  extern void out_r(char *fmt, ...);
! extern void out_err(int errno_val, char *modul, int lno, char *fmt, ...);
  extern void print_histo(REAL x[], int y[], int n);
  extern void finish();