Prof Brian Ripley writes:
> Second, we don't have all the pertinent information such as the
> configure options used and the architecture (x86_64?). I am going to
> have to guess none as none were mentioned, but using --enable-R-shlib
> would be pertinent.
>
> On 31/08/2015 05:47, Davor Cubranic wrote:
>> On FreeBSD 10.2, I get the following error when compiling R from the
>> Subversion trunk (with "configure && make"):
>
> You have not told us which revision. A basic check is to see if you can
> build the latest released version, as the trunk is 'Under
development'.
As suggested, I tried compiling from Subversion tag 3.2.2 (r69054).
I used no command-line options to 'configure', as mentioned in my
previous email, and this is the output:
R is now configured for x86_64-unknown-freebsd10.2
Source directory: .
Installation directory: /usr/local
C compiler: cc -g -O2
Fortran 77 compiler: gfortran48 -g -O2
C++ compiler: c++ -g -O2
C++ 11 compiler: c++ -std=c++11 -g -O2
Fortran 90/95 compiler: gfortran48 -g -O2
Obj-C compiler: cc -g -O2 -fobjc-exceptions
Interfaces supported: X11, tcltk
External libraries: readline, zlib, bzlib, lzma, PCRE, curl
Additional capabilities: PNG, JPEG, TIFF, NLS, cairo, ICU
Options enabled: shared BLAS, R profiling
Capabilities skipped:
Options not enabled: memory profiling
Recommended packages: yes
(I thought this, and more, would be included in config.log, but please
let me know if there is other place to get the configuration details
that are relevant.)
Still the same error:
--- tools.so ---
cc -shared -L/usr/local/lib -o tools.so text.o init.o Rmd5.o md5.o signals.o
install.o getfmts.o http.o gramLatex.o gramRd.o
--- all ---
--- shlib ---
mkdir ../../../../library/tools/libs
--- sysdata ---
installing 'sysdata.rda'
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object
'/usr/home/davor/R-3.2.2/library/tools/libs/tools.so':
/usr/home/davor/R-3.2.2/library/tools/libs/tools.so: Undefined symbol
"R_ClassSymbol"
Error: unable to load R code in package 'tools'
Execution halted
> Here is a series of checks for that symbol (results from a working Linux
> system):
>
> auk% nm -g bin/exec/R | grep R_ClassSymbol
> 0000000000962ec0 B R_ClassSymbol
>
> auk% nm -g src/main/main.o | grep R_ClassSymbol
> 0000000000000008 C R_ClassSymbol
>
> auk% nm -g library/tools/libs/tools.so | grep R_ClassSymbol
> U R_ClassSymbol
>
> auk% nm -g src/library/tools/src/gramRd.o | grep R_ClassSymbol
> U R_ClassSymbol
Interestintly, checking for R_ClassSymbol gives the same output as on
your working Linux system:
~/R-3.2.2$ nm -g bin/exec/R | grep R_ClassSymbol
00000000008f8ff8 B R_ClassSymbol
~/R-3.2.2$ nm -g src/main/main.o | grep R_ClassSymbol
0000000000000008 C R_ClassSymbol
~/R-3.2.2$ nm -g library/tools/libs/tools.so | grep R_ClassSymbol
U R_ClassSymbol
~/R-3.2.2$ nm -g src/library/tools/src/gramRd.o | grep R_ClassSymbol
U R_ClassSymbol
> So R_ClassSymbol is unresolved in the tools package and should be
> resolved by loading into the main R executable. On Linux that is
> achieved by the linker flag
>
> -Wl,--export-dynamic
>
> as part of MAIN_LDFLAGS in Makeconf in the top-level directory. We have
> in configure.ac
>
> freebsd*)
> main_ldflags="-export-dynamic"
> shlib_ldflags="-shared"
>
> but those were from the days when FreeBSD used gcc, and it is possible
> that your use of clang[*] requires -Wl,--export-dynamic . If so, add to
> config.site
>
> MAIN_LDFLAGS="-Wl,--export-dynamic"
>
> It would also be worth trying a build with --enable-R-shlib, as that
> resolves R_ClassSymbol and similar differently.
I tried 'configure --enable-R-shlib', still the same error.
I then tried adding MAIN_LDFLAGS as you suggested, and the install
worked. Thanks you very much! ("make check" fails in datetime.R, but
that's something I'll follow up in a separate email.)
Should configure.ac be changed to account for this on FreeBSD's using
clang? (I should probably also try compiling with GCC, which I had to
install anyways for gfortran.)
Davor