Repository: conan-io/conan-center-index

Issue:
[package] armadillo/10.7.0: link failures when using use_wrapper=True
### Description

Package fails to build with linking errors when `use_wrapper=True` and `use_lapack` is set to any value other than `False`. The nature of the linking errors change depending on the specific lapack implementation used.

### Package and Environment Details (include every applicable attribute)
  * Package Name/Version: **armadillo/10.7.0**
  * Operating System+version: **Arch Linux**
  * Compiler+version: **Clang 12**
  * Conan version: **conan 1.40.3**
  * Python version: **Python 3.9.7**


### 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=clang
compiler.version=12
compiler.libcxx=libstdc++11
build_type=Release
[options]
[conf]
[build_requires]
[env]
CC=/usr/bin/clang
CXX=/usr/bin/clang++
```

### Steps to reproduce (Include if Applicable)

Build with the following command:

```bash
armadillo/all $ conan create . 10.7.0@user/experimental --build=missing -o armadillo:use_wrapper=True -o armadillo:use_lapack=openblas
```

### Logs (Include/Attach if Applicable)
<details><summary>Click to expand log</summary>

```
$ conan create . 10.7.0@user/experimental --build=missing -o armadillo:use_wrapper=True -o armadillo:use_lapack=openblas
[HOOK - conan-center.py] pre_export(): [DEPRECATED GLOBAL CPPSTD (KB-H001)] OK
[HOOK - conan-center.py] pre_export(): [REFERENCE LOWERCASE (KB-H002)] OK
[HOOK - conan-center.py] pre_export(): [RECIPE METADATA (KB-H003)] OK
[HOOK - conan-center.py] pre_export(): [HEADER_ONLY, NO COPY SOURCE (KB-H005)] OK
[HOOK - conan-center.py] pre_export(): [FPIC OPTION (KB-H006)] OK
[HOOK - conan-center.py] pre_export(): [VERSION RANGES (KB-H008)] OK
[HOOK - conan-center.py] pre_export(): [RECIPE FOLDER SIZE (KB-H009)] Total recipe size: 21.859375 KB
[HOOK - conan-center.py] pre_export(): [RECIPE FOLDER SIZE (KB-H009)] OK
[HOOK - conan-center.py] pre_export(): [EXPORT LICENSE (KB-H023)] exports: None
[HOOK - conan-center.py] pre_export(): [EXPORT LICENSE (KB-H023)] exports: ['CMakeLists.txt', 'patches/*']
[HOOK - conan-center.py] pre_export(): [EXPORT LICENSE (KB-H023)] OK
[HOOK - conan-center.py] pre_export(): [TEST PACKAGE FOLDER (KB-H024)] OK
[HOOK - conan-center.py] pre_export(): [META LINES (KB-H025)] OK
[HOOK - conan-center.py] pre_export(): [CONAN CENTER INDEX URL (KB-H027)] OK
[HOOK - conan-center.py] pre_export(): [CMAKE MINIMUM VERSION (KB-H028)] OK
[HOOK - conan-center.py] pre_export(): [TEST PACKAGE - RUN ENVIRONMENT (KB-H029)] OK
[HOOK - conan-center.py] pre_export(): [SYSTEM REQUIREMENTS (KB-H032)] OK
[HOOK - conan-center.py] pre_export(): [CONANDATA.YML FORMAT (KB-H030)] OK
[HOOK - conan-center.py] pre_export(): [TEST PACKAGE - NO IMPORTS() (KB-H034)] OK
[HOOK - conan-center.py] pre_export(): [NO AUTHOR (KB-H037)] OK
[HOOK - conan-center.py] pre_export(): [NO TARGET NAME (KB-H040)] OK
[HOOK - conan-center.py] pre_export(): [NO FINAL ENDLINE (KB-H041)] OK
[HOOK - conan-center.py] pre_export(): [NO REQUIRES.ADD() (KB-H044)] OK
[HOOK - conan-center.py] pre_export(): [DELETE OPTIONS (KB-H045)] OK
[HOOK - conan-center.py] pre_export(): [NO ASCII CHARACTERS (KB-H047)] OK
[HOOK - conan-center.py] pre_export(): [CMAKE VERBOSE MAKEFILE (KB-H046)] OK
[HOOK - conan-center.py] pre_export(): [CMAKE VERSION REQUIRED (KB-H048)] OK
[HOOK - conan-center.py] pre_export(): [CMAKE WINDOWS EXPORT ALL SYMBOLS (KB-H049)] OK
[HOOK - conan-center.py] pre_export(): [DEFAULT OPTIONS AS DICTIONARY (KB-H051)] OK
[HOOK - conan-center.py] pre_export(): [CONFIG.YML HAS NEW VERSION (KB-H052)] OK
[HOOK - conan-center.py] pre_export(): [PRIVATE IMPORTS (KB-H053)] OK
[HOOK - conan-center.py] pre_export(): [SINGLE REQUIRES (KB-H055)] OK
[HOOK - conan-center.py] pre_export(): [ILLEGAL CHARACTERS (KB-H058)] OK
[HOOK - conan-center.py] pre_export(): [CLASS NAME (KB-H059)] OK
[HOOK - conan-center.py] pre_export(): [NO CRLF (KB-H060)] OK
Exporting package recipe
armadillo/10.7.0@user/experimental exports: File 'conandata.yml' found. Exporting it...
armadillo/10.7.0@user/experimental exports: Copied 1 '.yml' file: conandata.yml
armadillo/10.7.0@user/experimental exports_sources: Copied 1 '.txt' file: CMakeLists.txt
armadillo/10.7.0@user/experimental exports_sources: Copied 1 '.patch' file: 0001-Guard-dependency-discovery-10.7.x.patch
[HOOK - conan-center.py] post_export(): [CONANDATA.YML REDUCE (KB-H031)] Saving conandata.yml: {'sources': {'10.7.0': {'url': 'http://sourceforge.net/projects/arma/files/armadillo-10.7.0.tar.xz', 'sha256': '9bf60db6fd237721908747a0e56797b97b7ceae3603f2cca0b012a3b88265d3f'}}, 'patches': {'10.7.0': [{'patch_file': 'patches/0001-Guard-dependency-discovery-10.7.x.patch', 'base_path': 'source_subfolder'}]}}
[HOOK - conan-center.py] post_export(): [CONANDATA.YML REDUCE (KB-H031)] New conandata.yml contents: patches:
  10.7.0:
  - base_path: source_subfolder
    patch_file: patches/0001-Guard-dependency-discovery-10.7.x.patch
sources:
  10.7.0:
    sha256: 9bf60db6fd237721908747a0e56797b97b7ceae3603f2cca0b012a3b88265d3f
    url: http://sourceforge.net/projects/arma/files/armadillo-10.7.0.tar.xz

[HOOK - conan-center.py] post_export(): [CONANDATA.YML REDUCE (KB-H031)] OK
[HOOK - conan-center.py] post_export(): [DEFAULT SHARED OPTION VALUE (KB-H050)] OK
[HOOK - conan-center.py] post_export(): [LICENSE PUBLIC DOMAIN (KB-H056)] OK
armadillo/10.7.0@user/experimental: The stored package has not changed
armadillo/10.7.0@user/experimental: Exported revision: beaa1f82479d3b30ead7bdb17c840c9d
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=clang
compiler.libcxx=libstdc++11
compiler.version=12
os=Linux
os_build=Linux
[options]
armadillo:use_lapack=openblas
armadillo:use_wrapper=True
[build_requires]
[env]
CC=/usr/bin/clang
CXX=/usr/bin/clang++
armadillo/10.7.0@user/experimental (test package): Installing package
Requirements
    armadillo/10.7.0@user/experimental from local cache - Cache
    hdf5/1.12.0 from 'conan-center' - Cache
    openblas/0.3.15 from 'conan-center' - Cache
    zlib/1.2.11 from local cache - Cache
Packages
    armadillo/10.7.0@user/experimental:c7cc37c516de661535d50b828648acb9ce65031b - Cache
    hdf5/1.12.0:3f22154578c7c0e2435e0601062a568ea7317d8e - Cache
    openblas/0.3.15:88801476b003cc655b9f543526c7af0131d9b018 - Cache
    zlib/1.2.11:cf142e38e022cf2a99aadebfd8f37ead3e935ad7 - Cache

Installing (downloading, building) binaries...
openblas/0.3.15: Already installed!
openblas/0.3.15: Setting OpenBLAS_HOME environment variable: /home/user/.conan/data/openblas/0.3.15/_/_/package/88801476b003cc655b9f543526c7af0131d9b018
[HOOK - conan-center.py] post_package_info(): [CMAKE FILE NOT IN BUILD FOLDERS (KB-H019)] OK
[HOOK - conan-center.py] post_package_info(): [LIBRARY DOES NOT EXIST (KB-H054)] OK
zlib/1.2.11: Already installed!
[HOOK - conan-center.py] post_package_info(): [CMAKE FILE NOT IN BUILD FOLDERS (KB-H019)] OK
[HOOK - conan-center.py] post_package_info(): [LIBRARY DOES NOT EXIST (KB-H054)] OK
hdf5/1.12.0: Already installed!
[HOOK - conan-center.py] post_package_info(): [CMAKE FILE NOT IN BUILD FOLDERS (KB-H019)] OK
[HOOK - conan-center.py] post_package_info(): [LIBRARY DOES NOT EXIST (KB-H054)] OK
armadillo/10.7.0@user/experimental: Already installed!
[HOOK - conan-center.py] post_package_info(): [CMAKE FILE NOT IN BUILD FOLDERS (KB-H019)] OK
[HOOK - conan-center.py] post_package_info(): [LIBRARY DOES NOT EXIST (KB-H054)] OK
armadillo/10.7.0@user/experimental (test package): Generator txt created conanbuildinfo.txt
armadillo/10.7.0@user/experimental (test package): Generator cmake created conanbuildinfo.cmake
armadillo/10.7.0@user/experimental (test package): Generator cmake_find_package created Findarmadillo.cmake
armadillo/10.7.0@user/experimental (test package): Generator cmake_find_package created FindHDF5.cmake
armadillo/10.7.0@user/experimental (test package): Generator cmake_find_package created FindOpenBLAS.cmake
armadillo/10.7.0@user/experimental (test package): Generator cmake_find_package created FindZLIB.cmake
armadillo/10.7.0@user/experimental (test package): Aggregating env generators
armadillo/10.7.0@user/experimental (test package): Generated conaninfo.txt
armadillo/10.7.0@user/experimental (test package): Generated graphinfo
Using lockfile: '/home/user/projects/conan-center-index/recipes/armadillo/all/test_package/build/888dd218ff4e199729a4933c3768eb286c36a7c7/conan.lock'
Using cached profile from lockfile
[HOOK - conan-center.py] pre_build(): [FPIC MANAGEMENT (KB-H007)] 'fPIC' option not found
[HOOK - conan-center.py] pre_build(): [FPIC MANAGEMENT (KB-H007)] OK
armadillo/10.7.0@user/experimental (test package): Calling build()
-- The CXX compiler identification is Clang 12.0.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: called by CMake conan helper
-- Conan: Adjusting output directories
-- Conan: Using cmake targets configuration
-- Library armadillo found /home/user/.conan/data/armadillo/10.7.0/dowlings/experimental/package/c7cc37c516de661535d50b828648acb9ce65031b/lib/libarmadillo.a
-- Library hdf5_hl_cpp found /home/user/.conan/data/hdf5/1.12.0/_/_/package/3f22154578c7c0e2435e0601062a568ea7317d8e/lib/libhdf5_hl_cpp.a
-- Library hdf5_cpp found /home/user/.conan/data/hdf5/1.12.0/_/_/package/3f22154578c7c0e2435e0601062a568ea7317d8e/lib/libhdf5_cpp.a
-- Library hdf5_hl found /home/user/.conan/data/hdf5/1.12.0/_/_/package/3f22154578c7c0e2435e0601062a568ea7317d8e/lib/libhdf5_hl.a
-- Library hdf5 found /home/user/.conan/data/hdf5/1.12.0/_/_/package/3f22154578c7c0e2435e0601062a568ea7317d8e/lib/libhdf5.a
-- Library openblas found /home/user/.conan/data/openblas/0.3.15/_/_/package/88801476b003cc655b9f543526c7af0131d9b018/lib/libopenblas.a
-- Library z found /home/user/.conan/data/zlib/1.2.11/_/_/package/cf142e38e022cf2a99aadebfd8f37ead3e935ad7/lib/libz.a
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Conan: Compiler Clang>=8, checking major version 12
-- Conan: Checking correct version: 12
-- Conan: C++ stdlib: libstdc++11
-- Conan: Using autogenerated Findarmadillo.cmake
-- Found armadillo: 10.7.0 (found version "10.7.0")
-- Library armadillo found /home/user/.conan/data/armadillo/10.7.0/dowlings/experimental/package/c7cc37c516de661535d50b828648acb9ce65031b/lib/libarmadillo.a
-- Skipping already existing target: CONAN_LIB::armadillo_armadillo
-- Found: /home/user/.conan/data/armadillo/10.7.0/dowlings/experimental/package/c7cc37c516de661535d50b828648acb9ce65031b/lib/libarmadillo.a
-- Conan: Using autogenerated FindHDF5.cmake
-- Found HDF5: 1.12.0 (found version "1.12.0")
-- Library hdf5_hl_cpp found /home/user/.conan/data/hdf5/1.12.0/_/_/package/3f22154578c7c0e2435e0601062a568ea7317d8e/lib/libhdf5_hl_cpp.a
-- Found: /home/user/.conan/data/hdf5/1.12.0/_/_/package/3f22154578c7c0e2435e0601062a568ea7317d8e/lib/libhdf5_hl_cpp.a
-- Library hdf5_cpp found /home/user/.conan/data/hdf5/1.12.0/_/_/package/3f22154578c7c0e2435e0601062a568ea7317d8e/lib/libhdf5_cpp.a
-- Found: /home/user/.conan/data/hdf5/1.12.0/_/_/package/3f22154578c7c0e2435e0601062a568ea7317d8e/lib/libhdf5_cpp.a
-- Library hdf5_hl found /home/user/.conan/data/hdf5/1.12.0/_/_/package/3f22154578c7c0e2435e0601062a568ea7317d8e/lib/libhdf5_hl.a
-- Found: /home/user/.conan/data/hdf5/1.12.0/_/_/package/3f22154578c7c0e2435e0601062a568ea7317d8e/lib/libhdf5_hl.a
-- Library hdf5 found /home/user/.conan/data/hdf5/1.12.0/_/_/package/3f22154578c7c0e2435e0601062a568ea7317d8e/lib/libhdf5.a
-- Found: /home/user/.conan/data/hdf5/1.12.0/_/_/package/3f22154578c7c0e2435e0601062a568ea7317d8e/lib/libhdf5.a
-- Conan: Using autogenerated FindZLIB.cmake
-- Found ZLIB: 1.2.11 (found version "1.2.11")
-- Library z found /home/user/.conan/data/zlib/1.2.11/_/_/package/cf142e38e022cf2a99aadebfd8f37ead3e935ad7/lib/libz.a
-- Found: /home/user/.conan/data/zlib/1.2.11/_/_/package/cf142e38e022cf2a99aadebfd8f37ead3e935ad7/lib/libz.a
-- Library hdf5 found /home/user/.conan/data/hdf5/1.12.0/_/_/package/3f22154578c7c0e2435e0601062a568ea7317d8e/lib/libhdf5.a
-- Found: /home/user/.conan/data/hdf5/1.12.0/_/_/package/3f22154578c7c0e2435e0601062a568ea7317d8e/lib/libhdf5.a
-- Library hdf5_hl found /home/user/.conan/data/hdf5/1.12.0/_/_/package/3f22154578c7c0e2435e0601062a568ea7317d8e/lib/libhdf5_hl.a
-- Found: /home/user/.conan/data/hdf5/1.12.0/_/_/package/3f22154578c7c0e2435e0601062a568ea7317d8e/lib/libhdf5_hl.a
-- Library hdf5_cpp found /home/user/.conan/data/hdf5/1.12.0/_/_/package/3f22154578c7c0e2435e0601062a568ea7317d8e/lib/libhdf5_cpp.a
-- Found: /home/user/.conan/data/hdf5/1.12.0/_/_/package/3f22154578c7c0e2435e0601062a568ea7317d8e/lib/libhdf5_cpp.a
-- Library hdf5_hl_cpp found /home/user/.conan/data/hdf5/1.12.0/_/_/package/3f22154578c7c0e2435e0601062a568ea7317d8e/lib/libhdf5_hl_cpp.a
-- Found: /home/user/.conan/data/hdf5/1.12.0/_/_/package/3f22154578c7c0e2435e0601062a568ea7317d8e/lib/libhdf5_hl_cpp.a
-- Conan: Using autogenerated FindOpenBLAS.cmake
-- Found OpenBLAS: 0.3.15 (found version "0.3.15")
-- Library openblas found /home/user/.conan/data/openblas/0.3.15/_/_/package/88801476b003cc655b9f543526c7af0131d9b018/lib/libopenblas.a
-- Found: /home/user/.conan/data/openblas/0.3.15/_/_/package/88801476b003cc655b9f543526c7af0131d9b018/lib/libopenblas.a
-- Library openblas found /home/user/.conan/data/openblas/0.3.15/_/_/package/88801476b003cc655b9f543526c7af0131d9b018/lib/libopenblas.a
-- Found: /home/user/.conan/data/openblas/0.3.15/_/_/package/88801476b003cc655b9f543526c7af0131d9b018/lib/libopenblas.a
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_EXPORT_NO_PACKAGE_REGISTRY
    CMAKE_INSTALL_BINDIR
    CMAKE_INSTALL_DATAROOTDIR
    CMAKE_INSTALL_INCLUDEDIR
    CMAKE_INSTALL_LIBDIR
    CMAKE_INSTALL_LIBEXECDIR
    CMAKE_INSTALL_OLDINCLUDEDIR
    CMAKE_INSTALL_SBINDIR


