From aixtools at gmail.com  Wed Dec 16 16:02:44 2015
From: aixtools at gmail.com (Michael Felt)
Date: Wed, 16 Dec 2015 16:02:44 +0100
Subject: [Rd] Building R in 64-bit mode
In-Reply-To: <567152F5.1020009@gmail.com>
References: <567152F5.1020009@gmail.com>
Message-ID: <56717D14.3070101@gmail.com>

I have been looking further and need some help with:

  tools:::sysdata2LazyLoadDB("/data/prj/cran/R-3.2.3/src/library/tools/R/sysdata.rda","../../../library/tools/R")
Error: Line starting 'Package: tools ...' is malformed!

Details:
root at x065:[/data/prj/cran/64/R-3.2.3/src/library/tools]export | egrep 
"PATH|HOME"
HOME=/
LIBPATH=/data/prj/cran/64/R/lib:/opt/lib
LOCPATH=/usr/lib/nls/loc
NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/%L/%N.cat
PATH=/opt/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java14/jre/bin:/usr/java14/bin:/usr/vacpp/bin:
R_HOME=/data/prj/cran/64/R

root at x065:[/data/prj/cran/64/R-3.2.3/src/library/tools]/data/prj/cran/64/R-3.2.3/bin/exec/R

R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: powerpc-ibm-aix5.3.7.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

   Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

During startup - There were 12 warnings (use warnings() to see them)
 >
tools:::sysdata2LazyLoadDB("/data/prj/cran/R-3.2.3/src/library/tools/R/sysdata.rda","../../../library/tools/R")
Error: Line starting 'Package: tools ...' is malformed!
 > warnings()
Warning messages:
1: package "methods" in options("defaultPackages") was not found
2: package 'datasets' in options("defaultPackages") was not found
3: package 'utils' in options("defaultPackages") was not found
4: package 'grDevices' in options("defaultPackages") was not found
5: package 'graphics' in options("defaultPackages") was not found
6: package 'stats' in options("defaultPackages") was not found
7: package 'methods' in options("defaultPackages") was not found
8: Setting LC_CTYPE failed, using "C"
9: Setting LC_COLLATE failed, using "C"
10: Setting LC_TIME failed, using "C"
11: Setting LC_MESSAGES failed, using "C"
12: Setting LC_MONETARY failed, using "C"
 > q()
Save workspace image? [y/n/c]: n

However, in 32-bit mode I see NULL warnings...
root at x065:[/data/prj/cran/32/R-3.2.3/src/library/tools]/data/prj/cran/32/R-3.2.3/bin/exec/R

