From unlikely.combination at gmail.com  Mon Aug 31 15:55:10 2015
From: unlikely.combination at gmail.com (Joe S)
Date: Mon, 31 Aug 2015 15:55:10 +0200
Subject: [Rd] Build R on Haiku
In-Reply-To: <55E454E6.4050204@stats.ox.ac.uk>
References: <CAPs52TqRajW5Rvb8KPGXsSE3i809gS-98QiS=mZjHbXXR-c7pg@mail.gmail.com>
	<55E454E6.4050204@stats.ox.ac.uk>
Message-ID: <CAPs52TpMb3cO-CZ-5vuGYjEAWREwRcnsrMcNvS+x=XSEeNaNGA@mail.gmail.com>

On 31 August 2015 at 15:21, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:

> On 14/08/2015 15:19, Joe S wrote:
>
>> Are there any checks I can do to the R binary to test if it works
>> properly?
>>
>
> This does not seem to be about the R binary, but about dynamically loaded
> modules.  (All those export lines are non-standard, BTW, and your output is
> not from an ab initio build so we don't know e.g. how tools.so was built.)
> The meat is
>
Yes, because etc/ldpaths doesn't get configured properly so I edited
manually. I should fix the configure script to identify all the environment
variables properly first. It may be causing problems further along.


> > Error in .Call(PS_sigs, 1L) :
> >    first argument must be a string (of length 1) or native symbol
> reference
>
> That comes from package tools, which contains the R code
>
> PS_sigs <- getDLLRegisteredRoutines("tools")[[c(".Call", "ps_sigs")]]
> SIGHUP <- .Call(PS_sigs, 1L)
>
> So, startup R from the top-level build directory with something like
>
> env R_DEFAULT_PACKAGES=NULL bin/R
>
> and at the prompt run
>
> dyn.load("src/library/tools/src/tools.so")
> getLoadedDLLs() # should include a line for tools
> getDLLRegisteredRoutines("tools")
>

Indeed, I got that far myself in the meantime.

> getLoadedDLLs()
                                   Filename Dynamic.Lookup
base                                   base          FALSE
tools /Store/d2/library/tools/libs/tools.so           TRUE

>getDLLRegisteredRoutines("tools")
data frame with 0 columns and 0 rows


> My guess is that does not list any symbols, in particular not ps_sigs.
>
> We can only speculate as to what went wrong (visibility issues?  Mapping
> symbols to u/case? ...).


For now I will keep digging into what dyn.load() is doing and why the
symbols are missing. Any tips are appreciated.

Thanks
Joe


> nm -g library/tools/libs/tools.so
00004178 B __bss_start
         U __ctype_get_mb_cur_max
         w __cxa_finalize
         w __deregister_frame_info
         w __register_frame_info
00004178 D _edata
00004198 B _end
00002951 T _fini
00004170 D _gSharedObjectHaikuABI
00004174 D _gSharedObjectHaikuVersion
00000b54 T _init
         U fclose
         U ferror
         U fopen
         U fread
         U free
         U get_image_symbol
         U INTEGER
         U kill
         U LENGTH
         U libintl_dgettext
         U malloc
         U mbcslocale
         U memcpy
         U R_CHAR
         U R_chk_calloc
         U R_chk_free
         U R_chk_realloc
000019a0 T R_init_tools
         U R_NaInt
         U R_NaString
         U R_NilValue
         U R_registerRoutines
         U R_useDynamicSymbols
         U realloc
         U Rf_allocVector
         U Rf_asInteger
         U Rf_asLogical
         U Rf_coerceVector
         U Rf_error
         U Rf_getCharCE
         U Rf_install
         U Rf_isString
         U Rf_length
         U Rf_mbrtowc
         U Rf_mkChar
         U Rf_mkCharCE
         U Rf_protect
         U Rf_ScalarInteger
         U Rf_ScalarLogical
         U Rf_setAttrib
         U Rf_translateChar
         U Rf_unprotect
         U Rf_warning
         U Rprintf
         U SET_STRING_ELT
         U sprintf
         U strcmp
         U STRING_ELT
         U strlen
         U strncmp
         U TYPEOF

	[[alternative HTML version deleted]]



[Rd] Build R on Haiku
Joe S