Skip to content

/usr/include/udunits2 is not found automatically or through Environment variable #25

Description

@cderv

This is related to #14 , that should have been fixed by #19.

I can't install the package if udunits2 is not inside the /usr/include directory. The header file is in /usr/include/udunits that thanks to #19, it should be searched in.
However, install.packages("udunits2") fails with this error

checking udunits2.h usability... no
checking udunits2.h presence... no
checking for udunits2.h... no
checking for ut_read_xml in -ludunits2... yes
-----Error: udunits2.h not found-----
     If the udunits2 library is installed in a non-standard location,
     use --configure-args='--with-udunits2-lib=/usr/local/lib' for example,
     or --configure-args='--with-udunits2-include=/usr/include/udunits2'
     replacing paths with appropriate values for your installation.
     You can alternatively use the UDUNITS2_INCLUDE and UDUNITS2_LIB
     environment variables.
     If udunits2 is not installed, please install it.
     It is required for this package.

It works if I use install.packages("udunits2",configure.args='--with-udunits2-include=/usr/include/udunits2/') but it does not work if I use environment variable UDUNITS2_INCLUDE

export UDUNITS2_INCLUDE=/usr/include/udunits2
Rscript -e 'install.packages("udunits")'

I have tried few ways to configure environment variable, and I can't make it to work.
Also, /usr/include/udunits2 should have searched

Rudunits2/configure.ac

Lines 13 to 23 in 282e732

if test [ -n "$udunits2_include_path" ] ; then
UD_CPPFLAGS="-I${udunits2_include_path}"
else
if test [ -n "${UDUNITS2_INCLUDE}" ] ; then
UD_CPPFLAGS="-I${UDUNITS2_INCLUDE}"
else
if test [ -d "/usr/include/udunits2"] ; then
UD_CPPFLAGS="-I/usr/include/udunits2"
fi
fi
fi

Is this working for someone ? Should I dig deeper on what is going on ?

Thank you for your advice.

For the context, I need to work with environment variable for a use case with packrat that cannot handle option configure.args='--with-udunits2-include=/usr/include/udunits2/'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions