Kemal,

it looks like you're completely missing the libxml2 includes on that system. 
XML prefers xml2-config over pkg-config so it will by default pick the system 
version of xml2, but you don't have the includes for that.

According to your setup, they are supposed to be in
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml
but my guess is they are not.

Check the usual culprits 
 sudo xcode-select --install
and if in doubt reset 
 sudo xcode-select --reset

If that doesn't help, you can set LIBXML_INCDIR (without the libxml part) and 
LIBXML_LIBDIR yourself if you know where they are.
You also have miniconda and /usr/local so if you want to use any of that, you'd 
the teh two variables above. Alternatively, you can set --with-xml-config  to 
point to your non-system xml2-config if it points to the right 
includes/libraries.

Good luck,
Simon



> On Feb 16, 2021, at 4:20 PM, Kemal Akat <kma460...@gmail.com> wrote:
> 
> Hi Duncan and Simon,
> 
> Thanks for getting back to me.
> 
> The R version I use(d) is 
> 
> R Under development (unstable) (2021-01-15 r79833)
> 
> This was installed via the installer package downloaded from 
> https://mac.r-project.org. It was not compiled from source. That was the case 
> on all Macs.
> 
> Please note that the partially log at the bottom of my original message is 
> from a successful compilation on a Mac where ‘install.packages(“XML”) works. 
> It includes references to the CommandLineTools/SDK but that was completely 
> without my doing. I tried it explicitly in various forms, though, when I 
> thought this is the right way. Thanks for clarifying it is not.
> 
> Now, on the Mac where I still have trouble, the output from 
> ‘install.packages(“XML”) is (rather brief):
> 
> > install.packages("XML")
> Warning: unable to access index for repository 
> https://mac.R-project.org/bin/macosx/contrib/4.1:
>   cannot open URL 'https://mac.R-project.org/bin/macosx/contrib/4.1/PACKAGES'
> Package which is only available in source form, and may need compilation of 
> C/C++/Fortran: ‘XML’
> Do you want to attempt to install these from sources? (Yes/no/cancel) Yes
> installing the source package ‘XML’
> 
> trying URL 'https://mac.R-project.org/src/contrib/XML_3.99-0.5.tar.gz'
> Content type 'application/x-gzip' length 968563 bytes (945 KB)
> ==================================================
> downloaded 945 KB
> 
> * installing *source* package ‘XML’ ...
> ** package ‘XML’ successfully unpacked and MD5 sums checked
> ** using staged installation
> checking for gcc... gcc
> 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 gcc accepts -g... yes
> checking for gcc option to accept ISO C89... none needed
> checking how to run the C preprocessor... gcc -E
> checking for sed... /usr/bin/sed
> checking for pkg-config... /usr/local/bin/pkg-config
> checking for xml2-config... /usr/bin/xml2-config
> USE_XML2 = yes
> SED_EXTENDED_ARG: -E
> Minor 9, Patch 4 for 2.9.4
> Located parser file 
> -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/parser.h
> Checking for 1.8:  
> -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
> Using libxml2.*
> checking for gzopen in -lz... yes
> checking for xmlParseFile in -lxml2... yes
> You are trying to use a version 2.* edition of libxml
> but an incompatible library. The header files and library seem to be
> mismatched. If you have specified LIBXML_INCDIR, make certain to also
> specify an appropriate LIBXML_LIBDIR if the libxml2 library is not in the 
> default
> directories.
> ERROR: configuration failed for package ‘XML’
> * removing 
> ‘/Library/Frameworks/R.framework/Versions/4.1/Resources/library/XML’
> * restoring previous 
> ‘/Library/Frameworks/R.framework/Versions/4.1/Resources/library/XML’
> 
> The downloaded source packages are in
>       
> ‘/private/var/folders/j8/1gn6jwcx4bv8td2h83ghk1hh0000gp/T/RtmpXuYoas/downloaded_packages’
> Warning message:
> In install.packages("XML") :
>   installation of package ‘XML’ had non-zero exit status
> >
> 
> Best,
> Kemal
> 
> 
>> On Feb 15, 2021, at 5:42 PM, Simon Urbanek <simon.urba...@r-project.org> 
>> wrote:
>> 
>> Kemal,
>> 
>> what Duncan said, since what you provided does not include any of the 
>> information needed.
>> 
>> In addition, you should not include SDK paths directly - SDK is used by the 
>> dev tools and does *not* include the actual libraries. So when you say 
>> /foo/bar it is actually searched inside the SDK the compiler is using. If 
>> you happen to use compilers that don't use SDKs (non-Apple) then you can use 
>> -isysroot to specify the SDK root (hopefully not your case as that is a 
>> whole can of worms). In addition, the issue may come from your version of R 
>> as well so the exact information about that is also need (how you compiled 
>> it, which flags etc.).
>> 
>> Cheers,
>> Simon
>> 
>> 
>>> On Feb 16, 2021, at 4:26 AM, Duncan Temple Lang via R-SIG-Mac 
>>> <r-sig-mac@r-project.org> wrote:
>>> 
>>> Hi Kemal
>>> Can you please send the output from the entire installation attempt, and
>>> also the config.log file.
>>> 
>>> Thanks
>>> Duncan
>>> 
>>> 
>>> On Mon, Feb 15, 2021 at 5:14 AM Kemal Akat <kma460...@gmail.com> wrote:
>>> 
>>>> Hello all,
>>>> 
>>>> I have to compile the XML package from source for R 4.1 (development
>>>> version) on a Mac with OS version 10.15.7. It works well on all machines
>>>> that do not come with any significant ballast on developer tools. One
>>>> machine, however, that I have used for some time returns a mismatch of
>>>> header files and library. I looked into possible offenders and purged what
>>>> I could (e.g. deleted Homebrew although the other machines have Homebrew
>>>> and Miniconda installed as well) but to no avail.
>>>> 
>>>> install.packages(“XML”) fails and install.packages("XML",
>>>> configure.args=c("LIBXML_INCDIR=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2",
>>>> "LIBXML_LIBDIR=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib”))
>>>> also fails.
>>>> 
>>>> There are obviously differences I cannot track down so far but I am
>>>> running out of ideas. Both machines have MacOSX10.14.sdk and
>>>> MacOSX10.15.sdk installed with MacOSX.sdk linking to MacOSX10.15.sdk.
>>>> 
>>>> Here is part of the log of a successful compilation, and I was hoping
>>>> someone could point me towards a solution.
>>>> 
>>>> libxml include directory:
>>>> -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
>>>> libxml library directory:
>>>> -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lxml2 -lz
>>>> -lpthread -licucore -lm -lz  -lxml2
>>>> libxml 2:                 -DLIBXML2=1
>>>> 
>>>> Compilation flags:         -DLIBXML
>>>> -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
>>>> -DUSE_EXTERNAL_SUBSET=1 -DROOT_HAS_DTD_NODE=1 -DDUMP_WITH_ENCODING=1
>>>> -DUSE_XML_VERSION_H=1 -DXML_ELEMENT_ETYPE=1 -DXML_ATTRIBUTE_ATYPE=1
>>>> -DNO_XML_HASH_SCANNER_RETURN=1 -DLIBXML_NAMESPACE_HAS_CONTEXT=1
>>>> -DHAVE_R_CETYPE_T=1 -DHAVE_XML_WITH_ZLIB=1 -DHAVE_XML_HAS_FEATURE=1
>>>> -DUSE_R=1 -D_R_=1  -DHAVE_VALIDITY=1 -DXML_REF_COUNT_NODES=1
>>>> Link flags:
>>>> -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lxml2 -lz
>>>> -lpthread -licucore -lm -lz  -lxml2
>>>> 
>>>> 
>>>> Thanks,
>>>> Kemal
>>>> _______________________________________________
>>>> R-SIG-Mac mailing list
>>>> R-SIG-Mac@r-project.org
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>> 
>>> 
>>> 
>>> -- 
>>> ===============================
>>> Duncan Temple Lang
>>> Associate Dean for Graduate Programs
>>> Professor, Department of Statistics
>>> UC Davis
>>> 
>>>     [[alternative HTML version deleted]]
>>> 
>>> _______________________________________________
>>> R-SIG-Mac mailing list
>>> R-SIG-Mac@r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>> 
>> 
> 

_______________________________________________
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Reply via email to