[R-SIG-Mac] any advice on libtiff? (and rtiff)

Simon Urbanek simon.urbanek at r-project.org
Thu Apr 29 18:19:38 CEST 2010


On Apr 28, 2010, at 6:25 PM, Carl Witthoft wrote:

> Hi, I know rtiff does not compile 'cause it can't find libtiff (per cran check logs).
> 

Unfortunately rtiff forces wrong flags (that it checks with the wrong compilers and flags) and it allows no way around it so the best way forward would be if Eric could address this (details below).

The correct flags for the static build are PKG_LIBS="-ltiff -ljpeg -lz" because libtiff relies on JPEG and libz, but rtiff does not allow that.

I'm CCing Eric in the hope that this can be addressed in the package:

First, configure will check with CPPFLAGS, CFLAGS, LIBS etc. yet those all are ignored since there is
PKG_LIBS="-ltiff"
which is wrong - that's not what configure actually checked at all. AC_CHECK_LIB modifies LIBS to reflect the correct flags so it should be at the very least
PKG_LIBS="$LIBS"

Second, the R compiler settings are ignored so the checks are actually run with the wrong compiler (this is crucial because let's say if you compile for R_ARCH=/x86_64 then the checks will be run with the default architecture of the compiler such as i386 which is completely different).

Also to make it more R friendly it is a good idea to initialize LIBS="$PKG_LIBS" so that the commonly used PKG_LIBS are respected (this is optional). So the configure.in could look something like

AC_PREREQ(2.1)
AC_INIT([rtiff], [1.1], [eric.kort at vai.org])
AC_CONFIG_SRCDIR([src/rtiff.c])

: ${R_HOME=`R RHOME`}
if test -z "${R_HOME}"; then
  echo "could not determine R_HOME"
  exit 1
fi
RBIN="${R_HOME}/bin/R"
CC=`"${RBIN}" CMD config CC`;
CFLAGS=`"${RBIN}" CMD config CFLAGS`
LIBS="${PKG_LIBS}"

# Checks for programs.
AC_PROG_CC

# Checks for libtiff.
AC_CHECK_LIB([tiff], [TIFFOpen], [], [
                echo Error: Could not find libtiff.
                exit -1
                ])

PKG_LIBS="$LIBS"

AC_SUBST(PKG_LIBS)
AC_OUTPUT([src/Makevars])


Thanks,
Simon


> I'm just wondering if anyone has successfully installed libtiff, either from source or via MacPorts?  And if so,  is it then possible to build rtiff from the source and have everything work?
> 
> So far I've (naively) tried building libtiff3.9.2 from sources, but even though "make" seems to happily complete its job,  nothing seems to be installed anywhere useful.
> 
> Or should I just bite the bullet and install the Gtk tiff tools and that big graphics package (something-BE, I forget the name just now)?
> 
> 
> thanks
> Carl
> 
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> 
> 



More information about the R-SIG-Mac mailing list