Subject: pkg/37409: Neither pkgtools/libnbcompat nor devel/libgetopt work on IRIX
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <srcshelton@gmail.com>
List: pkgsrc-bugs
Date: 11/20/2007 21:40:00
>Number:         37409
>Category:       pkg
>Synopsis:       Neither pkgtools/libnbcompat nor devel/libgetopt work on IRIX
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 20 21:40:00 +0000 2007
>Originator:     Stuart Shelton
>Release:        n/a - pkgsrc from CVS
>Organization:
>Environment:
IRIX64 octane 6.5 07202013 IP30 - MIPSpro 7.4.4m compilers
>Description:

pkgtools/libnbcompat does not work on IRIX (and probably hasn't since buildlink3.mk was exchanged for inplace.mk).

The affected packages seem to be:

pkgtools/mtree
textproc/groff
audio/speex
(and pkgtools/p5-pkgsrc-Dewey fails because it *lacks* libnbcompat - see pkg/37380)

I've already reported the problems with vorbis-tools in pkg/37253, which also covers groff.


Additionally, many packages now include devel/libgetopt, and these fail to work either.  This is frustrating, because previously this could be fixed be removing libgetopt and including libnbcompat instead - but this no longer works.  I've specifically noticed:

fonts/ttmkfdir2
audio/vorbis-tools

... and yet other packages, such as misc/watch, which require libnbcompat or libgetopt, but include neither.
>How-To-Repeat:


speex fails with:

Making all in include
Making all in speex
Making all in src
source='speexenc.c' object='speexenc.o' libtool=no  depfile='.deps/speexenc.Po' tmpdepfile='.deps/speexenc.TPo'  depmode=sgi /bin/ksh ../depcomp  cc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DWORDS_BIGENDIAN=1 -DHAVE_LIBOGG=1 -DHAVE_LIBM=1 -DSPEEX_VERSION=\"1.0.5\" -DSPEEX_MAJOR_VERSION=1 -DSPEEX_MINOR_VERSION=0 -DSPEEX_MICRO_VERSION=5 -DSPEEX_EXTRA_VERSION=\"\" -I. -I. -I../include -I../libspeex  -I/usr/bsd/include   -I/usr/bsd/include -D__inline__=inline  -c99 -O2 -n32 -mips4 -r14000 -apo -float_const -use_readonly_const -TARG:isa=mips4:platform=ip30:processor=r14000 -TENV:zeroinit_in_bss=ON -OPT:fast_io=ON:Olimit=8192:reorg_common=ON:swp=ON -LNO:auto_dist=ON:fusion_peeling_limit=8:gather_scatter=2 -wof
 f 1174,1183,1185,1552,3970,3968 -n32 -I/usr/bsd/include -c speexenc.c
cc-1070 cc: ERROR File = speexenc.c, Line = 221
  The indicated type is incomplete.

     struct option long_options[] =
                   ^

cc-1020 cc: ERROR File = speexenc.c, Line = 223
  The identifier "no_argument" is undefined.

        {"wideband", no_argument, NULL, 0},
                     ^

cc-1020 cc: ERROR File = speexenc.c, Line = 227
  The identifier "required_argument" is undefined.

        {"abr", required_argument, NULL, 0},
                ^

cc-1196 cc: WARNING File = speexenc.c, Line = 281
  The indicated function is declared implicitly.

        c = getopt_long (argc, argv, "nwuhvV",
            ^

3 errors detected in the compilation of "speexenc.c".
*** Error code 2

Stop.
bmake: stopped in /usr/bsd/var/tmp/audio/speex/work/speex-1.0.5/src
*** Error code 1

Stop.
bmake: stopped in /usr/bsd/var/tmp/audio/speex/work/speex-1.0.5
*** Error code 1

Stop.
bmake: stopped in /usr/bsd/src/audio/speex
*** Error code 1

Stop.
bmake: stopped in /usr/bsd/src/audio/speex


vorbis-tools fails with:

source='cmdline_options.c' object='cmdline_options.o' libtool=no  DEPDIR=.deps depmode=sgi /bin/ksh ../depcomp  cc -DLOCALEDIR=\"/usr/bsd/share/locale\" -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/bsd/include   -I/usr/bsd/include   -I/usr/bsd/include -I/usr/bsd/include  -D_REENTRANT -I../include -I../intl   -I/usr/bsd/include -D__inline__=inline -I/usr/include -I/usr/bsd/include -I/usr/bsd/include  -O2 -w -signed -c99 -O2 -n32 -mips4 -r14000 -apo -float_const -use_readonly_const -TARG:isa=mips4:platform=ip30:processor=r14000 -TENV:zeroinit_in_bss=ON -OPT:fast_io=ON:Olimit=8192:reorg_common=ON:swp=ON -LNO:auto_dist=ON:fusion_peeling_limit=8:gather_scatter=2 -woff 1174,1183,1185,1552,3970,3968 -n32 -I/usr/bsd/include -I/usr/include -c cmdline_options.c
cc-1020 cc: ERROR File = cmdline_options.c, Line = 87
  The identifier "optarg" is undefined.

          ogg123_opts->buffer_size = 1024 * atoi(optarg);
                                                 ^

cc-1020 cc: ERROR File = cmdline_options.c, Line = 94
  The identifier "optarg" is undefined.

        ogg123_opts->input_buffer_size = atoi(optarg) * 1024;
                                              ^

cc-1020 cc: ERROR File = cmdline_options.c, Line = 275
  The identifier "optind" is undefined.

    return optind;
           ^

3 errors detected in the compilation of "cmdline_options.c".
*** Error code 2

Stop.
bmake: stopped in /usr/bsd/var/tmp/audio/vorbis-tools/work/vorbis-tools-1.1.1/ogg123
*** Error code 1

Stop.
bmake: stopped in /usr/bsd/var/tmp/audio/vorbis-tools/work/vorbis-tools-1.1.1
*** Error code 1

Stop.
bmake: stopped in /usr/bsd/var/tmp/audio/vorbis-tools/work/vorbis-tools-1.1.1
*** Error code 1

Stop.
bmake: stopped in /usr/bsd/src/audio/vorbis-tools
*** Error code 1

Stop.
bmake: stopped in /usr/bsd/src/audio/vorbis-tools


mtree fails with:

===> build-message [mtree-20070710] ===> Building for mtree-20070710
cc -DHAVE_CONFIG_H -I/usr/bsd/include -D__inline__=inline -I. -I. -c99 -O2 -n32 -mips4 -r14000 -apo -float_const -use_readonly_const -TARG:isa=mips4:platform=ip30:processor=r14000 -TENV:zeroinit_in_bss=ON -OPT:fast_io=ON:Olimit=8192:reorg_common=ON:swp=ON -LNO:auto_dist=ON:fusion_peeling_limit=8:gather_scatter=2 -woff 1174,1183,1185,1552,3970,3968 -n32 -c compare.c
cc-1005 cc: ERROR File = compare.c, Line = 39
  The source file "nbcompat.h" is unavailable.

  #include <nbcompat.h>
                       ^

1 catastrophic error detected in the compilation of "compare.c".
Compilation terminated.
*** Error code 2

Stop.
bmake: stopped in /usr/bsd/var/tmp/pkgtools/mtree/work/mtree-20070710
*** Error code 1

Stop.
bmake: stopped in /usr/bsd/src/pkgtools/mtree
*** Error code 1

Stop.
bmake: stopped in /usr/bsd/src/pkgtools/mtree


(Note that this is despite the fact that work/libnbcompat does exist and has been compiled)


font/ttmkfdir2 fails with:

libtool --mode=compile CC -I/usr/bsd/include -D__inline__=inline -I/usr/include -I/usr/bsd/include/freetype2 -O2 -n32 -mips4 -r14000 -apo -float_const -use_readonly_const -TARG:isa=mips4:platform=ip30:processor=r14000 -TENV:zeroinit_in_bss=ON -OPT:fast_io=ON:Olimit=8192:reorg_common=ON:swp=ON -LNO:auto_dist=ON:fusion_peeling_limit=8:gather_scatter=2 -woff 1174,1183,1185,1552,3970,3968 -FE:eliminate_duplicate_inline_copies:template_in_elf_section -I/usr/bsd/include -I/usr/include -I/usr/bsd/include/freetype2 `/usr/bsd/bin/freetype-config --cflags` -o commandline.o -c commandline.cpp
 CC -I/usr/bsd/var/tmp/fonts/ttmkfdir2/work/.buildlink/include -D__inline__=inline -I/usr/bsd/var/tmp/fonts/ttmkfdir2/work/.buildlink/include/freetype2 -O2 -n32 -mips4 -r14000 -apo -float_const -use_readonly_const -TARG:isa=mips4:platform=ip30:processor=r14000 -TENV:zeroinit_in_bss=ON -OPT:fast_io=ON:Olimit=8192:reorg_common=ON:swp=ON -woff 1174,1183,1185,1552,3970,3968 -FE:eliminate_duplicate_inline_copies:template_in_elf_section -c commandline.cpp  -DPIC -o .libs/commandline.o
cc-1020 CC: ERROR File = commandline.cpp, Line = 65
  The identifier "optarg" is undefined.

            o->value = o->argument ? optarg : "true";
                                     ^

1 error detected in the compilation of "commandline.cpp".
gmake: *** [commandline.o] Error 1
*** Error code 2

Stop.
bmake: stopped in /usr/bsd/src/fonts/ttmkfdir2
*** Error code 1

Stop.
bmake: stopped in /usr/bsd/src/fonts/ttmkfdir2



misc/watch fails with:

===> build-message [watch-3.2.6nb1] ===> Building for watch-3.2.6nb1
cc -c99 -O2 -n32 -mips4 -r14000 -apo -float_const -use_readonly_const -TARG:isa=mips4:platform=ip30:processor=r14000 -TENV:zeroinit_in_bss=ON -OPT:fast_io=ON:Olimit=8192:reorg_common=ON:swp=ON -LNO:auto_dist=ON:fusion_peeling_limit=8:gather_scatter=2 -woff 1174,1183,1185,1552,3970,3968 -n32 -I/usr/bsd/include   -I/usr/bsd/include -D__inline__=inline -c watch.c
cc-1070 cc: ERROR File = watch.c, Line = 34
  The indicated type is incomplete.

  static struct option longopts[] = {
                       ^

cc-1020 cc: ERROR File = watch.c, Line = 35
  The identifier "optional_argument" is undefined.

        {"differences", optional_argument, 0, 'd'},
                        ^

cc-1020 cc: ERROR File = watch.c, Line = 36
  The identifier "no_argument" is undefined.

        {"help", no_argument, 0, 'h'},
                 ^

cc-1020 cc: ERROR File = watch.c, Line = 37
  The identifier "required_argument" is undefined.

        {"interval", required_argument, 0, 'n'},
                     ^

cc-1196 cc: WARNING File = watch.c, Line = 152
  The indicated function is declared implicitly.

        while ((optc = getopt_long(argc, argv, "+d::hn:vt", longopts, (int *) 0))
                       ^

cc-1196 cc: WARNING File = watch.c, Line = 260
  The indicated function is declared implicitly.

                        asprintf(&header, "Every %.1fs: %.*s",
                        ^

4 errors detected in the compilation of "watch.c".
*** Error code 2

Stop.
bmake: stopped in /usr/bsd/var/tmp/misc/watch/work/procps-3.2.6
*** Error code 1

Stop.
bmake: stopped in /usr/bsd/src/misc/watch
*** Error code 1

Stop.
bmake: stopped in /usr/bsd/src/misc/watch

>Fix:

It looks to me as if *anything* using getopt_long (or symbols which go with it: optind, etc.) is fubar - but the loss of speex and vorbis-tools for audio and groff for viewing manpages is especially painful - and all of the above examples *did work* with libnbcompat/buildlink3.mk.

Previously, in cases where libgetopt was used, libnbcompat/buildlink3.mk could be substituted, and all would compile cleanly.

But since buildlink3.mk has changed for inplace.mk, none of these fixes work any longer - packages including libgetopt are still broken, and packages needing libnbcompat no longer work either!