tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: the pixman problem

> People using -5 have become all too familiar with this:
> .../work/.x11-buildlink/lib/ undefined reference to 
> `pixman_image_set_destroy_function'
> .../work/.x11-buildlink/lib/ undefined reference to 
> `pixman_image_composite32'
> .../work/.x11-buildlink/lib/ undefined reference to 
> `pixman_image_fill_boxes'
> *** Error 1

Indeed.  The graphics/gnuplot package is just one example, which
was the first one I stumbled over.

> (1) Something in the victim package's config logic adds
> -L/usr/X11R7/lib -R/usr/X11R7/lib to LDFLAGS or LIBS.

In the case of gnuplot, it appears that AC_PATH_XTRA used in is responsible for adding the -R/usr/X11R7/lib part,
via X_LIBS which converts into LIBRARIES_FOR_X.  At
that point I stopped trying to fix the package, since AC_PATH_XTRA
comes from autoconf and not from the package itself.

> (2) This gets added *before* the -Wl,-R/usr/pkg/lib -Wl,-R/usr/X11R7/lib
> that comes from pkg-config.

Correct, this is apparently something gcc does -- it reorders any
-R args to come first in the ld invocation, which messes up the
search order relative to any other -Wl,-R specifications.

> (3) The wrappers remove -L/usr/X11R7/lib but leave the
> -R/usr/X11R7/lib alone and print:
>    WARNING: [transform-gcc] passing unknown option -R/usr/X11R7/lib

Right.  This warning comes from mk/wrapper/, which
is driven from mk/wrapper/transform-gcc.

> (4) Thus the link line ends up with an rpath that has /usr/X11R7/lib
> before /usr/pkg/lib. This is wrong, and the rest follows on a
> predictable downhill path.

If we want we can rewrite -R into -Wl,-R, so that the search
order isn't messed up.  This can be done with this diff:

Index: mk/wrapper/transform-gcc
RCS file: /cvsroot/pkgsrc/mk/wrapper/transform-gcc,v
retrieving revision 1.25
diff -u -r1.25 transform-gcc
--- mk/wrapper/transform-gcc       6 Feb 2012 13:03:55 -0000       1.25
+++ mk/wrapper/transform-gcc       1 Mar 2012 10:30:09 -0000
@@ -132,6 +132,11 @@
 -fgnu-runtime          |\
 -fconstant-string-class=* ) transform_pass ;;
+# Old-style rpath specifier; gcc places -R args passed to gcc first in
+# the linker invocation, which messes up the search order relative to
+# other -Wl,-R specifiers given to GCC
+-R*                    ) transform_to "-Wl,$arg" ;;
 # Other compiler's options that have corresponding GCC options.
 -Kpic                  |\
 -kpic                  |\

Best regards,

- Havard

Home | Main Index | Thread Index | Old Index