R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: powerpc-ibm-aix5.3.7.0 (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

   Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

 > warnings()
NULL
q()

Ideas?

Thanks,
Michael


On 16-Dec-15 13:03, Michael Felt wrote:
> Hope I am not sounding too much like a broken record - as far as 
> 64-bit build on AIX is concerned.
>
> ** Short - 32-bit builds complete normally, 64-bit builds stop at 
> "installing 'sysdata.rda'" with message:
> Error: Line starting 'Package: tools ...' is malformed!
> Execution halted
>
> *** Longer...
>
> I could file a bug - Importance, showstopper - but I would prefer to 
> better understand how to dig a bit deeper into why it is failing - and 
> work with (or for) you to make R easier to install and use on AIX.
>
> As there are at least two ways to find 64-bit shared libraries 
> (AIX-way; GNU/Linux-way; "Solaris-way .so files"?) I am trying to keep 
> it simpler and and starting with the recently released R-3.2.3 
> distribution.
>
> I made the following changes - to clean up many Duplicate Symbol 
> warnings :happy me!:
>
> diff -ru R-3.2.3.orig/configure R-3.2.3/configure
> --- R-3.2.3.orig/configure      2015-12-02 23:16:46 +0000
> +++ R-3.2.3/configure   2015-12-16 10:52:15 +0000
> @@ -26339,11 +26339,11 @@
>      ##ADD: However, for example, symbol in libc of memcpy is 
> __memmove,__memmove64.
>      ##ADD: This black magic puts lc before lR and pockets this.
>      if test "x${OBJECT_MODE}" = "x64"; then
> -      main_ldflags="${wl}-brtl ${wl}-bexpall ${wl}-bpT:0x100000000 
> ${wl}-bpD:0x110000000 -lc"
> +      main_ldflags="${wl}-brtl ${wl}-bpT:0x100000000 
> ${wl}-bpD:0x110000000 -lc"
>      else
> -      main_ldflags="${wl}-brtl ${wl}-bexpall -lc"
> +      main_ldflags="${wl}-brtl ${wl}-bmaxdata:0xd0000000/dsa -lc"
>      fi
> -    shlib_ldflags="${wl}-brtl ${wl}-G ${wl}-bexpall ${wl}-bnoentry -lc"
> +    shlib_ldflags="${wl}-G ${wl}-bnoentry -lc"
>      SHLIB_LIBADD="\$(LIBM)"
>      shlib_cxxldflags="${shlib_ldflags}"
>      if test "${GCC}" = yes; then
> diff -ru R-3.2.3.orig/src/include/Defn.h R-3.2.3/src/include/Defn.h
> --- R-3.2.3.orig/src/include/Defn.h     2015-08-25 22:15:24 +0000
> +++ R-3.2.3/src/include/Defn.h  2015-12-16 10:53:08 +0000
> @@ -1271,7 +1271,7 @@
>  void invalidate_cached_recodings(void);  /* from sysutils.c */
>  void resetICUcollator(void); /* from util.c */
>  void dt_invalidate_locale(); /* from Rstrptime.h */
> -int R_OutputCon; /* from connections.c */
> +extern int R_OutputCon; /* from connections.c */
>  extern int R_InitReadItemDepth, R_ReadItemDepth; /* from serialize.c */
>  void get_current_mem(size_t *,size_t *,size_t *); /* from memory.c */
>  unsigned long get_duplicate_counter(void);  /* from duplicate.c */
>
> A 32-bit build completes
> ...
> make[3]: Leaving directory 
> '/tmp/RtmpcvzNTA/R.INSTALL7e05458d74e28/mgcv/src'
> installing to /data/prj/cran/32/R-3.2.3/library/mgcv/libs
> ** R
> ** data
> ** inst
> ** byte-compile and prepare package for lazy loading
> ** help
> *** installing help indices
> ** building package indices
> ** testing if installed package can be loaded
> * DONE (mgcv)
> make[2]: Leaving directory 
> '/data/prj/cran/32/R-3.2.3/src/library/Recommended'
> make[1]: Leaving directory 
> '/data/prj/cran/32/R-3.2.3/src/library/Recommended'
> make[1]: Entering directory '/data/prj/cran/32/R-3.2.3/src/library'
> 'pdflatex' is needed to make vignettes but is missing on your system.
> make[1]: Leaving directory '/data/prj/cran/32/R-3.2.3/src/library'
> root at x065:[/data/prj/cran/32/R-3.2.3]
>
> The same command, but as 64-bit stops at:
>
> gcc -maix64 -mcpu=power5 -std=gnu99 -shared -Wl,-G -Wl,-bnoentry -lc 
> -L../../../../lib -L/opt/lib -o tools.so text.o init.o Rmd5.o md5.o 
> signals.o install.o getfmts.o http.
> o gramLatex.o gramRd.o -lm -L../../../../lib -lR /opt/lib/libintl.a 
> /opt/lib/libiconv.a -lpthread -lc
> ld: 0711-224 WARNING: Duplicate symbol: Rf_yylval
> ld: 0711-224 WARNING: Duplicate symbol: Rf_yychar
> ld: 0711-224 WARNING: Duplicate symbol: Rf_yynerrs
> ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more 
> information.
> make[6]: Entering directory '/data/prj/cran/64/R/src/library/tools/src'
> make[6]: Warning: File 'Makefile' has modification time 5.9 s in the 
> future
> mkdir ../../../../library/tools/libs
> make[6]: warning:  Clock skew detected.  Your build may be incomplete.
> make[6]: Leaving directory '/data/prj/cran/64/R/src/library/tools/src'
> make[5]: Leaving directory '/data/prj/cran/64/R/src/library/tools/src'
> make[4]: Leaving directory '/data/prj/cran/64/R/src/library/tools'
> make[4]: Entering directory '/data/prj/cran/64/R/src/library/tools'
> installing 'sysdata.rda'
> Error: Line starting 'Package: tools ...' is malformed!
> Execution halted
> /data/prj/cran/R-3.2.3/share/make/basepkg.mk:150: recipe for target 
> 'sysdata' failed
> make[4]: *** [sysdata] Error 1
> make[4]: Leaving directory '/data/prj/cran/64/R/src/library/tools'
> Makefile:30: recipe for target 'all' failed
> make[3]: *** [all] Error 2
> make[3]: Leaving directory '/data/prj/cran/64/R/src/library/tools'
> Makefile:36: recipe for target 'R' failed
> make[2]: *** [R] Error 1
> make[2]: Leaving directory '/data/prj/cran/64/R/src/library'
> Makefile:28: recipe for target 'R' failed
> make[1]: *** [R] Error 1
> make[1]: Leaving directory '/data/prj/cran/64/R/src'
> Makefile:60: recipe for target 'R' failed
> make: *** [R] Error 1
> root at x065:[/data/prj/cran/64/R]
>
> ## *** Commands
>
> root at x065:[/data/prj/cran/32/R-3.2.3]cat ../../bin/my_shared.ksh
> #!/usr/bin/ksh
> # my_config_test
> #       --with-cairo=no --with-libpng=no --with-jpeglib=no 
> --with-libtiff=no \
> #       --with-cairo=no --with-libpng=yes --with-jpeglib=yes 
> --with-libtiff=yes \
> #       --with-libpth-prefix=/opt \
> #       --with-aix-soname=aix
> HOST=$1
> RELEASE=$2
>
> . ../${HOST}.env || exit -1
>
> /data/prj/cran/${RELEASE}/configure --disable-lto --prefix=/opt \
>         --enable-R-shlib \
>         --with-cairo=no --with-libpng=no --with-jpeglib=no 
> --with-libtiff=no \
>         --with-readline=no --with-x=no
> root at x065:[/data/prj/cran/32/R-3.2.3]
>
> root at x065:[/data/prj/cran/32/R-3.2.3]sdiff ../../??/aix.env
> export OBJECT_MODE=32                                           | 
> export OBJECT_MODE=64
> export CC="gcc -maix32 -mcpu=power5"                            | 
> export AR="ar -X64"
> export CXX="g++ -maix32 -mcpu=power5"                           | 
> export CC="gcc -maix64 -mcpu=power5"
> export F77="gfortran -maix32 -mcpu=power5"                      | 
> export CXX="g++ -maix64 -mcpu=power5"
> export FC="gfortran -maix32 -mcpu=power5"                       | 
> export F77="gfortran -maix64 -mcpu=power5"
> > export FC="gfortran -maix64 -mcpu=power5"
> export LDFLAGS="-L/opt/lib" export LDFLAGS="-L/opt/lib"
> root at x065:[/data/prj/cran/32/R-3.2.3]
>
> Thanks,
> Michael



[Rd] Building R in 64-bit mode
Michael Felt