Comment 5 for bug 14274

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-Id: <email address hidden>
Date: Mon, 08 Nov 2004 18:25:28 +0100
From: Andreas Jochens <email address hidden>
To: Debian Bug Tracking System <email address hidden>
Subject: hfsutils: FTBFS (amd64/gcc-3.4): Please use '#include <errno.h>' instead of 'extern int
 errno; '

Package: hfsutils
Severity: normal
Tags: patch

When building 'hfsutils' on amd64 with gcc-3.4 I get the following error:

gcc -Llibhfs hfssh.o tclhfs.o crc.o binhex.o copyin.o copyout.o charset.o darray.o dlist.o dstring.o glob.o suid.o version.o \
 -lhfs -L/usr/lib -ltcl8.3 -ldl -lieee -lm -o hfssh
collect2: ld terminated with signal 11 [Segmentation fault]
/usr/bin/ld: BFD 2.15 assertion fail ../../bfd/elflink.c:6081
make[1]: *** [hfssh] Error 1
make[1]: Leaving directory `/hfsutils-3.2.6'

With the attached patch 'hfsutils' can be compiled on amd64 using gcc-3.4.

Regards
Andreas Jochens

diff -urN ../tmp-orig/hfsutils-3.2.6/binhex.c ./binhex.c
--- ../tmp-orig/hfsutils-3.2.6/binhex.c 1998-09-18 22:56:22.000000000 +0000
+++ ./binhex.c 2004-11-04 15:06:17.913586968 +0000
@@ -38,8 +38,6 @@

 const char *bh_error = "no error";

-extern int errno;
-
 # define ERROR(code, str) (bh_error = (str), errno = (code))

 static FILE *file; /* input/output file */
diff -urN ../tmp-orig/hfsutils-3.2.6/copyin.c ./copyin.c
--- ../tmp-orig/hfsutils-3.2.6/copyin.c 1998-11-02 22:08:25.000000000 +0000
+++ ./copyin.c 2004-11-04 15:06:31.973449544 +0000
@@ -48,8 +48,6 @@

 const char *cpi_error = "no error";

-extern int errno;
-
 # define ERROR(code, str) (cpi_error = (str), errno = (code))

 # define MACB_BLOCKSZ 128
diff -urN ../tmp-orig/hfsutils-3.2.6/copyout.c ./copyout.c
--- ../tmp-orig/hfsutils-3.2.6/copyout.c 1998-04-11 08:26:54.000000000 +0000
+++ ./copyout.c 2004-11-04 15:06:41.784957968 +0000
@@ -49,8 +49,6 @@

 const char *cpo_error = "no error";

-extern int errno;
-
 # define ERROR(code, str) (cpo_error = (str), errno = (code))

 # define MACB_BLOCKSZ 128
diff -urN ../tmp-orig/hfsutils-3.2.6/hcwd.c ./hcwd.c
--- ../tmp-orig/hfsutils-3.2.6/hcwd.c 1998-04-11 08:26:56.000000000 +0000
+++ ./hcwd.c 2004-11-04 15:06:56.217763848 +0000
@@ -43,8 +43,6 @@
 static int mtabsz = 0, nmounts = 0;
 static int curvol = -1, dirty = 0;

-extern int errno;
-
 /*
  * NAME: addent()
  * DESCRIPTION: insert mount entry into table
diff -urN ../tmp-orig/hfsutils-3.2.6/hfsutil.h ./hfsutil.h
--- ../tmp-orig/hfsutils-3.2.6/hfsutil.h 1998-04-11 08:26:57.000000000 +0000
+++ ./hfsutil.h 2004-11-04 15:07:27.707976608 +0000
@@ -19,7 +19,7 @@
  * $Id: hfsutil.h,v 1.8 1998/04/11 08:26:57 rob Exp $
  */

-extern int errno;
+#include <errno.h>

 # define ERROR(code, str) (hfs_error = (str), errno = (code))

diff -urN ../tmp-orig/hfsutils-3.2.6/libhfs/libhfs.h ./libhfs/libhfs.h
--- ../tmp-orig/hfsutils-3.2.6/libhfs/libhfs.h 1998-11-02 22:09:02.000000000 +0000
+++ ./libhfs/libhfs.h 2004-11-04 15:05:36.494883568 +0000
@@ -22,7 +22,7 @@
 # include "hfs.h"
 # include "apple.h"

-extern int errno;
+#include <errno.h>

 # define ERROR(code, str) \
     do { hfs_error = (str), errno = (code); goto fail; } while (0)
diff -urN ../tmp-orig/hfsutils-3.2.6/librsrc/librsrc.h ./librsrc/librsrc.h
--- ../tmp-orig/hfsutils-3.2.6/librsrc/librsrc.h 1998-04-11 08:27:19.000000000 +0000
+++ ./librsrc/librsrc.h 2004-11-04 15:04:55.910053400 +0000
@@ -21,7 +21,7 @@

 # include "rsrc.h"

-extern int errno;
+#include <errno.h>

 # define ERROR(code, str) \
     do { rsrc_error = (str), errno = (code); goto fail; } while (0)
diff -urN ../tmp-orig/hfsutils-3.2.6/tclhfs.c ./tclhfs.c
--- ../tmp-orig/hfsutils-3.2.6/tclhfs.c 1998-11-02 22:08:32.000000000 +0000
+++ ./tclhfs.c 2004-11-04 15:04:12.253690176 +0000
@@ -29,6 +29,7 @@

 # include <stdio.h>
 # include <stdlib.h>
+# include <errno.h>
 # include <string.h>
 # include <ctype.h>
 # include <limits.h>
@@ -44,8 +45,6 @@
 # include "suid.h"
 # include "version.h"

-extern int errno;
-
 # define ERROR(code, str) (hfs_error = (str), errno = (code))

 # define SIZE(type, n) ((size_t) (sizeof(type) * (n)))