From aixtools at gmail.com  Sun Oct 18 21:06:50 2015
From: aixtools at gmail.com (aixtools)
Date: Sun, 18 Oct 2015 21:06:50 +0200
Subject: [Rd] Building R for AIX in 32-bit mode - as preparation for
 building in 64-bit mode (changed subject!) - INFO/FEEDBACK - do not read as
 a bug report!
In-Reply-To: <561FA401.7010207@stats.ox.ac.uk>
References: <CANvxniVBrCaT1C3HosULfg4OfBNkL-vQqnFuTt+j=pfMbovX_Q@mail.gmail.com>
	<561FA401.7010207@stats.ox.ac.uk>
Message-ID: <5623EDCA.5030309@gmail.com>

On 2015-10-15 15:02, Prof Brian Ripley wrote:
> On 15/10/2015 13:32, Michael Felt wrote:
>> Hi.
>>
>> Just wanted to let you know I am getting close to packaging R for AIX in
rephrase - would like to be active in keeping R binaries current for 
AIX. My interest in not in R per se (rather a colleague who has a 
project that uses R, so I hope to assist him, and others like him).
>
> Which version? (You mentioned 3.1.3 and 3.2.2 far below.)  There is 
> little value in reporting on frozen branches, and most value in 
> reporting on R-devel where all the current changes have been 
> incorporated.
The reason for reporting old and current releases is to understand what 
is new between releases, and what has been around for "awhile".

Note: in the future I shall edit all the "you cannot build, could not 
determine ... messages" - and as much as possible, shall focus on 
R-devel "packaging".

I (attempt to) 'package' a lot of Opensource tools for AIX. Generally, 
the problems are not application code related (sometimes a function 
available on one platform, e.g. Linux, but not on AIX) - but most are, 
or can be resolved, with modifications via configure.ac, Makefile.in, etc..

Sincerely,
Michael

"Details"...

When configure does complete - config.log starts with:
It was created by R configure 3.1.3, which was
generated by GNU Autoconf 2.69.  Invocation command line was

   $ ./configure --prefix=/opt --sysconfdir=/var/R/etc 
--sharedstatedir=/var/R/com --localstatedir=/var/R 
--mandir=/usr/share/man --infodir=/opt/share/info/R --with-readline=no 
--with-x=no

As I see you are using a recent autoconf (and I shall guess a recent 
automake) I would like to try a more version of libtool and see if that 
corrects anything. However, even in R-devel I do not see, directly, how 
you are using these tools (some projects include either a setup.sh or a 
buildconf script to standardize how the project does this.) I am quite 
capable of just calling the tools in sequence, but would prefer to 
follow your procedure.
I
Starting again - fresh 3.1.3, 3.2.2 and R-devel - all in 32-bit mode, 
for the start. The goal is a 64-bit build so that memory management will 
be easier.

This is my "standard command for building a package"

CPPFLAGS="-I/opt/buildaix/include -I/opt/include" CFLAGS="-I/opt/include 
-I/opt/buildaix/include -O2" ./configure \
                 --prefix=/opt  \
                 --sysconfdir=/var/R/etc \
                 --sharedstatedir=/var/R/com \
                 --localstatedir=/var/R \
                 --mandir=/usr/share/man \
                 --infodir=/opt/share/info/R --with-readline=no --with-x=no
