Repository: conan-io/conan-center-index

Issue:
[package] libxml2/2.9.10: fails to configure when building shared libraries with clang
### Package and Environment Details (include every applicable attribute)
  * Package Name/Version: **libxml2/2.9.10**
  * Operating System+version: **Linux Ubuntu 20.04**
  * Compiler+version: **Clang 10**
  * Docker image: **conanio/gcc8**
  * Conan version: **conan 1.29.0**
  * Python version: **Python 3.8.2**


### Conan profile (output of `conan profile show default` or `conan profile show <profile>` if custom profile is in use)
```
Configuration for profile default:

[settings]
os=Linux
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=9
compiler.libcxx=libstdc++
build_type=Release
[options]
[build_requires]
[env]
```


### Steps to reproduce (Include if Applicable)

```
conan install libxml2/2.9.10@ -s build_type=Debug -s compiler=clang -s compiler.version=10 -s compiler.libcxx=libstdc++11 -e=CC=/usr/bin/clang-10 -e=CXX=/usr/bin/clang++-10 -o *:shared=True --build
```

### Logs (Include/Attach if Applicable)
<details><summary>Click to expand log</summary>

```
[...]
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... configure: error: in `/home/chitz/.conan/data/libxml2/2.9.10/_/_/build/7b03d3edf71159c05d47d3ed02acae28e55ea502':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
libxml2/2.9.10: 
libxml2/2.9.10: ERROR: Package '7b03d3edf71159c05d47d3ed02acae28e55ea502' build failed
libxml2/2.9.10: WARN: Build folder /home/chitz/.conan/data/libxml2/2.9.10/_/_/build/7b03d3edf71159c05d47d3ed02acae28e55ea502
ERROR: libxml2/2.9.10: Error in build() method, line 203
	autotools = self._configure_autotools()
while calling '_configure_autotools', line 188
	self._autotools.configure(args=configure_args, build=build, configure_dir=self._source_subfolder)
	ConanException: Error 1 while executing source_subfolder/configure '--prefix=/home/chitz/.conan/data/libxml2/2.9.10/_/_/package/7b03d3edf71159c05d47d3ed02acae28e55ea502' '--with-pic' '--enable-shared' '--disable-static' '--with-c14n' '--with-catalog' '--with-docbook' '--with-ftp' '--with-http' '--with-html' '--with-iconv' '--without-icu' '--with-iso8859x' '--with-legacy' '--without-mem-debug' '--with-output' '--with-pattern' '--with-push' '--without-python' '--with-reader' '--with-regexps' '--without-run-debug' '--with-sax1' '--with-schemas' '--with-schematron' '--with-threads' '--with-tree' '--with-valid' '--with-writer' '--with-xinclude' '--with-xpath' '--with-xptr' '--with-zlib' '--without-lzma' '--bindir=${prefix}/bin' '--sbindir=${prefix}/bin' '--libexecdir=${prefix}/bin' '--libdir=${prefix}/lib' '--includedir=${prefix}/include' '--oldincludedir=${prefix}/include' '--datarootdir=${prefix}/share' 
```

from config.log:
```
configure:3777: checking whether we are cross compiling
configure:3785: /usr/bin/clang-10 -o conftest -m64 -g -fPIC -I/home/chitz/.conan/data/zlib/1.2.11/_/_/package/23ab8764fa6dac655704aae4b3cf2635f4084da1/include -I/home/chitz/.conan/data/libiconv/1.16/_/_/package/f9ef8d26d66d633c5de261aa8b143b247793ec76/include -m64 -L/home/chitz/.conan/data/zlib/1.2.11/_/_/package/23ab8764fa6dac655704aae4b3cf2635f4084da1/lib -L/home/chitz/.conan/data/libiconv/1.16/_/_/package/f9ef8d26d66d633c5de261aa8b143b247793ec76/lib conftest.c -lz -liconv -lcharset >&5
configure:3789: $? = 0
configure:3796: ./conftest
./conftest: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory
configure:3800: $? = 127
configure:3807: error: in `/home/chitz/.conan/data/libxml2/2.9.10/_/_/build/7b03d3edf71159c05d47d3ed02acae28e55ea502':
configure:3809: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
```
</details>



Discussion:
Does this fix your problem?
```patch
--- a/recipes/libxml2/all/conanfile.py
+++ b/recipes/libxml2/all/conanfile.py
@@ -160,6 +160,7 @@ class Libxml2Conan(ConanFile):
         if self._autotools:
             return self._autotools
         self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
+        self._autotools.libs = []
         if not tools.os_info.is_windows:
             self._autotools.fpic = self.options.fPIC
         full_install_subfolder = tools.unix_path(self.package_folder) if tools.os_info.is_windows else self.package_folder
```
Yes, this seems to solve the reported issue.

Resolving patch:
diff --git a/recipes/libxml2/all/conanfile.py b/recipes/libxml2/all/conanfile.py
--- a/recipes/libxml2/all/conanfile.py
+++ b/recipes/libxml2/all/conanfile.py
@@ -160,6 +160,7 @@ def _configure_autotools(self):
         if self._autotools:
             return self._autotools
         self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
+        self._autotools.libs = []
         if not tools.os_info.is_windows:
             self._autotools.fpic = self.options.fPIC
         full_install_subfolder = tools.unix_path(self.package_folder) if tools.os_info.is_windows else self.package_folder


Test patch: