ports/147646: [PATCH][Mesa] graphics/libGL: fix linking with newer gcc and binutils

Andriy Gapon avg at icyb.net.ua
Mon Jun 7 10:30:12 UTC 2010


>Number:         147646
>Category:       ports
>Synopsis:       [PATCH][Mesa] graphics/libGL: fix linking with newer gcc and binutils
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun 07 10:30:11 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Andriy Gapon
>Release:        FreeBSD 9.0-CURRENT amd64
>Organization:
>Environment:
gcc-4.4.5.20100518
binutils-2.20.1_2
>Description:
When CC is set to be gcc44 build of Mesa ports fails with:
relocation R_X86_64_PC32 against symbol `_gl_DispatchTSD' can not be used when making a shared object; recompile with -fPIC
This happens despite compilation being done with -fPIC already.
I am not sure about the theory on why this happens, but it seems
to be related to symbols visibility and -Bsymbolic linker option
has been suggested as a work-around or fix.
Indeed, that option is used for GNU/Linux build of Mesa and it
does indeed fix linking with gcc44 on FreeBSD.

Also, see this:
http://lists.freedesktop.org/archives/mesa-commit/2009-June/010029.html

Note that this PR is applicable to all Mesa ports,
I tested it with the following:
graphics/libGL graphics/libGLU graphics/libglut graphics/dri

Added file(s):
- files/patch-bin_mklib

Port maintainer (x11 at FreeBSD.org) is cc'd.

Generated with FreeBSD Port Tools 0.99
Patchfile is created with update-patches target.

>How-To-Repeat:
>Fix:

--- libGL-7.6.1.patch begins here ---
diff -ruN --exclude=CVS /usr/ports/graphics/libGL.orig/files/patch-bin_mklib /usr/ports/graphics/libGL/files/patch-bin_mklib
--- /usr/ports/graphics/libGL.orig/files/patch-bin_mklib	1970-01-01 03:00:00.000000000 +0300
+++ /usr/ports/graphics/libGL/files/patch-bin_mklib	2010-06-07 13:09:15.081554682 +0300
@@ -0,0 +1,11 @@
+--- bin/mklib.orig	2010-06-07 12:59:34.051442949 +0300
++++ bin/mklib	2010-06-07 13:06:23.985952856 +0300
+@@ -497,7 +498,7 @@ case $ARCH in
+ 	    FINAL_LIBS=${STLIB}
+ 	else
+ 	    SHLIB="lib${LIBNAME}.so.${MAJOR}"
+-	    OPTS="-shared -Wl,-soname,${SHLIB}"
++	    OPTS="-shared -Wl,-Bsymbolic -Wl,-soname,${SHLIB}"
+             if [ "${ALTOPTS}" ] ; then
+                 OPTS=${ALTOPTS}
+             fi
--- libGL-7.6.1.patch ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list