Re: [Rd] R doesn't compile on FreeBSD 10.2

2015-08-31 Thread Davor Cubranic
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
> 00962ec0 B R_ClassSymbol
>
> auk% nm -g src/main/main.o | grep R_ClassSymbol
> 0008 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
  008f8ff8 B R_ClassSymbol

  ~/R-3.2.2$ nm -g src/main/main.o | grep R_ClassSymbol
  0008 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

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] R doesn't compile on FreeBSD 10.2

2015-08-31 Thread Prof Brian Ripley

On 31/08/2015 16:26, Davor Cubranic wrote:

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.)


You need to tell us exactly which commands you used: nowhere records 
everything.




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
00962ec0 B R_ClassSymbol

auk% nm -g src/main/main.o | grep R_ClassSymbol
0008 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
   008f8ff8 B R_ClassSymbol

   ~/R-3.2.2$ nm -g src/main/main.o | grep R_ClassSymbol
   0008 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.)


It is more complicated than that, in the absence of any definitive 
FreeBSD documentation.  There are five possibilities:


-export-dynamic
-rdynamic
-Wl,--export-dynamic
-Wl,-export-dynamic
-Wl,-E

The first two work for GCC (and have for a long time, although only the 
second is currently documented) and are accepted by compilers claiming 
to be GCC-compliant (clang and icc).  That clang does nothing with the 
first seems a clear bug in clang (at least on some OSes (which from the 
sources do include FreeBSD) it does support the second and maps it 

Re: [Rd] R doesn't compile on FreeBSD 10.2

2015-08-31 Thread Prof Brian Ripley
First, this there is no evidence here of a 'compilation' failure: it 
seems to be about installation, and more specifically about loading 
dynamic libs.


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'.


 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
 mkdir ../../../../library/tools/libs
 installing 'sysdata.rda'
 Error in dyn.load(file, DLLpath = DLLpath, ...) :
   unable to load shared object 
'/usr/home/davor/R-dev/R-trunk/library/tools/libs/tools.so':
   /usr/home/davor/R-dev/R-trunk/library/tools/libs/tools.so: Undefined symbol 
"R_ClassSymbol"
 Error: unable to load R code in package 'tools'
 Execution halted
 *** Error code 1

 Stop.
 make[4]: stopped in /usr/home/davor/R-dev/R-trunk/src/library/tools

The system is running a 64-bit FreeBSD 10.2-RELEASE-p4, with clang 3.4.1
and gfortran 4.8.5.

Configure log is attached.

Davor


Here is a series of checks for that symbol (results from a working Linux 
system):


auk% nm -g bin/exec/R  | grep R_ClassSymbol
00962ec0 B R_ClassSymbol

auk% nm -g src/main/main.o | grep R_ClassSymbol
0008 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

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.


[*] Unfortunately clang accepts many flags for gcc compatibility, but 
often silently ignores them. And it does not document fully which flags 
it actually implements.  It is not much easier with gcc: e.g. 4.9.2 
documents a flag -rdynamic with the same effect.


--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford
1 South Parks Road, Oxford OX1 3TG, UK

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel