[Libguestfs] hivex-1.2.7 build failure on Ubuntu 10.04, rpl_getopt, rpl_optind

Daniel Teitsort Daniel.Teitsort at visionsolutions.com
Mon Jun 27 22:32:44 UTC 2011

I'm trying to build hivex 1.2.7 on Ubuntu 10.04, and get the following failure:

	Making all in xml
	make[2]: Entering directory `/opt/sandbox/src/hivex/hivex-1.2.7/xml'
  	  CC     hivexml-hivexml.o
  	  CCLD   hivexml
	hivexml-hivexml.o: In function `main':
	/opt/sandbox/src/hivex/hivex-1.2.7/xml/hivexml.c:86: undefined reference to `rpl_getopt'
	/opt/sandbox/src/hivex/hivex-1.2.7/xml/hivexml.c:100: undefined reference to `rpl_optind'
	/opt/sandbox/src/hivex/hivex-1.2.7/xml/hivexml.c:133: undefined reference to `rpl_optind'
	ld returned 1 exit status
	make[2]: *** [hivexml] Error 1

(For completeness, I should say the building is occuring in a chroot environment where an Ubuntu 10.04 image resides, not on an Ubuntu 10.04 machine proper.  But, I doubt this has anything to do with the problem.)

Perhaps something has gone wrong in the adoptions of a replacement getopt and optind?  Said adoption was apparently triggered by the configure script, which reported:

	checking for working GNU getopt function... 

This in turn was likely due to this bit in the config script, since Ubuntu 10.04 reportedly uses 2.11 of glibc:

      /* This code fails on glibc 2.11.  */
         char *argv[] = { "program", "-b", "-a", NULL };
         optind = opterr = 0;
         if (getopt (3, argv, "+:a:b") != 'b')
           result |= 64;
         else if (getopt (3, argv, "+:a:b") != ':')
           result |= 64;
      return result;

I am able to build hivex 1.2.5 in this environment just fine.

I don't need hivexml, but haven't yet figured out how to turn off its build, and suspect other getopt uses will need to be replaced, anyhow.

Any suggestions?

Dan Teitsort

More information about the Libguestfs mailing list