#11 included getopt.h breaks build on Debian/PPC

closed-fixed
Dom Lachowicz
None
5
2000-10-25
2000-10-20
No

Hi, I'm using the latest stable Debian release for PowerPC (an Apple PowerBook G3 laptop), and I encountered a (solvable) problem in building wv-0.6.1 from source.

When compiling, it gave an error for the file wvWare.c, line 186:

static struct option long_options[] =

It didn't recognize the "struct option" type. The problem was that you included a getopt.h header file which was incompatible with the (GNU) ones on my system. Deleting wv's getopt.h, which forced the program to use the one in /usr/include, fixed the problem--the program then compiled and ran successfully.

In particular, I think the problem is that the included getopt.h file is wrapped in a #ifndef HAVE_UNISTD_H statement; since unistd.h is included by wvWare.c, getopt.h skips the struct option definition. Presumably, on your original system, unistd.h includes getopt.h and defines struct option. However, on my system (and presumably on other new versions of glibc), it doesn't work this way: unistd.h includes getopt.h, but with some hackery so that only POSIX functions are defined (not getopt_long and friends).

I would suggest calling getopt.h something else, and including the standard <getopt.h> if it is present on the system and getopt_long is available.

Thanks for your great work! This program is very useful to me, due to all those darn Word attachments people keep sending me.

Cordially,
Steven G. Johnson

Discussion

  • I have met the same problem on Debian GNU/Linux (potato-i386)
    but resolved it according to the above message.

    Thank you.

    Kong Hoon Lee

     
  • Dom Lachowicz
    Dom Lachowicz
    2000-10-25

    • assigned_to: nobody --> cinamod
    • status: open --> closed-fixed