[Rd] Building R in 64-bit mode

Michael Felt aixtools at gmail.com
Wed Dec 16 13:03:01 CET 2015

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 
      ##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"
-      main_ldflags="${wl}-brtl ${wl}-bexpall -lc"
+      main_ldflags="${wl}-brtl ${wl}-bmaxdata:0xd0000000/dsa -lc"
-    shlib_ldflags="${wl}-brtl ${wl}-G ${wl}-bexpall ${wl}-bnoentry -lc"
+    shlib_ldflags="${wl}-G ${wl}-bnoentry -lc"
      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 
make[1]: Leaving directory 
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 
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
# 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}.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]


More information about the R-devel mailing list