-- Build files have been written to: /home/user/projects/conan-center-index/recipes/armadillo/all/test_package/build/888dd218ff4e199729a4933c3768eb286c36a7c7
[ 50%] Building CXX object CMakeFiles/example.dir/example.cpp.o
[100%] Linking CXX executable bin/example
/usr/bin/ld: CMakeFiles/example.dir/example.cpp.o: in function `bool arma::auxlib::det<double>(double&, arma::Mat<double>&)':
example.cpp:(.text._ZN4arma6auxlib3detIdEEbRT_RNS_3MatIS2_EE[_ZN4arma6auxlib3detIdEEbRT_RNS_3MatIS2_EE]+0xc5): undefined reference to `wrapper2_dgetrf_'
/usr/bin/ld: CMakeFiles/example.dir/example.cpp.o: in function `bool arma::op_inv::apply_direct<arma::Mat<double> >(arma::Mat<arma::Mat<double>::elem_type>&, arma::Base<arma::Mat<double>::elem_type, arma::Mat<double> > const&, char const*)':
example.cpp:(.text._ZN4arma6op_inv12apply_directINS_3MatIdEEEEbRNS2_INT_9elem_typeEEERKNS_4BaseIS5_S4_EEPKc[_ZN4arma6op_inv12apply_directINS_3MatIdEEEEbRNS2_INT_9elem_typeEEERKNS_4BaseIS5_S4_EEPKc]+0x53b): undefined reference to `wrapper2_dpotrf_'
/usr/bin/ld: example.cpp:(.text._ZN4arma6op_inv12apply_directINS_3MatIdEEEEbRNS2_INT_9elem_typeEEERKNS_4BaseIS5_S4_EEPKc[_ZN4arma6op_inv12apply_directINS_3MatIdEEEEbRNS2_INT_9elem_typeEEERKNS_4BaseIS5_S4_EEPKc]+0x564): undefined reference to `wrapper2_dpotri_'
/usr/bin/ld: example.cpp:(.text._ZN4arma6op_inv12apply_directINS_3MatIdEEEEbRNS2_INT_9elem_typeEEERKNS_4BaseIS5_S4_EEPKc[_ZN4arma6op_inv12apply_directINS_3MatIdEEEEbRNS2_INT_9elem_typeEEERKNS_4BaseIS5_S4_EEPKc]+0x639): undefined reference to `wrapper2_dtrtri_'
/usr/bin/ld: CMakeFiles/example.dir/example.cpp.o: in function `bool arma::auxlib::inv<double>(arma::Mat<double>&)':
example.cpp:(.text._ZN4arma6auxlib3invIdEEbRNS_3MatIT_EE[_ZN4arma6auxlib3invIdEEbRNS_3MatIT_EE]+0x9c): undefined reference to `wrapper2_dgetri_'
/usr/bin/ld: example.cpp:(.text._ZN4arma6auxlib3invIdEEbRNS_3MatIT_EE[_ZN4arma6auxlib3invIdEEbRNS_3MatIT_EE]+0x1ad): undefined reference to `wrapper2_dgetrf_'
/usr/bin/ld: example.cpp:(.text._ZN4arma6auxlib3invIdEEbRNS_3MatIT_EE[_ZN4arma6auxlib3invIdEEbRNS_3MatIT_EE]+0x1e9): undefined reference to `wrapper2_dgetri_'
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [CMakeFiles/example.dir/build.make:110: bin/example] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/example.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
ERROR: armadillo/10.7.0@user/experimental (test package): Error in build() method, line 13
        cmake.build()
        ConanException: Error 2 while executing cmake --build '/home/user/projects/conan-center-index/recipes/armadillo/all/test_package/build/888dd218ff4e199729a4933c3768eb286c36a7c7' '--' '-j24'
