tags 519006 + patch
thanks

On Thu, 09 Apr 2009, I wrote:

> > > > /usr/bin/cc  -g -O2 -g -Wall -O2   
> > > > CMakeFiles/wbxml2xml.dir/wbxml2xml_tool.o 
> > > > CMakeFiles/wbxml2xml.dir/attgetopt.o  -o wbxml2xml -rdynamic 
> > > > ../src/libwbxml2.so.0.0.13 -lexpat 
> > > > /usr/bin/ld: non-dynamic relocations refer to dynamic symbol 
> > > > optopt@@GLIBC_2.0
> > > > /usr/bin/ld: failed to set dynamic section sizes: Bad value
> > > > collect2: ld returned 1 exit status
> 
> BTW: I noticed the same error message on mips and mipsel when
> autobuilding transfig:
> 
> https://buildd.debian.org/fetch.cgi?&pkg=transfig&ver=1%3A3.2.5.a-1&arch=mips&stamp=1238502583&file=log
> https://buildd.debian.org/fetch.cgi?&pkg=transfig&ver=1%3A3.2.5.a-1&arch=mipsel&stamp=1238035432&file=log
> 
> All other architectures build without problems.

It seems that optopt is variable name in libc, which conflicts with a
local used name in the local program.

I worked around this problem by renaming optopt (used in a local
getopt.c) to fig_optopt and after this transfig builded on
mipsel without problems (mips is still in the queue):

https://buildd.debian.org/fetch.cgi?&pkg=transfig&ver=1%3A3.2.5.a-2&arch=mipsel&stamp=1241950555&file=log

As far as I can see, that same should be possible in wbxml2.
The attached patch should help...

Tschoeeee

        Roland
diff -urN wbxml2-0.10.6.orig/tools/attgetopt.c wbxml2-0.10.6/tools/attgetopt.c
--- wbxml2-0.10.6.orig/tools/attgetopt.c	2009-04-24 16:49:50.000000000 +0200
+++ wbxml2-0.10.6/tools/attgetopt.c	2009-05-10 12:30:40.806445864 +0200
@@ -27,7 +27,7 @@
 #include <string.h>
 
 int optind = 1;
-int optopt;
+int wbxml_optopt;
 char *optarg;
 
 int
@@ -55,7 +55,7 @@
 		
 	}
 	
-	optopt = c = argv[optind][sp];
+	wbxml_optopt = c = argv[optind][sp];
 
 	/* Check for invalid option */
 	if (c == ':' || (cp = strchr(opts, c)) == NULL) {
diff -urN wbxml2-0.10.6.orig/tools/getopt.h wbxml2-0.10.6/tools/getopt.h
--- wbxml2-0.10.6.orig/tools/getopt.h	2009-04-24 16:49:50.000000000 +0200
+++ wbxml2-0.10.6/tools/getopt.h	2009-05-10 12:30:40.806445864 +0200
@@ -11,7 +11,7 @@
 
 int wbxml_getopt(int argc, char **argv, char *opts);
 extern int optind;
-extern int optopt;
+extern int wbxml_optopt;
 extern char *optarg;
 
 #endif

Reply via email to