Subject: something's very wrong with buildlink wrapper command line parameter reordering
To: NetBSD Packages Technical Discussion List <tech-pkg@NetBSD.ORG>
From: Greg A. Woods <woods@weird.com>
List: tech-pkg
Date: 01/13/2005 15:27:28
As y'all know I really like to link everything statically if possible.

Oddly, ha ha, this practice reveals a lot of very sloppy engineering in
some software since developers often fail to test to see if their code
will actually link statically or not.  I've found that any static-link
failures are always guarantees of other, sometimes hidden, bugs in the
code (especially when there are symbol clashes).  The rest of the
failures are usually just mundane mistakes or misunderstandings in
library dependencies.

However sometimes it seems it's not the original software engineers who
are making the mistakes, but rather the pkgsrc infrastructure itself.

Note that FLTK is designed to be linked statically -- according to its
authors -- so I'm definitely not stretching the envelope with this
particular package.

Note also that I was able to successfully build a static-linked fltk
package from the 2004Q3 branch.

However an attempt to build it with LDFLAGS=-static now fails (on the
2004Q4 branch), but seemingly only because the buildlink wrapper script
now incorrectly rearranges the library parameters on the command line.

Here's what I see when I type "make":

[ttyp2]<woods@always> # mv work/.work.log work/.work.log-save
[ttyp2]<woods@always> # rm work/.build_done
[ttyp2]<woods@always> # make
===> Checking for vulnerabilities in fltk-1.1.5
===> Building for fltk-1.1.5
=== making src ===
=== making fluid ===
Linking fluid...
*** Warning: inferring the mode of operation is deprecated.
*** Future versions of Libtool will require -mode=MODE be specified.
c++ -O2 -Wall -Wunused -Wconversion -fno-exceptions -I/var/package-obj/x11/fltk/work/.buildlink/include -DGLX_GLXEXT_LEGACY -O2 -march=pentiumpro -g -I/var/package-obj/x11/fltk/work/.x11-buildlink/include -o fluid Fl_Function_Type.o Fl_Menu_Type.o Fl_Group_Type.o Fl_Widget_Type.o Fl_Type.o Fl_Window_Type.o Fluid_Image.o code.o factory.o file.o fluid.o align_widget.o about_panel.o widget_panel.o alignment_panel.o function_panel.o -Wl,-R/usr/pkg/lib -Wl,-R/usr/X11R6/lib -static  -L/build/package-obj/x11/fltk/work/fltk-1.1.5/lib -lfltk_forms -lfltk_images ../src/.libs/libfltk.a -L/var/package-obj/x11/fltk/work/.x11-buildlink/lib -L/var/package-obj/x11/fltk/work/.buildlink/lib /var/package-obj/x11/fltk/work/.buildlink/lib/libpng.a -lz /var/package-obj/x11/fltk/work/.buildlink/lib/libjpeg.a /var/package-obj/x11/fltk/work/.buildlink/lib/libGLU.a /var/package-obj/x11/fltk/work/.buildlink/lib/libGL.a -lm -lXext -lX11
/var/package-obj/x11/fltk/work/fltk-1.1.5/lib/libfltk_images.a(Fl_JPEG_Image.o): In function `Fl_JPEG_Image::Fl_JPEG_Image(char const *)':
/build/package-obj/x11/fltk/work/fltk-1.1.5/src/Fl_JPEG_Image.cxx:86: undefined reference to `jpeg_std_error'
/build/package-obj/x11/fltk/work/fltk-1.1.5/src/Fl_JPEG_Image.cxx:89: undefined reference to `jpeg_CreateDecompress'
/build/package-obj/x11/fltk/work/fltk-1.1.5/src/Fl_JPEG_Image.cxx:90: undefined reference to `jpeg_stdio_src'
/build/package-obj/x11/fltk/work/fltk-1.1.5/src/Fl_JPEG_Image.cxx:91: undefined reference to `jpeg_read_header'
/build/package-obj/x11/fltk/work/fltk-1.1.5/src/Fl_JPEG_Image.cxx:98: undefined reference to `jpeg_calc_output_dimensions'
/build/package-obj/x11/fltk/work/fltk-1.1.5/src/Fl_JPEG_Image.cxx:107: undefined reference to `jpeg_start_decompress'
/build/package-obj/x11/fltk/work/fltk-1.1.5/src/Fl_JPEG_Image.cxx:114: undefined reference to `jpeg_read_scanlines'
/build/package-obj/x11/fltk/work/fltk-1.1.5/src/Fl_JPEG_Image.cxx:117: undefined reference to `jpeg_finish_decompress'
/build/package-obj/x11/fltk/work/fltk-1.1.5/src/Fl_JPEG_Image.cxx:118: undefined reference to `jpeg_destroy_decompress'
/var/package-obj/x11/fltk/work/fltk-1.1.5/lib/libfltk_images.a(Fl_PNG_Image.o): In function `Fl_PNG_Image::Fl_PNG_Image(char const *)':
/build/package-obj/x11/fltk/work/fltk-1.1.5/src/Fl_PNG_Image.cxx:73: undefined reference to `png_create_read_struct'
/build/package-obj/x11/fltk/work/fltk-1.1.5/src/Fl_PNG_Image.cxx:74: undefined reference to `png_create_info_struct'
/build/package-obj/x11/fltk/work/fltk-1.1.5/src/Fl_PNG_Image.cxx:83: undefined reference to `png_init_io'
/build/package-obj/x11/fltk/work/fltk-1.1.5/src/Fl_PNG_Image.cxx:86: undefined reference to `png_read_info'
/build/package-obj/x11/fltk/work/fltk-1.1.5/src/Fl_PNG_Image.cxx:89: undefined reference to `png_set_expand'
/build/package-obj/x11/fltk/work/fltk-1.1.5/src/Fl_PNG_Image.cxx:105: undefined reference to `png_set_packing'
/build/package-obj/x11/fltk/work/fltk-1.1.5/src/Fl_PNG_Image.cxx:106: undefined reference to `png_set_expand'
/build/package-obj/x11/fltk/work/fltk-1.1.5/src/Fl_PNG_Image.cxx:109: undefined reference to `png_set_strip_16'
/build/package-obj/x11/fltk/work/fltk-1.1.5/src/Fl_PNG_Image.cxx:127: undefined reference to `png_set_interlace_handling'
/build/package-obj/x11/fltk/work/fltk-1.1.5/src/Fl_PNG_Image.cxx:128: undefined reference to `png_read_rows'
/build/package-obj/x11/fltk/work/fltk-1.1.5/src/Fl_PNG_Image.cxx:143: undefined reference to `png_read_end'
/build/package-obj/x11/fltk/work/fltk-1.1.5/src/Fl_PNG_Image.cxx:144: undefined reference to `png_destroy_read_struct'
gmake[1]: *** [fluid] Error 1
=> Unwrapping files-to-be-installed.


The errors look to be impossible given the comamnd-line above, but yet
there they are. and they won't go away when you blink.


(I'm not sure yet why the error code is ignored, though that's probably
got to do with the simplistic subdir handling in fltk's top-level makefile)


However here's what the work/.work.log file reveals actually happens:

[*] /var/package-obj/x11/fltk/work/.wrapper/bin/libtool c++ -O2 -Wall -Wunused -Wconversion -fno-exceptions -I/usr/pkg/include -DGLX_GLXEXT_LEGACY -I/usr/include -O2 -march=pentiumpro -g -I/usr/pkg/include -DGLX_GLXEXT_LEGACY -I/usr/include -I/usr/X11R6/include -o fluid Fl_Function_Type.o Fl_Menu_Type.o Fl_Group_Type.o Fl_Widget_Type.o Fl_Type.o Fl_Window_Type.o Fluid_Image.o code.o factory.o file.o fluid.o align_widget.o about_panel.o widget_panel.o alignment_panel.o function_panel.o -L../lib -lfltk_forms ../src/libfltk.la -L../lib -lfltk_images ../src/libfltk.la -lpng -lz -ljpeg -L/usr/X11R6/lib -static -L/usr/X11R6/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/X11R6/lib -lGLU -lGL -lm -lXext -lX11
    (scan-libtool) mode: link
    (wrapper.sh) append args: -L/var/package-obj/x11/fltk/work/.buildlink/lib
    (arg-source) push: c++
    (arg-source) push: -O2
    (arg-source) push: -Wall
    (arg-source) push: -Wunused
    (arg-source) push: -Wconversion
    (arg-source) push: -fno-exceptions
    (arg-source) push: -I/usr/pkg/include
    (arg-source) push: -DGLX_GLXEXT_LEGACY
    (arg-source) push: -I/usr/include
    (arg-source) push: -O2
    (arg-source) push: -march=pentiumpro
    (arg-source) push: -g
    (arg-source) push: -I/usr/pkg/include
    (arg-source) push: -DGLX_GLXEXT_LEGACY
    (arg-source) push: -I/usr/include
    (arg-source) push: -I/usr/X11R6/include
    (arg-source) push: -o
    (arg-source) push: fluid
    (arg-source) push: Fl_Function_Type.o
    (arg-source) push: Fl_Menu_Type.o
    (arg-source) push: Fl_Group_Type.o
    (arg-source) push: Fl_Widget_Type.o
    (arg-source) push: Fl_Type.o
    (arg-source) push: Fl_Window_Type.o
    (arg-source) push: Fluid_Image.o
    (arg-source) push: code.o
    (arg-source) push: factory.o
    (arg-source) push: file.o
    (arg-source) push: fluid.o
    (arg-source) push: align_widget.o
    (arg-source) push: about_panel.o
    (arg-source) push: widget_panel.o
    (arg-source) push: alignment_panel.o
    (arg-source) push: function_panel.o
    (arg-source) push: -L../lib
    (arg-source) push: -lfltk_forms
    (arg-source) push: ../src/libfltk.la
    (arg-source) push: -L../lib
    (arg-source) push: -lfltk_images
    (arg-source) push: ../src/libfltk.la
    (arg-source) push: -lpng
    (arg-source) push: -lz
    (arg-source) push: -ljpeg
    (arg-source) push: -L/usr/X11R6/lib
    (arg-source) push: -static
    (arg-source) push: -L/usr/X11R6/lib
    (arg-source) push: -L/usr/pkg/lib
    (arg-source) push: -Wl,-R/usr/pkg/lib
    (arg-source) push: -L/usr/lib
    (arg-source) push: -Wl,-R/usr/lib
    (arg-source) push: -Wl,-R/usr/X11R6/lib
    (arg-source) push: -lGLU
    (arg-source) push: -lGL
    (arg-source) push: -lm
    (arg-source) push: -lXext
    (arg-source) push: -lX11
    (arg-source) push: -L/var/package-obj/x11/fltk/work/.buildlink/lib
    (logic) pop:  c++
    (logic) to:   c++ [untransformed]
    (logic) push: c++
    (logic) pop:  -O2
    (logic) to:   -O2 [cached]
    (logic) push: -O2
    (logic) pop:  -Wall
    (logic) to:   -Wall [cached]
    (logic) push: -Wall
    (logic) pop:  -Wunused
    (logic) to:   -Wunused [cached]
    (logic) push: -Wunused
    (logic) pop:  -Wconversion
    (logic) to:   -Wconversion [cached]
    (logic) push: -Wconversion
    (logic) pop:  -fno-exceptions
    (logic) to:   -fno-exceptions [cached]
    (logic) push: -fno-exceptions
    (logic) pop:  -I/usr/pkg/include
    (logic) to:   -I/var/package-obj/x11/fltk/work/.buildlink/include [cached]
    (logic) push: -I/var/package-obj/x11/fltk/work/.buildlink/include
    (logic) pop:  -DGLX_GLXEXT_LEGACY
    (logic) to:   -DGLX_GLXEXT_LEGACY [cached]
    (logic) push: -DGLX_GLXEXT_LEGACY
    (logic) pop:  -I/usr/include
    (logic) to:    [cached]
    (logic) push: 
    (logic) pop:  -O2
    (logic) to:   -O2 [cached]
    (logic) push: -O2
    (logic) pop:  -march=pentiumpro
    (logic) to:   -march=pentiumpro [cached]
    (logic) push: -march=pentiumpro
    (logic) pop:  -g
    (logic) to:   -g [cached]
    (logic) push: -g
    (logic) pop:  -I/usr/pkg/include
    (logic) to:   -I/var/package-obj/x11/fltk/work/.buildlink/include [cached]
    (logic) push: -I/var/package-obj/x11/fltk/work/.buildlink/include
    (logic) pop:  -DGLX_GLXEXT_LEGACY
    (logic) to:   -DGLX_GLXEXT_LEGACY [cached]
    (logic) push: -DGLX_GLXEXT_LEGACY
    (logic) pop:  -I/usr/include
    (logic) to:    [cached]
    (logic) push: 
    (logic) pop:  -I/usr/X11R6/include
    (logic) to:   -I/var/package-obj/x11/fltk/work/.x11-buildlink/include [cached]
    (logic) push: -I/var/package-obj/x11/fltk/work/.x11-buildlink/include
    (logic) pop:  -o
    (logic) to:   -o [cached]
    (logic) push: -o
    (logic) pop:  fluid
    (logic) push: fluid
    (logic) pop:  Fl_Function_Type.o
    (logic) to:   Fl_Function_Type.o [untransformed]
    (logic) push: Fl_Function_Type.o
    (logic) pop:  Fl_Menu_Type.o
    (logic) to:   Fl_Menu_Type.o [untransformed]
    (logic) push: Fl_Menu_Type.o
    (logic) pop:  Fl_Group_Type.o
    (logic) to:   Fl_Group_Type.o [untransformed]
    (logic) push: Fl_Group_Type.o
    (logic) pop:  Fl_Widget_Type.o
    (logic) to:   Fl_Widget_Type.o [untransformed]
    (logic) push: Fl_Widget_Type.o
    (logic) pop:  Fl_Type.o
    (logic) to:   Fl_Type.o [untransformed]
    (logic) push: Fl_Type.o
    (logic) pop:  Fl_Window_Type.o
    (logic) to:   Fl_Window_Type.o [untransformed]
    (logic) push: Fl_Window_Type.o
    (logic) pop:  Fluid_Image.o
    (logic) to:   Fluid_Image.o [untransformed]
    (logic) push: Fluid_Image.o
    (logic) pop:  code.o
    (logic) to:   code.o [untransformed]
    (logic) push: code.o
    (logic) pop:  factory.o
    (logic) to:   factory.o [untransformed]
    (logic) push: factory.o
    (logic) pop:  file.o
    (logic) to:   file.o [untransformed]
    (logic) push: file.o
    (logic) pop:  fluid.o
    (logic) to:   fluid.o [untransformed]
    (logic) push: fluid.o
    (logic) pop:  align_widget.o
    (logic) to:   align_widget.o [untransformed]
    (logic) push: align_widget.o
    (logic) pop:  about_panel.o
    (logic) to:   about_panel.o [untransformed]
    (logic) push: about_panel.o
    (logic) pop:  widget_panel.o
    (logic) to:   widget_panel.o [untransformed]
    (logic) push: widget_panel.o
    (logic) pop:  alignment_panel.o
    (logic) to:   alignment_panel.o [untransformed]
    (logic) push: alignment_panel.o
    (logic) pop:  function_panel.o
    (logic) to:   function_panel.o [untransformed]
    (logic) push: function_panel.o
    (logic) pop:  -L../lib
    (logic) to:   -L../lib
*** [buildlink3] Warning: libtool detected -L../lib
    (logic) push: -L../lib
    (logic) pop:  -lfltk_forms
    (logic) to:   -lfltk_forms [cached]
    (logic) push: -lfltk_forms
    (logic) pop:  ../src/libfltk.la
    (logic) to:   ../src/libfltk.la [untransformed]
    (logic) push: ../src/libfltk.la
    (logic) pop:  -L../lib
    (logic) to:   -L../lib
*** [buildlink3] Warning: libtool detected -L../lib
    (logic) push: -L../lib
    (logic) pop:  -lfltk_images
    (logic) to:   -lfltk_images [cached]
    (logic) push: -lfltk_images
    (logic) pop:  ../src/libfltk.la
    (logic) to:   ../src/libfltk.la [untransformed]
    (logic) push: ../src/libfltk.la
    (logic) pop:  -lpng
    (logic) to:   -lpng [cached]
    (logic) push: -lpng
    (logic) pop:  -lz
    (logic) to:   -lz [cached]
    (logic) push: -lz
    (logic) pop:  -ljpeg
    (logic) to:   -ljpeg [cached]
    (logic) push: -ljpeg
    (logic) pop:  -L/usr/X11R6/lib
    (logic) to:   -L/var/package-obj/x11/fltk/work/.x11-buildlink/lib [cached]
    (logic) push: -L/var/package-obj/x11/fltk/work/.x11-buildlink/lib
    (logic) pop:  -static
    (logic) to:   -static [cached]
    (logic) push: -static
    (logic) pop:  -L/usr/X11R6/lib
    (logic) to:   -L/var/package-obj/x11/fltk/work/.x11-buildlink/lib [cached]
    (logic) push: -L/var/package-obj/x11/fltk/work/.x11-buildlink/lib
    (logic) pop:  -L/usr/pkg/lib
    (logic) to:   -L/var/package-obj/x11/fltk/work/.buildlink/lib [cached]
    (logic) push: -L/var/package-obj/x11/fltk/work/.buildlink/lib
    (logic) pop:  -Wl,-R/usr/pkg/lib
    (logic) to:   -Wl,-R/usr/pkg/lib [cached]
    (logic) push: -Wl,-R/usr/pkg/lib
    (logic) pop:  -L/usr/lib
    (logic) to:    [cached]
    (logic) push: 
    (logic) pop:  -Wl,-R/usr/lib
    (logic) to:    [cached]
    (logic) push: 
    (logic) pop:  -Wl,-R/usr/X11R6/lib
    (logic) to:   -Wl,-R/usr/X11R6/lib [cached]
    (logic) push: -Wl,-R/usr/X11R6/lib
    (logic) pop:  -lGLU
    (logic) to:   -lGLU [cached]
    (logic) push: -lGLU
    (logic) pop:  -lGL
    (logic) to:   -lGL [cached]
    (logic) push: -lGL
    (logic) pop:  -lm
    (logic) to:   -lm [cached]
    (logic) push: -lm
    (logic) pop:  -lXext
    (logic) to:   -lXext [cached]
    (logic) push: -lXext
    (logic) pop:  -lX11
    (logic) to:   -lX11 [cached]
    (logic) push: -lX11
    (logic) pop:  -L/var/package-obj/x11/fltk/work/.buildlink/lib
    (logic) to:   -L/var/package-obj/x11/fltk/work/.buildlink/lib [cached]
    (logic) push: -L/var/package-obj/x11/fltk/work/.buildlink/lib
    (cmd-sink-libtool) pop:  c++
    (cmd-sink-libtool) pop:  -O2
    (cmd-sink-libtool) pop:  -Wall
    (cmd-sink-libtool) pop:  -Wunused
    (cmd-sink-libtool) pop:  -Wconversion
    (cmd-sink-libtool) pop:  -fno-exceptions
    (cmd-sink-libtool) pop:  -I/var/package-obj/x11/fltk/work/.buildlink/include
    (cmd-sink-libtool) pop:  -DGLX_GLXEXT_LEGACY
    (cmd-sink-libtool) pop:  
    (cmd-sink-libtool) pop:  -O2
    (cmd-sink-libtool) pop:  -march=pentiumpro
    (cmd-sink-libtool) pop:  -g
    (cmd-sink-libtool) pop:  -I/var/package-obj/x11/fltk/work/.buildlink/include
    (cmd-sink-libtool) pop:  -DGLX_GLXEXT_LEGACY
    (cmd-sink-libtool) pop:  
    (cmd-sink-libtool) pop:  -I/var/package-obj/x11/fltk/work/.x11-buildlink/include
    (cmd-sink-libtool) pop:  -o
    (cmd-sink-libtool) pop:  fluid
    (cmd-sink-libtool) pop:  Fl_Function_Type.o
    (cmd-sink-libtool) pop:  Fl_Menu_Type.o
    (cmd-sink-libtool) pop:  Fl_Group_Type.o
    (cmd-sink-libtool) pop:  Fl_Widget_Type.o
    (cmd-sink-libtool) pop:  Fl_Type.o
    (cmd-sink-libtool) pop:  Fl_Window_Type.o
    (cmd-sink-libtool) pop:  Fluid_Image.o
    (cmd-sink-libtool) pop:  code.o
    (cmd-sink-libtool) pop:  factory.o
    (cmd-sink-libtool) pop:  file.o
    (cmd-sink-libtool) pop:  fluid.o
    (cmd-sink-libtool) pop:  align_widget.o
    (cmd-sink-libtool) pop:  about_panel.o
    (cmd-sink-libtool) pop:  widget_panel.o
    (cmd-sink-libtool) pop:  alignment_panel.o
    (cmd-sink-libtool) pop:  function_panel.o
    (cmd-sink-libtool) pop:  -L../lib
    (cmd-sink-libtool) pop:  -lfltk_forms
    (cmd-sink-libtool) pop:  ../src/libfltk.la
    (cmd-sink-libtool) pop:  -L../lib
    (cmd-sink-libtool) pop:  -lfltk_images
    (cmd-sink-libtool) pop:  ../src/libfltk.la
    (cmd-sink-libtool) pop:  -lpng
    (cmd-sink-libtool) pop:  -lz
    (cmd-sink-libtool) pop:  -ljpeg
    (cmd-sink-libtool) pop:  -L/var/package-obj/x11/fltk/work/.x11-buildlink/lib
    (cmd-sink-libtool) pop:  -static
    (cmd-sink-libtool) pop:  -L/var/package-obj/x11/fltk/work/.x11-buildlink/lib
    (cmd-sink-libtool) pop:  -L/var/package-obj/x11/fltk/work/.buildlink/lib
    (cmd-sink-libtool) pop:  -Wl,-R/usr/pkg/lib
    (cmd-sink-libtool) pop:  
    (cmd-sink-libtool) pop:  
    (cmd-sink-libtool) pop:  -Wl,-R/usr/X11R6/lib
    (cmd-sink-libtool) pop:  -lGLU
    (cmd-sink-libtool) pop:  -lGL
    (cmd-sink-libtool) pop:  -lm
    (cmd-sink-libtool) pop:  -lXext
    (cmd-sink-libtool) pop:  -lX11
    (cmd-sink-libtool) pop:  -L/var/package-obj/x11/fltk/work/.buildlink/lib
<.> /usr/pkg/bin/libtool c++ -O2 -Wall -Wunused -Wconversion -fno-exceptions -I/var/package-obj/x11/fltk/work/.buildlink/include -DGLX_GLXEXT_LEGACY -O2 -march=pentiumpro -g -I/var/package-obj/x11/fltk/work/.x11-buildlink/include -o fluid Fl_Function_Type.o Fl_Menu_Type.o Fl_Group_Type.o Fl_Widget_Type.o Fl_Type.o Fl_Window_Type.o Fluid_Image.o code.o factory.o file.o fluid.o align_widget.o about_panel.o widget_panel.o alignment_panel.o function_panel.o -L../lib -lfltk_forms ../src/libfltk.la -lfltk_images ../src/libfltk.la -lpng -lz -ljpeg -L/var/package-obj/x11/fltk/work/.x11-buildlink/lib -static -L/var/package-obj/x11/fltk/work/.buildlink/lib -Wl,-R/usr/pkg/lib -Wl,-R/usr/X11R6/lib -lGLU -lGL -lm -lXext -lX11
[*] /var/package-obj/x11/fltk/work/.wrapper/bin/c++ -O2 -Wall -Wunused -Wconversion -fno-exceptions -I/var/package-obj/x11/fltk/work/.buildlink/include -DGLX_GLXEXT_LEGACY -O2 -march=pentiumpro -g -I/var/package-obj/x11/fltk/work/.x11-buildlink/include -o fluid Fl_Function_Type.o Fl_Menu_Type.o Fl_Group_Type.o Fl_Widget_Type.o Fl_Type.o Fl_Window_Type.o Fluid_Image.o code.o factory.o file.o fluid.o align_widget.o about_panel.o widget_panel.o alignment_panel.o function_panel.o -Wl,-R/usr/pkg/lib -Wl,-R/usr/X11R6/lib -static -L/build/package-obj/x11/fltk/work/fltk-1.1.5/lib -lfltk_forms -lfltk_images ../src/.libs/libfltk.a -L/var/package-obj/x11/fltk/work/.x11-buildlink/lib -L/var/package-obj/x11/fltk/work/.buildlink/lib /var/package-obj/x11/fltk/work/.buildlink/lib/libpng.a -lz /var/package-obj/x11/fltk/work/.buildlink/lib/libjpeg.a /var/package-obj/x11/fltk/work/.buildlink/lib/libGLU.a /var/package-obj/x11/fltk/work/.buildlink/lib/libGL.a -lm -lXext -lX11
    (wrapper.sh) append args: -I/var/package-obj/x11/fltk/work/.buildlink/include -L/var/package-obj/x11/fltk/work/.buildlink/lib
    (arg-source) push: -O2
    (arg-source) push: -Wall
    (arg-source) push: -Wunused
    (arg-source) push: -Wconversion
    (arg-source) push: -fno-exceptions
    (arg-source) push: -I/var/package-obj/x11/fltk/work/.buildlink/include
    (arg-source) push: -DGLX_GLXEXT_LEGACY
    (arg-source) push: -O2
    (arg-source) push: -march=pentiumpro
    (arg-source) push: -g
    (arg-source) push: -I/var/package-obj/x11/fltk/work/.x11-buildlink/include
    (arg-source) push: -o
    (arg-source) push: fluid
    (arg-source) push: Fl_Function_Type.o
    (arg-source) push: Fl_Menu_Type.o
    (arg-source) push: Fl_Group_Type.o
    (arg-source) push: Fl_Widget_Type.o
    (arg-source) push: Fl_Type.o
    (arg-source) push: Fl_Window_Type.o
    (arg-source) push: Fluid_Image.o
    (arg-source) push: code.o
    (arg-source) push: factory.o
    (arg-source) push: file.o
    (arg-source) push: fluid.o
    (arg-source) push: align_widget.o
    (arg-source) push: about_panel.o
    (arg-source) push: widget_panel.o
    (arg-source) push: alignment_panel.o
    (arg-source) push: function_panel.o
    (arg-source) push: -Wl,-R/usr/pkg/lib
    (arg-source) push: -Wl,-R/usr/X11R6/lib
    (arg-source) push: -static
    (arg-source) push: -L/build/package-obj/x11/fltk/work/fltk-1.1.5/lib
    (arg-source) push: -lfltk_forms
    (arg-source) push: -lfltk_images
    (arg-source) push: ../src/.libs/libfltk.a
    (arg-source) push: -L/var/package-obj/x11/fltk/work/.x11-buildlink/lib
    (arg-source) push: -L/var/package-obj/x11/fltk/work/.buildlink/lib
    (arg-source) push: /var/package-obj/x11/fltk/work/.buildlink/lib/libpng.a
    (arg-source) push: -lz
    (arg-source) push: /var/package-obj/x11/fltk/work/.buildlink/lib/libjpeg.a
    (arg-source) push: /var/package-obj/x11/fltk/work/.buildlink/lib/libGLU.a
    (arg-source) push: /var/package-obj/x11/fltk/work/.buildlink/lib/libGL.a
    (arg-source) push: -lm
    (arg-source) push: -lXext
    (arg-source) push: -lX11
    (arg-source) push: -I/var/package-obj/x11/fltk/work/.buildlink/include
    (arg-source) push: -L/var/package-obj/x11/fltk/work/.buildlink/lib
    (logic) pop:  -O2
    (logic) to:   -O2 [cached]
    (logic) push: -O2
    (logic) pop:  -Wall
    (logic) to:   -Wall [cached]
    (logic) push: -Wall
    (logic) pop:  -Wunused
    (logic) to:   -Wunused [cached]
    (logic) push: -Wunused
    (logic) pop:  -Wconversion
    (logic) to:   -Wconversion [cached]
    (logic) push: -Wconversion
    (logic) pop:  -fno-exceptions
    (logic) to:   -fno-exceptions [cached]
    (logic) push: -fno-exceptions
    (logic) pop:  -I/var/package-obj/x11/fltk/work/.buildlink/include
    (logic) to:   -I/var/package-obj/x11/fltk/work/.buildlink/include [cached]
    (logic) push: -I/var/package-obj/x11/fltk/work/.buildlink/include
    (logic) pop:  -DGLX_GLXEXT_LEGACY
    (logic) to:   -DGLX_GLXEXT_LEGACY [cached]
    (logic) push: -DGLX_GLXEXT_LEGACY
    (logic) pop:  -O2
    (logic) to:   -O2 [cached]
    (logic) push: -O2
    (logic) pop:  -march=pentiumpro
    (logic) to:   -march=pentiumpro [cached]
    (logic) push: -march=pentiumpro
    (logic) pop:  -g
    (logic) to:   -g [cached]
    (logic) push: -g
    (logic) pop:  -I/var/package-obj/x11/fltk/work/.x11-buildlink/include
    (logic) to:   -I/var/package-obj/x11/fltk/work/.x11-buildlink/include [cached]
    (logic) push: -I/var/package-obj/x11/fltk/work/.x11-buildlink/include
    (logic) pop:  -o
    (logic) to:   -o [cached]
    (logic) push: -o
    (logic) pop:  fluid
    (logic) push: fluid
    (logic) pop:  Fl_Function_Type.o
    (logic) to:   Fl_Function_Type.o [untransformed]
    (logic) push: Fl_Function_Type.o
    (logic) pop:  Fl_Menu_Type.o
    (logic) to:   Fl_Menu_Type.o [untransformed]
    (logic) push: Fl_Menu_Type.o
    (logic) pop:  Fl_Group_Type.o
    (logic) to:   Fl_Group_Type.o [untransformed]
    (logic) push: Fl_Group_Type.o
    (logic) pop:  Fl_Widget_Type.o
    (logic) to:   Fl_Widget_Type.o [untransformed]
    (logic) push: Fl_Widget_Type.o
    (logic) pop:  Fl_Type.o
    (logic) to:   Fl_Type.o [untransformed]
    (logic) push: Fl_Type.o
    (logic) pop:  Fl_Window_Type.o
    (logic) to:   Fl_Window_Type.o [untransformed]
    (logic) push: Fl_Window_Type.o
    (logic) pop:  Fluid_Image.o
    (logic) to:   Fluid_Image.o [untransformed]
    (logic) push: Fluid_Image.o
    (logic) pop:  code.o
    (logic) to:   code.o [untransformed]
    (logic) push: code.o
    (logic) pop:  factory.o
    (logic) to:   factory.o [untransformed]
    (logic) push: factory.o
    (logic) pop:  file.o
    (logic) to:   file.o [untransformed]
    (logic) push: file.o
    (logic) pop:  fluid.o
    (logic) to:   fluid.o [untransformed]
    (logic) push: fluid.o
    (logic) pop:  align_widget.o
    (logic) to:   align_widget.o [untransformed]
    (logic) push: align_widget.o
    (logic) pop:  about_panel.o
    (logic) to:   about_panel.o [untransformed]
    (logic) push: about_panel.o
    (logic) pop:  widget_panel.o
    (logic) to:   widget_panel.o [untransformed]
    (logic) push: widget_panel.o
    (logic) pop:  alignment_panel.o
    (logic) to:   alignment_panel.o [untransformed]
    (logic) push: alignment_panel.o
    (logic) pop:  function_panel.o
    (logic) to:   function_panel.o [untransformed]
    (logic) push: function_panel.o
    (logic) pop:  -Wl,-R/usr/pkg/lib
    (logic) to:   -Wl,-R/usr/pkg/lib [cached]
    (logic) push: -Wl,-R/usr/pkg/lib
    (logic) pop:  -Wl,-R/usr/X11R6/lib
    (logic) to:   -Wl,-R/usr/X11R6/lib [cached]
    (logic) push: -Wl,-R/usr/X11R6/lib
    (logic) pop:  -static
    (logic) to:   -static [cached]
    (logic) push: -static
    (logic) pop:  -L/build/package-obj/x11/fltk/work/fltk-1.1.5/lib
    (logic) to:   -L/var/package-obj/x11/fltk/work/fltk-1.1.5/lib [cached]
    (logic) push: -L/var/package-obj/x11/fltk/work/fltk-1.1.5/lib
    (logic) pop:  -lfltk_forms
    (logic) to:   -lfltk_forms [cached]
    (logic) push: -lfltk_forms
    (logic) pop:  -lfltk_images
    (logic) to:   -lfltk_images [cached]
    (logic) push: -lfltk_images
    (logic) pop:  ../src/.libs/libfltk.a
    (logic) to:   ../src/.libs/libfltk.a [untransformed]
    (logic) push: ../src/.libs/libfltk.a
    (logic) pop:  -L/var/package-obj/x11/fltk/work/.x11-buildlink/lib
    (logic) to:   -L/var/package-obj/x11/fltk/work/.x11-buildlink/lib [cached]
    (logic) push: -L/var/package-obj/x11/fltk/work/.x11-buildlink/lib
    (logic) pop:  -L/var/package-obj/x11/fltk/work/.buildlink/lib
    (logic) to:   -L/var/package-obj/x11/fltk/work/.buildlink/lib [cached]
    (logic) push: -L/var/package-obj/x11/fltk/work/.buildlink/lib
    (logic) pop:  /var/package-obj/x11/fltk/work/.buildlink/lib/libpng.a
    (logic) to:   /var/package-obj/x11/fltk/work/.buildlink/lib/libpng.a [cached]
    (logic) push: /var/package-obj/x11/fltk/work/.buildlink/lib/libpng.a
    (logic) pop:  -lz
    (logic) to:   -lz [cached]
    (logic) push: -lz
    (logic) pop:  /var/package-obj/x11/fltk/work/.buildlink/lib/libjpeg.a
    (logic) to:   /var/package-obj/x11/fltk/work/.buildlink/lib/libjpeg.a [cached]
    (logic) push: /var/package-obj/x11/fltk/work/.buildlink/lib/libjpeg.a
    (logic) pop:  /var/package-obj/x11/fltk/work/.buildlink/lib/libGLU.a
    (logic) to:   /var/package-obj/x11/fltk/work/.buildlink/lib/libGLU.a [cached]
    (logic) push: /var/package-obj/x11/fltk/work/.buildlink/lib/libGLU.a
    (logic) pop:  /var/package-obj/x11/fltk/work/.buildlink/lib/libGL.a
    (logic) to:   /var/package-obj/x11/fltk/work/.buildlink/lib/libGL.a [cached]
    (logic) push: /var/package-obj/x11/fltk/work/.buildlink/lib/libGL.a
    (logic) pop:  -lm
    (logic) to:   -lm [cached]
    (logic) push: -lm
    (logic) pop:  -lXext
    (logic) to:   -lXext [cached]
    (logic) push: -lXext
    (logic) pop:  -lX11
    (logic) to:   -lX11 [cached]
    (logic) push: -lX11
    (logic) pop:  -I/var/package-obj/x11/fltk/work/.buildlink/include
    (logic) to:   -I/var/package-obj/x11/fltk/work/.buildlink/include [cached]
    (logic) push: -I/var/package-obj/x11/fltk/work/.buildlink/include
    (logic) pop:  -L/var/package-obj/x11/fltk/work/.buildlink/lib
    (logic) to:   -L/var/package-obj/x11/fltk/work/.buildlink/lib [cached]
    (logic) push: -L/var/package-obj/x11/fltk/work/.buildlink/lib
    (cmd-sink) pop: -O2
    (cmd-sink) pop: -Wall
    (cmd-sink) pop: -Wunused
    (cmd-sink) pop: -Wconversion
    (cmd-sink) pop: -fno-exceptions
    (cmd-sink) pop: -I/var/package-obj/x11/fltk/work/.buildlink/include
    (cmd-sink) pop: -DGLX_GLXEXT_LEGACY
    (cmd-sink) pop: -O2
    (cmd-sink) pop: -march=pentiumpro
    (cmd-sink) pop: -g
    (cmd-sink) pop: -I/var/package-obj/x11/fltk/work/.x11-buildlink/include
    (cmd-sink) pop: -o
    (cmd-sink) pop: fluid
    (cmd-sink) pop: Fl_Function_Type.o
    (cmd-sink) pop: Fl_Menu_Type.o
    (cmd-sink) pop: Fl_Group_Type.o
    (cmd-sink) pop: Fl_Widget_Type.o
    (cmd-sink) pop: Fl_Type.o
    (cmd-sink) pop: Fl_Window_Type.o
    (cmd-sink) pop: Fluid_Image.o
    (cmd-sink) pop: code.o
    (cmd-sink) pop: factory.o
    (cmd-sink) pop: file.o
    (cmd-sink) pop: fluid.o
    (cmd-sink) pop: align_widget.o
    (cmd-sink) pop: about_panel.o
    (cmd-sink) pop: widget_panel.o
    (cmd-sink) pop: alignment_panel.o
    (cmd-sink) pop: function_panel.o
    (cmd-sink) pop: -Wl,-R/usr/pkg/lib
    (cmd-sink) pop: -Wl,-R/usr/X11R6/lib
    (cmd-sink) pop: -static
    (cmd-sink) pop: -L/var/package-obj/x11/fltk/work/fltk-1.1.5/lib
    (cmd-sink) pop: -lfltk_forms
    (cmd-sink) pop: -lfltk_images
    (cmd-sink) pop: ../src/.libs/libfltk.a
    (cmd-sink) pop: -L/var/package-obj/x11/fltk/work/.x11-buildlink/lib
    (cmd-sink) pop: -L/var/package-obj/x11/fltk/work/.buildlink/lib
    (cmd-sink) pop: /var/package-obj/x11/fltk/work/.buildlink/lib/libpng.a
    (cmd-sink) pop: -lz
    (cmd-sink) pop: /var/package-obj/x11/fltk/work/.buildlink/lib/libjpeg.a
    (cmd-sink) pop: /var/package-obj/x11/fltk/work/.buildlink/lib/libGLU.a
    (cmd-sink) pop: /var/package-obj/x11/fltk/work/.buildlink/lib/libGL.a
    (cmd-sink) pop: -lm
    (cmd-sink) pop: -lXext
    (cmd-sink) pop: -lX11
    (cmd-sink) pop: -I/var/package-obj/x11/fltk/work/.buildlink/include
    (cmd-sink) pop: -L/var/package-obj/x11/fltk/work/.buildlink/lib
<.> /var/package-obj/x11/fltk/work/.gcc/bin/g++ -O2 -Wall -Wunused -Wconversion -fno-exceptions -I/var/package-obj/x11/fltk/work/.buildlink/include -DGLX_GLXEXT_LEGACY -O2 -march=pentiumpro -g -I/var/package-obj/x11/fltk/work/.x11-buildlink/include -o fluid Fl_Function_Type.o Fl_Menu_Type.o Fl_Group_Type.o Fl_Widget_Type.o Fl_Type.o Fl_Window_Type.o Fluid_Image.o code.o factory.o file.o fluid.o align_widget.o about_panel.o widget_panel.o alignment_panel.o function_panel.o -Wl,-R/usr/pkg/lib -Wl,-R/usr/X11R6/lib -static -L/var/package-obj/x11/fltk/work/fltk-1.1.5/lib ../src/.libs/libfltk.a -L/var/package-obj/x11/fltk/work/.x11-buildlink/lib -L/var/package-obj/x11/fltk/work/.buildlink/lib /var/package-obj/x11/fltk/work/.buildlink/lib/libpng.a /var/package-obj/x11/fltk/work/.buildlink/lib/libjpeg.a /var/package-obj/x11/fltk/work/.buildlink/lib/libGLU.a /var/package-obj/x11/fltk/work/.buildlink/lib/libGL.a -lfltk_forms -lfltk_images -lz -lm -lXext -lX11


Note how suddenly '-lfltk_forms -lfltk_images' appears _after_ where
libpng.a and libjpeg.a appear.  That's a real bad no-no in link land!

I'm assuming this is happening because the wrapper script has been coded
with the incorrect assumption that it's OK to put all the '-l' options
at the end of the command-line.  However that's not true since libraries
may also be explicitly given by their full or relative pathname, as is
done above for libjpeg.a and libpng.a.  '-l' and '*.a' parameters MUST
NOT _EVER_ be rearranged, and it's probably a bad idea to rearange
anything else either, even '-L' options.  The given parameter order MUST
be trusted and preserved.  It's OK to strip duplicate option flags, but
'-l' is not a "flag" -- it's literally equivalent to a relative filename.

So, what to do about this buildlink faux pas?  Can I rip out all the
re-ordering easily?  Where is it happening?  I can't really see where
the re-ordering happens based on my current reading of the scripts,
though I also note the following comment in buildcmd-libtool, which is
yet another bug:

	Also, suppress consecutive repeated libraries.

Sometimes it is necessary and desired to repeat library options on the
linker command-line.  Not usually a good idea, but sometimes necessary,
and there's nothing fundamentally wrong with doing it.  Undoing it
blindly like this will only ever cause problems (but as I say it's
probably not the cause of the problem I'm seeing).


(I'm also not sure why libtool isn't specifying explicit paths to the
libfltk_forms.a and libfltk_images.a files either, but I'm not about to
try diving in and debugging that rats nest....  I already have way too
many libtool-related scars.)

-- 
						Greg A. Woods

H:+1 416 218-0098  W:+1 416 489-5852 x122  VE3TCP  RoboHack <woods@robohack.ca>
Planix, Inc. <woods@planix.com>          Secrets of the Weird <woods@weird.com>