Results for 3.1.3
configure: WARNING: you cannot build PDF versions of the R manuals
configure: WARNING: you cannot build PDF versions of vignettes and help 
pages
configure: WARNING: you cannot build info or HTML versions of the R manuals
configure: WARNING: I could not determine a browser
configure: WARNING: I could not determine a PDF viewer
configure: WARNING: you cannot build info or HTML versions of the R manuals
configure: WARNING: you cannot build PDF versions of the R manuals
configure: WARNING: you cannot build PDF versions of vignettes and help 
pages
configure: WARNING: I could not determine a browser
configure: WARNING: I could not determine a PDF viewer
+ make > .buildaix/make.out
sys-std.c: In function 'Rstd_ChooseFile':
sys-std.c:1186:5: warning: implicit declaration of function 'isspace' 
[-Wimplicit-function-declaration]
connections.c: In function 'fifo_open':
connections.c:885:5: warning: implicit declaration of function 'open' 
[-Wimplicit-function-declaration]
main.c: In function 'dummy_ii':
main.c:1594:5: warning: function returns address of local variable 
[enabled by default]
ld: 0711-224 WARNING: Duplicate symbol: .memcpy
ld: 0711-224 WARNING: Duplicate symbol: memcpy
ld: 0711-224 WARNING: Duplicate symbol: .bcopy
ld: 0711-224 WARNING: Duplicate symbol: bcopy
ld: 0711-224 WARNING: Duplicate symbol: .strcmp
ld: 0711-224 WARNING: Duplicate symbol: strcmp
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more 
information.
Warning in solve.default(rgb) :
   unable to load shared object 
'/data/prj/cran/32/R-3.1.3/modules//lapack.so':
   rtld: 0712-001 Symbol logf was referenced
       from module /data/prj/cran/32/R-3.1.3/lib/libRlapack.so(), but a 
runtime definition
             of the symbol was not found.
Error in solve.default(rgb) : LAPACK routines cannot be loaded
Error: unable to load R code in package 'grDevices'
Execution halted
make: 1254-004 The error code from the last command is 1.

...

Stop.
make returned an error
root at x072:[/data/prj/cran/32/R-3.1.3]
++++++
Notes: Last April I was successful with building R - I do not recall 
specifically how I changed the release. I shall determine what I did to 
get it to build normally.
++++++
Results for 3.2.2
configure: WARNING: you cannot build PDF versions of the R manuals
configure: WARNING: you cannot build PDF versions of vignettes and help 
pages
configure: WARNING: you cannot build info or HTML versions of the R manuals
configure: WARNING: I could not determine a browser
configure: WARNING: I could not determine a PDF viewer
configure: WARNING: you cannot build info or HTML versions of the R manuals
configure: WARNING: you cannot build PDF versions of the R manuals
configure: WARNING: you cannot build PDF versions of vignettes and help 
pages
configure: WARNING: I could not determine a browser
configure: WARNING: I could not determine a PDF viewer
+ make > .buildaix/make.out
sys-std.c: In function 'Rstd_ChooseFile':
sys-std.c:1189:5: warning: implicit declaration of function 'isspace' 
[-Wimplicit-function-declaration]
connections.c: In function 'fifo_open':
connections.c:876:5: warning: implicit declaration of function 'open' 
[-Wimplicit-function-declaration]
main.c: In function 'dummy_ii':
main.c:1598:5: warning: function returns address of local variable 
[enabled by default]
ld: 0711-415 WARNING: Symbol BM_norm_keep is already exported.
ld: 0711-415 WARNING: Symbol LoadInitFile is already exported.
ld: 0711-415 WARNING: Symbol N01_kind is already exported.
ld: 0711-415 WARNING: Symbol R_ReadItemDepth is already exported.
ld: 0711-224 WARNING: Duplicate symbol: LoadInitFile
ld: 0711-224 WARNING: Duplicate symbol: BM_norm_keep
ld: 0711-224 WARNING: Duplicate symbol: N01_kind
ld: 0711-224 WARNING: Duplicate symbol: R_ReadItemDepth
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more 
information.
ld: 0711-415 WARNING: Symbol BM_norm_keep is already exported.
ld: 0711-415 WARNING: Symbol LoadInitFile is already exported.
ld: 0711-415 WARNING: Symbol N01_kind is already exported.
ld: 0711-415 WARNING: Symbol R_ReadItemDepth is already exported.
ld: 0711-224 WARNING: Duplicate symbol: LoadInitFile
ld: 0711-224 WARNING: Duplicate symbol: BM_norm_keep
ld: 0711-224 WARNING: Duplicate symbol: N01_kind
ld: 0711-224 WARNING: Duplicate symbol: R_ReadItemDepth
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more 
information.
ld: 0711-224 WARNING: Duplicate symbol: .memcpy
ld: 0711-224 WARNING: Duplicate symbol: memcpy
ld: 0711-224 WARNING: Duplicate symbol: .bcopy
ld: 0711-224 WARNING: Duplicate symbol: bcopy
ld: 0711-224 WARNING: Duplicate symbol: .strcmp
ld: 0711-224 WARNING: Duplicate symbol: strcmp
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more 
information.
/bin/sh: There is no process to read data written to a pipe.
Warning in solve.default(rgb) :
   unable to load shared object 