```

</details>



Discussion:
I suspect that linker failures when using the wrapper, are at least partially caused by building armadillo as a static library and attempting to have it link to a dynamic lapack library. Since static libraries have no capacity to track their dependencies, this results in unresolved symbols. The following examples illustrate this. Note that my system lapack libraries are shared objects.

### Link successful

```bash
conan create . 10.7.0@user/experimental --build=missing -o armadillo:use_wrapper=True -o armadillo:shared=True -o armadillo:use_lapack=system_lapack
```

### Link failure

```bash
conan create . 10.7.0@user/experimental --build=missing -o armadillo:use_wrapper=True -o armadillo:shared=False -o armadillo:use_lapack=system_lapack
```

I'm not sure if this is appropriate to deal with in the package recipe - with respect to the system libraries, I think it's probably not appropriate as I'm not sure if there's an easy way to tell if those libraries are shared or static, and we would be investing in functionality to do system discovery, which seems to be in opposition to conan's packaging philosophy.

With respect to upstream packages managed by conan, perhaps a statement similar to the following would be appropriate:

```python
if self.options.use_lapack == "openblas":
    self.options["openblas"].shared = self.options.shared
```

Also note that whilst this is one explanation for _one_ manifestation of `unresolved symbols` linker errors, it does _not_ resolve what is described in the original post.
The CMakeList.txt in armadillo initially sets variables like `ARMA_USE_LAPACK` to `false`. If `ARMA_USE_LAPACK` is `false`, then LAPACK libraries won't be linked.

Are we sure the armadillo CMakeList.txt isn't overriding the definition values specified in the conanfile.py?

EDIT: I noticed that the patched CMakeLists.txt has no `find_package(LAPACK)`. Therefore the `LAPACK_FOUND` variable is never set.

EDIT2: Nvm the LAPACK that is built as a result of `--build`  is only visible to OpenBLAS. Conan has no way of finding the newly built LAPACK.
> The CMakeList.txt in armadillo initially sets variables like `ARMA_USE_LAPACK` to `false`. If `ARMA_USE_LAPACK` is `false`, then LAPACK libraries won't be linked.

Yep this is the default state. It will build without lapack support since we don't currently have a way of supporting lapack in CCI (no fortran compilers are packaged or available in CIs)

> Are we sure the armadillo CMakeList.txt isn't overriding the definition values specified in the conanfile.py?

Yeah there shouldn't be any problems here.

> EDIT: I noticed that the patched CMakeLists.txt has no `find_package(LAPACK)`. Therefore the `LAPACK_FOUND` variable is never set.

when you specify `armadillo:use_lapack=system_lapack` it includes it's own find functionality. You should see the statement `include(ARMA_FindLAPACK)` - this will set `LAPACK_FOUND=YES` if it's located on the system. I have a feeling this only works for linux but I could be wrong.

> EDIT2: Nvm the LAPACK that is built as a result of `--build` is only visible to OpenBLAS. Conan has no way of finding the newly built LAPACK.

When LAPACK is built as part of openblas, linking against `openblas.{so,a}` should include all of the LAPACK symbols. The path to openblas is managed by conan, so it shouldn't struggle to discover these at all.

To clarify, the armadillo package works fine as default, and with all options for lapack without issue when `use_wrapper=False`. The purpose of the wrapper is to allow a user to link against `armadillo.{a,so}` without worrying about linking against each upstream dependency of armadillo as well. To illustrate this, based on the examples provided in the armadillo [FAQ](http://arma.sourceforge.net/faq.html), this is how you would compile a program and link against armadillo _with lapack and blas support_, using the wrapper, i.e. `use_wrapper=True`:

```bash
g++ prog.cpp -o prog -std=c++11 -O2 -larmadillo
```

The equivalent to this with `use_wrapper=False` would be any of the following depending on how you might want to configure the upstream blas and lapack dependencies:

```bash
g++ prog.cpp -o prog -std=c++11 -O2 -I /home/blah/armadillo-7.600.2/include -DARMA_DONT_USE_WRAPPER -lopenblas 
g++ prog.cpp -o prog -std=c++11 -O2 -I /home/blah/armadillo-7.600.2/include -DARMA_DONT_USE_WRAPPER -lblas -llapack 
g++ prog.cpp -o prog -std=c++11 -O2 -I /home/blah/armadillo-7.600.2/include -DARMA_DONT_USE_WRAPPER -lblas -latlas
... 
```
`use_wrapper=False` is the default at the moment, which is fine because conan handles all of the additional linking without much impact on the user experience. This problem only occurs when setting `use_wrapper=True`

Not sure if this is related to this issue, but I've just noticed that `ARMA_USE_WRAPPER` gets defined in `config.hpp.cmake`, which is a template to create `config.hpp` [here](https://gitlab.com/conradsnicta/armadillo-code/-/blob/10.8.x/include/armadillo_bits/config.hpp.cmake#L71) - this should probably be patched to be commented out when `use_wrapper=False`

Resolving patch:
diff --git a/recipes/armadillo/all/conanfile.py b/recipes/armadillo/all/conanfile.py
--- a/recipes/armadillo/all/conanfile.py
+++ b/recipes/armadillo/all/conanfile.py
@@ -174,6 +174,9 @@ def validate(self):
                 "The wrapper requires the use of an external RNG. Set use_extern_rng=True and try again."
             )
 
+        if not self.options.shared and self.options.use_wrapper:
+            raise ConanInvalidConfiguration("Building the armadillo run-time wrapper library requires armadillo/*:shared=True")
+
     def requirements(self):
         # Optional requirements
         # TODO: "atlas/3.10.3" # Pending https://github.com/conan-io/conan-center-index/issues/6757
@@ -186,10 +189,12 @@ def requirements(self):
         # See https://gitlab.com/conradsnicta/armadillo-code/-/issues/227 for more information.
         if self.options.use_hdf5 and Version(self.version) < "12":
             # Use the conan dependency if the system lib isn't being used
-            self.requires("hdf5/1.14.0", transitive_headers=True, transitive_libs=True)
+            # Libraries not required to be propagated transitively when the armadillo run-time wrapper is used
+            self.requires("hdf5/1.14.1", transitive_headers=True, transitive_libs=not self.options.use_wrapper)
 
         if self.options.use_blas == "openblas":
-            self.requires("openblas/0.3.20", transitive_libs=True)
+            # Libraries not required to be propagated transitively when the armadillo run-time wrapper is used
+            self.requires("openblas/0.3.20", transitive_libs=not self.options.use_wrapper)
         if (
             self.options.use_blas == "intel_mkl"
             and self.options.use_lapack == "intel_mkl"


Test patch: