[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MacOS X getopt etc. problem (Re: Compiling namazu)

In the article [namazu-users-en : No.00432] 
To: namazu-users-en@xxxxxxxxxx
From: Makoto Fujiwara <makoto@xxxxx>
Date: Sun, 13 Jul 2003 12:13:30 +0900
Message-ID: <yfm7k6nm84l.wl@xxxxxxxxxxx>

Kris> I tried this; it didn't work. I also found LIBS = -lm lines in several 
Kris> other Makefiles and removed the "-lm"...I'm still getting the errors;

Kris> ld: multiple definitions of symbol _getopt

mef> There were some discussions and reports on namazu-users-ja Mailing
mef> List.  

mef> Based on that discussion, I have not-sofisticated-patch for MacOS X.
mef> I have confirmed 'make check' works up to

I have looked around the problem again, and found old article that 
Ryuji Abe pointed out kakasi should have the similar getopt.c with no 
problem. Finally the one line patch fixed this problem. This will be 
included in namazu-2.0.13.

Makoto Fujiwara, 
Chiba, Japan, Narita Airport and Disneyland prefecture.

Index: lib/getopt.c
RCS file: /storage/cvsroot/namazu/lib/getopt.c,v
retrieving revision
retrieving revision
diff -u -r1.2.8.2 -r1.2.8.3
--- lib/getopt.c	18 Jan 2002 05:11:33 -0000
+++ lib/getopt.c	14 Jul 2003 13:33:07 -0000
@@ -1,3 +1,4 @@
+/* $Id: getopt.c,v 2003/07/14 13:33:07 makoto Exp $ */
 /* Getopt for GNU.
    NOTE: getopt is now part of the C library, so if you don't know what
    "Keep this file name-space clean" means, talk to drepper@xxxxxxx
@@ -110,7 +111,14 @@
    Also, when `ordering' is RETURN_IN_ORDER,
    each non-option ARGV-element is returned here.  */
-char *optarg;
+char *optarg = NULL;  
+  /* 
+  Above initialization is required to avoid following problem on MacOS X 10.1,10.2.6
+  (This is the only difference from gengetopt-2.5. ... 2003/07/14 ... )
+  ld: multiple definitions of symbol _getopt
+  /usr/lib/libm.dylib(getopt.So) definition of _getopt
+  ../lib/libnmzut.a(getopt.o) definition of _getopt in section (__TEXT,__text)
+  */
 /* Index in ARGV of the next element to be scanned.
    This is used for communication to and from the caller