'/data/prj/cran/32/R-3.2.2/modules//lapack.so':
   rtld: 0712-001 Symbol logf was referenced
       from module /data/prj/cran/32/R-3.2.2/lib/libRlapack.so(), but a 
runtime definition
             of the symbol was not found.
Error in solve.default(rgb) : LAPACK routines cannot be loaded
Error: unable to load R code in package 'grDevices'
Execution halted
make: 1254-004 The error code from the last command is 1.

...
make returned an error
+++++
Here there are similiar - and new problems. The error re: rtld is 
usually a compiler (actually ld) flag error - a routine is expected to 
be exported in a shared object, but the object is still "static".
I have seen this same problem with at least one R module.

I still am unsure why some functions are being defined double - that 
info will come later
root at x072:[/data/prj/cran/32/R-3.2.2]

+++++
>From  R-devel_2015-10-17.tar.bz2
configure: WARNING: you cannot build PDF versions of the R manuals
configure: WARNING: you cannot build PDF versions of vignettes and help 
pages
configure: WARNING: you cannot build info or HTML versions of the R manuals
configure: WARNING: I could not determine a browser
configure: WARNING: I could not determine a PDF viewer
configure: error: bzip2 library and headers are required
buildaix: ./configure ... returned an error

try doing "grep configure: config.log | tail" for possible explanation

try "./configure --help" for additional arguments to buildaix
++++ config.log configure: comments are ++++
configure:35647: checking bzlib.h presence
configure:35647: gcc -E -I/opt/buildaix/include -I/opt/include  conftest.c
configure:35647: $? = 1
configure: failed program was:
configure:35647: result: no
configure:35647: checking for bzlib.h
configure:35647: result: no
configure:35712: checking whether bzip2 support suffices
configure:35719: error: bzip2 library and headers are required
configure: exit 1
++++ ++++
Here is a completely new kind of "problem" - a demand for an include 
file. bzip2 is available, but configure is looking for it in a different 
way and now configure fails.

>
>> One comment - the libtool.m4 I see used is quite old. The one I have 
>> on my
>> system is 2.4.6, and what I see in R says:
>
> R-devel has 2.4.6 .
>
>> I am hoping a new libtool will clean up most of the manual work now 
>> needed.
>
> But libtool is hardly used in building R.
>
>> # Which release of libtool.m4 was used?
>> macro_version=2.2.6
>> macro_revision=1.3012
>>
>> This may be all that is needed to cleanup what I am doing manually.
>>
>> working with gcc I have done the following for 64-bit building
>>
>> export OBJECT_MODE=64
>> export CFLAGS="-maix64 -O2"
>> export FFLAGS="-maix64 -O2"
>
> See the manual: flags such as -maix64 should be part of CC, not 
> CFLAGS.  That explains a lot of what was reported.
> Specifically, 
> https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Essential-programs-and-libraries 
> and https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#AIX .
>
> It is safer to put such things on the configure command line or in a 
> config.site file (they will be found when updating if you do).
>
> [Lots of test output removed.]
>



[Rd] Building R for AIX in 32-bit mode - as preparation for building in 64-bit mode (changed subject!) - INFO/FEEDBACK - do not read as a bug report!
aixtools