question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Conan 1.19.0 can break static library compilation when using visual_studio generator

See original GitHub issue

Hi there,

Conan 1.19.0 has introduced changes to the visual_studio generator via this PR: https://github.com/conan-io/conan/pull/5564

However the decision to add the following code to the generated props file can break compilation of static libraries that reference other static libraries, but are not expecting to be linked against them (in our case this is done later when being consumed by a shared library or executable).

<Lib>
  <AdditionalLibraryDirectories>$(ConanLibraryDirectories)%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
  <AdditionalDependencies>{libs}%(AdditionalDependencies)</AdditionalDependencies>
</Lib>

Our organisation has been using Conan since the 0.28.0 release and now have over 400 private Conan packages, several of which are static libraries that reference other internal static libraries. We do not wish for our static libraries to be combined together by default. As it stands, the visual_studio generator is broken for us (multiple projects fail to build) and would require us to explicitly update all our affected projects to reset the the <Lib> configuration at the project level - not exactly what I would call a backwards-compatible change.

I do understand the core requirement of the PR in question. Looking into it, wouldn’t an alternative (backwards-compatible) solution have been to, instead of adding the <Lib> section to the generated props file, add another custom property that end users could then use in their project files if they desire that static libraries be combined?

<PropertyGroup Label="ConanVariables">
  ...
  <ConanLibraries>{libs}</ConanLibraries>
</PropertyGroup>

I think this is further backed up by the comment in the PR that questioned whether it was safe to add the <AdditionalLibraryDirectories> section in the first place.

https://github.com/conan-io/conan/pull/5564#issuecomment-521548338

Thanks,

Sam

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
santhoniszcommented, Oct 1, 2019

Thanks very much for the rapid response on this guys, it is much appreciated!

1reaction
kobalicekcommented, Oct 1, 2019

Yeah, I agree. The original pull request btw didn’t add <AdditionalDependencies> in <Lib>, it was added based on additional suggestion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changelog — conan 1.19.3 documentation
Conan 1.19 shouldn't break any existing 1.0 recipe or command line invocation. ... Bugfix: Fixed error while using Visual Studio 2019 with Ninja...
Read more >
How to prevent unnecessary recompilation of C++ static ...
To try to stop this, I recreated the solution file for one of the apps, copied it to the 2nd app and manually...
Read more >
conan Changelog - pyup.io
Bugfix: Update cmake_layout build and generators folders to honor os path ... using `Ninja` generator and `msvc` compiler so the IDE (Visual Studio)...
Read more >
Linking static libraries to other static libraries - Stack Overflow
Static libraries do not link with other static libraries. The only way to do this is to use your librarian/archiver tool (for example...
Read more >
homebrew-core - Homebrew Formulae
a2ps 4.14 Any‑to‑PostScript filter aacgain 1.8 AAC‑supporting version of mp3gain aalib 1.4rc5 Portable ASCII art graphics library aamath 0.3 Renders mathematical expressions as ASCII art
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found