Hi,

This diff fixes R's problem with pthread undefined symbols, as
reported here:

http://marc.info/?l=openbsd-ports&m=132196919327917

and here:

http://marc.info/?l=openbsd-ports&m=132187529729922

It also fixes libpthread linkage (-lpthread -> -pthread) and
an incorrect usage of the "--export-dynamic" linker flag (it's
'-Wl,--export-dynamic', not '-Wl,-export-dynamic'.

Tested on sparc64 and amd64.
Ok?

ciao,
David

Index: Makefile
===================================================================
RCS file: /cvs/ports/math/R/Makefile,v
retrieving revision 1.44
diff -u -p -r1.44 Makefile
--- Makefile    3 Nov 2011 20:28:09 -0000       1.44
+++ Makefile    19 Jan 2012 16:10:45 -0000
@@ -4,7 +4,7 @@ SHARED_ONLY=    Yes
 
 COMMENT=       clone of S, a powerful math/statistics/graphics language
 DISTNAME=      R-2.8.1
-REVISION=      6
+REVISION=      7
 SHARED_LIBS=   Rlapack 29.0 \
                Rblas   29.0
 
@@ -20,8 +20,8 @@ PERMIT_DISTFILES_FTP= Yes
 WANTLIB=       GL ICE SM X11 Xext Xmu Xrender Xss Xt \
                bz2 c cairo expat fontconfig freetype glib-2.0 \
                gmodule-2.0 gobject-2.0 gthread-2.0 jpeg m ncurses pango-1.0 \
-               pangocairo-1.0 pangoft2-1.0 pcre pixman-1 png  pthread-stubs \
-               readline tiff xcb xcb-render xcb-shm z \
+               pangocairo-1.0 pangoft2-1.0 pcre pixman-1 png pthread \
+               pthread-stubs readline tiff xcb xcb-render xcb-shm z \
                ${MODFORTRAN_WANTLIB} ${MODTK_WANTLIB}
 
 MASTER_SITES=  http://cran.r-project.org/src/base/R-2/ \
Index: patches/patch-configure
===================================================================
RCS file: /cvs/ports/math/R/patches/patch-configure,v
retrieving revision 1.10
diff -u -p -r1.10 patch-configure
--- patches/patch-configure     11 Mar 2009 08:21:33 -0000      1.10
+++ patches/patch-configure     19 Jan 2012 16:10:45 -0000
@@ -1,6 +1,69 @@
 $OpenBSD: patch-configure,v 1.10 2009/03/11 08:21:33 sthen Exp $
---- configure.orig     Thu Dec 18 14:03:48 2008
-+++ configure  Wed Mar 11 00:21:36 2009
+--- configure.orig     Thu Dec 18 15:03:48 2008
++++ configure  Thu Jan 19 14:38:44 2012
+@@ -31142,7 +31142,7 @@ echo "$as_me: WARNING: Use of flat namespace is reques
+   openbsd*)
+     ## looks like ${wl} is not defined here.  Perhaps in libtool code?
+     if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then
+-      main_ldflags="${wl}-export-dynamic"
++      main_ldflags="${wl}--export-dynamic"
+       shlib_ldflags="-shared -fPIC"
+     fi
+     ;;
+@@ -52736,13 +52736,13 @@ rm -f core conftest.err conftest.$ac_objext 
conftest_i
+         if test -n "$gl_have_pthread"; then
+           # The program links fine without libpthread. But it may actually
+           # need to link with libpthread in order to create multiple threads.
+-          { echo "$as_me:$LINENO: checking for pthread_kill in -lpthread" >&5
+-echo $ECHO_N "checking for pthread_kill in -lpthread... $ECHO_C" >&6; }
++          { echo "$as_me:$LINENO: checking for pthread_kill in -pthread" >&5
++echo $ECHO_N "checking for pthread_kill in -pthread... $ECHO_C" >&6; }
+ if test "${ac_cv_lib_pthread_pthread_kill+set}" = set; then
+   echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+-LIBS="-lpthread  $LIBS"
++LIBS="-pthread  $LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
+ _ACEOF
+@@ -52806,7 +52806,7 @@ fi
+ { echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_kill" >&5
+ echo "${ECHO_T}$ac_cv_lib_pthread_pthread_kill" >&6; }
+ if test $ac_cv_lib_pthread_pthread_kill = yes; then
+-  LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread
++  LIBMULTITHREAD=-pthread LTLIBMULTITHREAD=-pthread
+              # On Solaris and HP-UX, most pthread functions exist also in 
libc.
+              # Therefore pthread_in_use() needs to actually try to create a
+              # thread: pthread_create from libc will fail, whereas
+@@ -52824,13 +52824,13 @@ fi
+ 
+         else
+           # Some library is needed. Try libpthread and libc_r.
+-          { echo "$as_me:$LINENO: checking for pthread_kill in -lpthread" >&5
+-echo $ECHO_N "checking for pthread_kill in -lpthread... $ECHO_C" >&6; }
++          { echo "$as_me:$LINENO: checking for pthread_kill in -pthread" >&5
++echo $ECHO_N "checking for pthread_kill in -pthread... $ECHO_C" >&6; }
+ if test "${ac_cv_lib_pthread_pthread_kill+set}" = set; then
+   echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+-LIBS="-lpthread  $LIBS"
++LIBS="-pthread  $LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
+ _ACEOF
+@@ -52895,8 +52895,8 @@ fi
+ echo "${ECHO_T}$ac_cv_lib_pthread_pthread_kill" >&6; }
+ if test $ac_cv_lib_pthread_pthread_kill = yes; then
+   gl_have_pthread=yes
+-             LIBTHREAD=-lpthread LTLIBTHREAD=-lpthread
+-             LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread
++             LIBTHREAD=-pthread LTLIBTHREAD=-pthread
++             LIBMULTITHREAD=-pthread LTLIBMULTITHREAD=-pthread
+ fi
+ 
+           if test -z "$gl_have_pthread"; then
 @@ -60283,7 +60283,7 @@ LIBTHREAD!$LIBTHREAD$ac_delim
  LTLIBTHREAD!$LTLIBTHREAD$ac_delim
  LIBMULTITHREAD!$LIBMULTITHREAD$ac_delim
Index: patches/patch-src_main_Makefile_in
===================================================================
RCS file: patches/patch-src_main_Makefile_in
diff -N patches/patch-src_main_Makefile_in
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_main_Makefile_in  19 Jan 2012 16:10:45 -0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+
+Fix runtime errors due to libpthread undefined symbols
+
+--- src/main/Makefile.in.orig  Thu Jan 19 12:12:26 2012
++++ src/main/Makefile.in       Thu Jan 19 12:13:35 2012
+@@ -91,7 +91,7 @@ MAIN_LIBS = ../unix/libunix.a ../appl/libappl.a ../nma
+ EXTRA_STATIC_LIBS = $(R_ZLIBS) $(R_BZLIBS) $(R_PCRE) $(R_XDR)$(R_LIBINTL)
+ STATIC_LIBS = $(MAIN_LIBS) $(EXTRA_STATIC_LIBS)
+ 
+-EXTRA_LIBS = $(BLAS_LIBS) $(FLIBS) $(R_XTRA_LIBS) @LIBINTL@ $(READLINE_LIBS) 
$(LIBS)
++EXTRA_LIBS = $(BLAS_LIBS) $(FLIBS) $(R_XTRA_LIBS) @LIBINTL@ $(READLINE_LIBS) 
$(LIBS) -pthread
+ 
+ R_binary = R.bin
+ R_bin_OBJECTS = Rmain.o

Reply via email to