[Phylobase-devl] New phylobase build approach using static libncl (Was: Rcpp and OS X compiliation)

Dirk Eddelbuettel edd at debian.org
Sat Jan 30 22:54:55 CET 2010


(previous attempt failed as over 40kb -- here is an edited version)

Hi all,

I was being busy with Rcpp, and I just this minute pushed Rcpp_0.7.4 -- with
the final fix for OS X builds -- to CRAN and Debian.  So back to phylobase.

On 30 January 2010 at 15:47, Peter Cowan wrote:
| Thanks Dirk, Mark, Romain, Simon and others who have worked on this. Getting this fixed has been on my wish list for a long time, but well beyond my abilities.  
| 
| I recently found some time to attempt building phylobase on my mac (10.6.2) w/ 64bit R 2.10.1 and phylobase r725.  I haven't been able to compile the package, it looks like it might be a configure issue, any suggestions for what I should look into changing?
| 
| Peter
| 
| a directory
| * installing to library ‘/Library/Frameworks/R.framework/Resources/library’
| * created lock directory ‘/Library/Frameworks/R.framework/Resources/library/00LOCK’
| * build_help_types=
| * DBG: R CMD INSTALL' now doing do_install
| * installing *source* package ‘phylobase’ ...
| ** backing up earlier installation
| configure command: ‘ ./configure ’
| checking whether the C++ compiler works... yes
|  checking for C++ compiler default output file name... a.out
|  checking for suffix of executables... 
|  checking whether we are cross compiling... no
|  checking for suffix of object files... o
|  checking whether we are using the GNU C++ compiler... yes
|  checking whether g++-4.2 -arch x86_64 accepts -g... yes
|  checking how to run the C++ preprocessor... g++-4.2 -arch x86_64 -E
|  checking for R... yes
|  checking for Rscript... yes
|  configure: starting to build libncl.a in ncl

All good so far. The previous line is my addition to configure.  What follows
are error when configure is running --> from the top of my head I say NCL is
broken if it lets its configure do this.

| ./configure: line 620: test: too many arguments
[...]
| ./configure: line 19691: sed: No such file or directory

But then it proceeds. Weird.  Also, for what it is worth, I do NOT get this
noise on Linux. Maybe your configure does not respond to '--quiet' ?  That
ball is in the OS X crowd's court.

|  make  all-recursive
[...]
|  libtool: link: ( cd ".libs" && rm -f "libncl.la" && ln -s "../libncl.la"  "libncl.la" )

Ok so far for 'make'. 

|  Making all in example
[...]
|  libtool: install: ranlib /private/tmp/tmpIdDKYW/src/ncl/../lib/ncl/libncl.a

This is what matters: We get libncl.a out of this. Success so far.

| ranlib: file: /private/tmp/tmpIdDKYW/src/ncl/../lib/ncl/libncl.a(nxsdistancedatum.o) has no symbols
|  ----------------------------------------------------------------------
|  Libraries have been installed in:
|     /private/tmp/tmpIdDKYW/src/ncl/../lib/ncl
|  
|  If you ever happen to want to link against installed libraries
|  in a given directory, LIBDIR, you must either use libtool, and
|  specify the full pathname of the library, or use the `-LLIBDIR'
|  flag during linking and do at least one of the following:
|     - add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable
|       during execution
|  
|  See any operating system documentation about shared libraries for
|  more information, such as the ld(1) and ld.so(8) manual pages.
|  ----------------------------------------------------------------------

I get this line noise too. Seem harmless.

|  test -z "/private/tmp/tmpIdDKYW/src/ncl/../include/ncl" || ../config/install-sh -c -d "/private/tmp/tmpIdDKYW/src/ncl/../include/ncl"
[...]
| about to run R CMD SHLIB -o phylobase.so NCLInterface.cpp ReadWithNCL.cpp ancestors.c descendants.c phyloXX.c reorderBinary.c reorderRobust.c
|  g++-4.2 -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64  -I/usr/local/include   -I/Library/Frameworks/R.framework/Resources/library/Rcpp/lib/x86_64 -Iinclude/ncl -fPIC  -mtune=core2 -g -O2 -c NCLInterface.cpp -o NCLInterface.o

This has -Iinclude/ncl, maybe we need -Iinclude now ? 

[ Starting to build at my end ]  Yes, fails for me too.

Fix is easy -- it was an intersection of my change to configure and the update
to a newer NCL and we simply needed our two phylobase files to do

   #include <ncl/ncl.h>

instead of 

   #include <ncl.h>

as everything else in NCL-land includes via  #include <ncl/somefile.h>

for good measure I also silenced the build output from
NCL via a  'make 2>&1 > /dev/null'

For what it is worth, on my end it is now simply these 40-some lines:

edd at ron:~/svn/phylobase/pkg$ R CMD INSTALL .
* installing to library ‘/usr/local/lib/R/site-library’
* installing *source* package ‘phylobase’ ...
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking for R... yes
checking for Rscript... yes
configure: starting to build libncl.a in src/ncl
configure: finished building libncl.a in src/ncl
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -I/usr/share/R/include     -I/usr/local/lib/R/site-library/Rcpp/lib -Iinclude -fpic  -g -O3 -Wall -pipe -c NCLInterface.cpp -o NCLInterface.o
In file included from include/ncl/ncl.h:102,
                 from NCLInterface.cpp:25:
include/ncl/nxscharactersblock.h: In member function ‘int NxsDiscreteDatatypeMapper::GetStateCodeStored(char) const’:
include/ncl/nxscharactersblock.h:929: warning: array subscript has type ‘char’
g++ -I/usr/share/R/include     -I/usr/local/lib/R/site-library/Rcpp/lib -Iinclude -fpic  -g -O3 -Wall -pipe -c ReadWithNCL.cpp -o ReadWithNCL.o
In file included from include/ncl/ncl.h:102,
                 from ReadWithNCL.cpp:38:
include/ncl/nxscharactersblock.h: In member function ‘int NxsDiscreteDatatypeMapper::GetStateCodeStored(char) const’:
include/ncl/nxscharactersblock.h:929: warning: array subscript has type ‘char’
gcc -std=gnu99 -I/usr/share/R/include      -fpic  -g -O3 -Wall -pipe -c ancestors.c -o ancestors.o
gcc -std=gnu99 -I/usr/share/R/include      -fpic  -g -O3 -Wall -pipe -c descendants.c -o descendants.o
gcc -std=gnu99 -I/usr/share/R/include      -fpic  -g -O3 -Wall -pipe -c phyloXX.c -o phyloXX.o
gcc -std=gnu99 -I/usr/share/R/include      -fpic  -g -O3 -Wall -pipe -c reorderBinary.c -o reorderBinary.o
gcc -std=gnu99 -I/usr/share/R/include      -fpic  -g -O3 -Wall -pipe -c reorderRobust.c -o reorderRobust.o
g++ -shared -o phylobase.so NCLInterface.o ReadWithNCL.o ancestors.o descendants.o phyloXX.o reorderBinary.o reorderRobust.o -L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -Llib/ncl -lncl -L/usr/lib/R/lib -lR
** R
** data
** inst
** preparing package for lazy loading
Creating a new generic function for "plot" in "phylobase"
** help
*** installing help indices
** building package indices ...
* DONE (phylobase)
edd at ron:~/svn/phylobase/pkg$

Looks better :)  [ And on OS X you will not see the -Wl,rpath,... as Rcpp
uses a static lib ]

Fix committed as rev726.  Feedback welcome.

Dirk

-- 
Three out of two people have difficulties with fractions.


More information about the Phylobase-devl mailing list