pkgsrc-Bugs archive

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

pkg/46130: Partial fix/workaround for "the libpixman problem"

>Number:         46130
>Category:       pkg
>Synopsis:       Partial fix/workaround for "the libpixman problem"
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 02 22:50:01 +0000 2012
>Originator:     Havard Eidnes
>Release:        NetBSD 5.1
System: NetBSD 5.1 NetBSD 5.1 (VIPE) #1: Mon Jan 16 10:01:42 
CET 2012 amd64
Architecture: x86_64
Machine: amd64
        David Holland analyzed this problem.  The start of his message
        to of February 20 sums up the problem:

People using -5 have become all too familiar with this:

.../work/.x11-buildlink/lib/ undefined reference to 
.../work/.x11-buildlink/lib/ undefined reference to 
.../work/.x11-buildlink/lib/ undefined reference to 
*** Error 1

I finally got direct access to it while failing last night, and here's
what happens at least in the case I found:

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

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

(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

(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.

        It is our GCC which puts -R at the front of the ld invocation.

        I experienced this problem with the graphics/gnuplot package.
        In that case, the -L/usr/X11R7/lib and -R/usr/X11R7/lib come
        from LIBRARIES_FOR_X, which comes from X_LIBS, which again
        comes from autoconf's AC_PATH_XTRA, so in a sense this isn't
        really a bug in the package which experiences the problem.

        Try to build graphics/gnuplot from pkgsrc-current.
        It is possible to partly work around this by converting
        any -R<dir> option into -Wl,-R<dir>, which will not be
        re-ordered relative to other -Wl,-R<dir> options.  This
        can be done by the pkgsrc wrapper system, like this:

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    2 Mar 2012 22:19:25 -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 among the
+# other -Wl,-R specifiers given to GCC
+-R*                    ) transform_to "-Wl,$arg" ;;
 # Other compiler's options that have corresponding GCC options.
 -Kpic                  |\
 -kpic                  |\

        It is confirmed that this fixes the build of gnuplot on
        NetBSD 5.1.

Home | Main Index | Thread Index | Old Index