Repository: conan-io/conan-center-index

Issue:
[package] qt/5.15.2: test fails trying to link to .so while built statically
<!-- 
  Please don't forget to update the issue title.
  Include all applicable information to help us reproduce your problem.
-->

### Package and Environment Details (include every applicable attribute)
  * Package Name/Version: **qt/5.15.2**
  * Operating System+version: **Linuxmint 20.1 ulyssa**
  * Compiler+version: **GCC 9.3**
  * Conan version: **conan 1.37.0**
  * Python version: **Python 3.8.5**


### 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++11
build_type=Release
[options]
[build_requires]
[env]
```


### Steps to reproduce (Include if Applicable)
```
conan install qt/5.15.2@ -o qt:qtmultimedia=True -o qt:qtsvg=True --build=qt --build=missing
```


### Logs (Include/Attach if Applicable)
<details><summary>Click to expand log</summary>

```
ERROR: 
        ConanException: qt/5.15.2 package_info(): Package require 'openal' not used in components requires


```

</details>



Discussion:
This is odd, since this seems like it should be a simple fix, adding `OpenAL::OpenAL` on the following line.

https://github.com/conan-io/conan-center-index/blob/9f32bf3f48411fd91680ca0190317b3a7126f8b1/recipes/qt/5.x.x/conanfile.py#L971

However the issue persists even after specifying openal as a component requires for qtmultimedia.
the actual fix should be to add `openal::openal` on this line, the recipe names are all lower case on CCI.
> the actual fix should be to add `openal::openal` on this line, the recipe names are all lower case on CCI.

I had tried this and it didn't seem to work, after wiping my cache though it did work.

Resolving patch:
diff --git a/recipes/qt/5.x.x/conanfile.py b/recipes/qt/5.x.x/conanfile.py
--- a/recipes/qt/5.x.x/conanfile.py
+++ b/recipes/qt/5.x.x/conanfile.py
@@ -567,6 +567,8 @@ def build(self):
         for package in self.deps_cpp_info.deps:
             args += ["-I \"%s\"" % s for s in self.deps_cpp_info[package].include_paths]
             args += ["-D %s" % s for s in self.deps_cpp_info[package].defines]
+        lib_arg = "/LIBPATH:" if self.settings.compiler == "Visual Studio" else "-L"
+        args.append("QMAKE_LFLAGS+=\"%s\"" % " ".join("%s%s" % (lib_arg, l) for package in self.deps_cpp_info.deps for l in self.deps_cpp_info[package].lib_paths))
 
         if "libmysqlclient" in self.deps_cpp_info.deps:
             args.append("-mysql_config \"%s\"" % os.path.join(self.deps_cpp_info["libmysqlclient"].rootpath, "bin", "mysql_config"))
@@ -641,8 +643,6 @@ def _getenvpath(var):
                 if self.settings.os == "Windows":
                     build_env["PATH"] = [os.path.join(self.source_folder, "qt5", "gnuwin32", "bin")]
 
-                build_env["LIB" if self.settings.compiler == "Visual Studio" else "LIBRARY_PATH"] = \
-                    [l for package in self.deps_cpp_info.deps for l in self.deps_cpp_info[package].lib_paths]
                 with tools.environment_append(build_env):
 
                     if tools.os_info.is_macos:


Test patch:
diff --git a/recipes/qt/5.x.x/test_package/test_package.pro b/recipes/qt/5.x.x/test_package/test_package.pro
--- a/recipes/qt/5.x.x/test_package/test_package.pro
+++ b/recipes/qt/5.x.x/test_package/test_package.pro
@@ -10,3 +10,4 @@ CONFIG += console
 
 CONFIG += conan_basic_setup
 include($$OUT_PWD/../conanbuildinfo.pri)
+LIBS -= $$CONAN_LIBS_QT