From prye at shiraz.apana.org.au  Fri Jul 25 13:30:31 2003
From: prye at shiraz.apana.org.au (Peter Rye)
Date: Fri Jul 25 14:30:33 2003
Subject: [Rd] OpenBSD 3.[23] and R-1.7.1
In-Reply-To: <870CF8D1-BD17-11D7-B5DF-000A957CEFBA@math.uni-augsburg.de>
References: <870CF8D1-BD17-11D7-B5DF-000A957CEFBA@math.uni-augsburg.de>
Message-ID: <87u19aq1vw.fsf@riesling.grape.apana.org.au>

>>>>> "Simon" == Simon Urbanek <Simon.Urbanek@math.uni-augsburg.de> writes:

    Simon> On Wednesday, July 23, 2003, at 01:07 PM, Peter Rye wrote:
    >> I have been able to compile R on OpenBSD 3.[23] for the i386
    >> platform (still a.out at the moment).  [...]  months. The
    >> OpenBSD-current for i386 will also be ELF.  On the ELF platforms,
    >> the build dies with the following error:
    >> 
    >> dumping R code in package 'methods' Error in
    >> .Call("R_initialize_methods_metadata", table, PACKAGE = "methods") :
    >> .Call function name not in load table Execution halted *** Error
    >> code 1

    Simon> I don't know much about OpenBSD, but I experienced the same
    Simon> error on Darwin a while ago. It indicated different naming
    Simon> conventions in shlib export tables - missing underscore or one
    Simon> too many (in our Darwin case no leading underscore should be
    Simon> used although it was prepended by default).

Thanks Simon,
I believe you're correct.
I thought I'd looked at this previously - it seemed like an obvious
potential problem - however I obviously had not looked carefully enough.

I can now compile R on OpenBSD alpha and i386.
Unfortunately there still seems to be a problem on the alpha, which looks
like a 32/64 bit issue. The linker complains when loading the ts.so library
in particular about symbol size mismatching.

I'll keep looking to see how to sort this out.

I've reviewed my previous OpenBSD patches, which now look like a horribly
clumsy way of fixing the shared library naming problem, and I see they were
mangled in the conversion to html.

For the benefit of anyone else using OpenBSD, here are my revised patches
(just need to get R on the alpha working properly):


<code>

--- configure.orig	Fri Jul 25 12:02:53 2003
+++ configure	Fri Jul 25 12:10:30 2003
@@ -17622,6 +17622,13 @@
     fi
     ## </NOTE>
     ;;
+  openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then     # we're ELF
+    cat >>confdefs.h <<\_ACEOF
+#define HAVE_NO_SYMBOL_UNDERSCORE 1
+_ACEOF
+  fi
+    ;;
   osf*)
     cat >>confdefs.h <<\_ACEOF
 #define HAVE_NO_SYMBOL_UNDERSCORE 1
@@ -17893,6 +17900,12 @@
       shlib_ldflags="-Bshareable"
     fi
     ;;
+  openbsd*)
+    if ${CPP} - -dM < /dev/null | grep __ELF__ >/dev/null ; then  # we're ELF
+      main_ldflags="${wl}-export-dynamic"
+      shlib_ldflags="-shared -fPIC"
+    fi
+    ;;
   osf*)
     cpicflags=
     cxxpicflags=
@@ -18081,6 +18094,12 @@
     else
       LAPACK_LDFLAGS="+s"
     fi
+    ;;
+  openbsd3*)
+    ## Not sure if this is required for earlier versions of OpenBSD
+    PACKAGE_VERSION_MAJOR=`echo ${PACKAGE_VERSION} | sed -e "s/\.//" -e "s/\..*$//"`
+    PACKAGE_VERSION_MINOR=`echo ${PACKAGE_VERSION} | sed -e "s/.*\.\([^.][^.]*$\)/\1/"`
+    DYLIB_EXT=".so.${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}"
     ;;
 esac
 


--- doc/manual/Makefile.in.orig	Fri Sep  6 07:44:00 2002
+++ doc/manual/Makefile.in	Thu Dec 12 17:14:51 2002
@@ -34,7 +34,8 @@
 MAKEINFO_TEXT_OPTS = --number-sections --fill-column=76 --no-split --no-headers
 TEXI2HTML = $(MAKEINFO) $(MAKEINFO_HTML_OPTS)
 TEXI2TEXT = $(MAKEINFO) $(MAKEINFO_TEXT_OPTS)
-TEXI2DVI = $(top_builddir)/bin/texi2dvi --texinfo="@set UseExternalXrefs"
+# Looks like a bug in texi2dvi to me - needs a space after the --texinfo argument 
+TEXI2DVI = $(top_builddir)/bin/texi2dvi --texinfo="@set UseExternalXrefs "
 TEXI2PDF = $(TEXI2DVI) --pdf
 PDFLATEX = @PDFLATEX@
 PDFTEX = @PDFTEX@


</code>


[Rd] OpenBSD 3.[23] and R-1.7.1
Peter Rye