🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #8898

gdb 4.6 compiler error on Sun 4/330: undefined symbol

#8898
From: Douglas Scott
Date: Thu, 16 Jul 1992 21:47
65 lines
2625 bytes
System:  Sun 4/330 running SunOS 4.1
Version:  Gdb 4.6 compiled with cc:
	configured sparc-sun-sunos4.1

When compiled using the Sun native C compiler (which is the default in the  
Makefile), the following error occurs:

cc -DGCC_MANGLE_BUG    -o gdb \
  init.o main.o blockframe.o breakpoint.o findvar.o stack.o source.o  values.o eval.o  
valops.o valarith.o valprint.o printcmd.o  symtab.o symfile.o symmisc.o infcmd.o  
infrun.o remote.o  command.o utils.o expprint.o environ.o version.o gdbtypes.o   
copying.o exec.o sparc-tdep.o sparc-pinsn.o solib.o infptrace.o sparc-xdep.o  
ser-termios.o cplus-dem.o mem-break.o target.o  inftarg.o ieee-float.o putenv.o  
parse.o language.o c-exp.tab.o m2-exp.tab.o  buildsym.o objfiles.o minsyms.o maint.o  
demangle.o  dbxread.o coffread.o elfread.o dwarfread.o xcoffread.o mipsread.o  
core.o inflow.o     ./../bfd/libbfd.a  ./../readline/libreadline.a -ltermcap  
./../mmalloc/libmmalloc.a ./../libiberty/libiberty.a    

ld: Undefined symbol 

   _strerror 

*** Error code 2
make: Fatal error: Command failed for target `gdb'
Current working directory /snd3/src/gnu/gdb-4.6/gdb
*** Error code 1
make: Fatal error: Command failed for target `all-gdb'

...because Sun systems do not have a built-in strerror() function.

Here is a very unofficial patch to fix this:

*** gdb/utils.c.orig	Thu Jul 16 14:30:05 1992
--- gdb/utils.c	Thu Jul 16 14:37:50 1992
***************
*** 311,316 ****
--- 311,332 ----
    exit (1);
  }
  

+ #if defined(sun) && !defined(__GNUC__)
+ 

+ /* Suns do not have a built-in strerror function in the native compiler */
+ 

+ extern char *sys_errlist[];
+ extern int sys_nerr;
+ 

+ char *
+ strerror(errnum)
+      int errnum;
+ {
+      return (errnum < sys_nerr ? sys_errlist[errnum] : NULL);
+ }
+ 

+ #endif
+ 

  /* The strerror() function can return NULL for errno values that are
     out of range.  Provide a "safe" version that always returns a
     printable string. */
Technical Details
Message-ID: <9207162147.AA02295@foxtrot.ccmrc.ucsb.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!foxtrot.ccmrc.ucsb.edu!doug

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5053,e3ff3be64a43e793,start
X-Google-Attributes: gidf5053,public
X-Google-ArrivalTime: 1992-07-16 17:33:48 PST
Newsgroups: gnu.gdb.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!foxtrot.ccmrc.ucsb.edu!doug
From: doug@foxtrot.ccmrc.ucsb.edu (Douglas Scott)
Subject: gdb 4.6 compiler error on Sun 4/330:  undefined symbol
Message-ID: <9207162147.AA02295@foxtrot.ccmrc.ucsb.edu>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 16 Jul 1992 21:47:40 GMT
Approved: bug-gdb@prep.ai.mit.edu
Lines: 67