Skip to content

[bug] LIBS variable not correct for linking static libraries when building with autoconf tools #11703

@jngrb

Description

@jngrb

Environment Details (include every applicable attribute)

  • Operating System+version: Ubuntu 20.04
  • Compiler+version: gcc-9
  • Conan version: conan 1.47.0
  • Python version: Python 3.8.10

Steps to reproduce (Include if Applicable)

  1. create a dummy conanfile.py for wrapping a static library, e.g. to wrap /usr/lib/x86_64-linux-gnu/libcrypto.a, use this package_info method:
  def package_info(self):
    self.cpp_info.libdirs = ["/usr/lib/x86_64-linux-gnu"]
    self.cpp_info.libs = ["libcrypto.a"]
  1. have a second recipe that consumes the dummy recipe and builds a executable or library with autotools. Excerpts from such a conanfile.py:
from conans import ConanFile, AutoToolsBuildEnvironment
[...]
  def build(self)
    [...]
    autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
    configure_args = [...]
    autotools.configure(vars=self._autotools_vars, args=configure_args)
    [...]

Actual behaviour

autotools / configure is called with environment variable

LIBS=-llibcrypto.a

Expected behaviour

autotools / configure is called with environment variable

LIBS=-l:libcrypto.a

References:

-l namespec: [...] If namespec is of the form :filename, ld will search the library path for a file called filename, otherwise it will search the library path for a file called libnamespec.a [or _libnamespec.so].

Logs (Executed commands with output) (Include/Attach if Applicable)

I found the relevant python methods to be these:

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions