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.

[bug] Using --profile:build makes private dependencies disappear from CONAN_PKG:: targets

See original GitHub issue

Environment Details (include every applicable attribute)

  • Operating System+version: Ubuntu 20.04.2
  • Compiler+version: N/A
  • Conan version: 1.39.0
  • Python version: 3.8.10

Steps to reproduce (Include if Applicable)

Sample project available here In short: Add private requirement to the recipe Build without --profile:build - builds fine. Build with --profile:build - CMake can’t find corresponding CONAN_PKG::target. Make requirement public - builds fine.

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

% conan create .
...
libTest/1.0: Created package revision d12aa99fb1d5a5830c83aa3f8aaf1757
% conan create . -pr default
...
libTest/1.0: Created package revision d12aa99fb1d5a5830c83aa3f8aaf1757
% conan create . -pr default -pr:b default
...
-- Configuring done
CMake Error at CMakeLists.txt:7 (add_library):
  Target "libTest" links to target "CONAN_PKG::gtest" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
...
CMake Generate step failed.  Build files cannot be regenerated correctly.
libTest/1.0:
libTest/1.0: ERROR: Package '54899e12a3af6fe447947590ce807456934636ce' build failed
libTest/1.0: WARN: Build folder /home/paul/.conan/data/libTest/1.0/_/_/build/54899e12a3af6fe447947590ce807456934636ce
ERROR: libTest/1.0: Error in build() method, line 27
        cmake.configure(source_folder="src")
        ConanException: Error 1 while executing cd '/home/paul/.conan/data/libTest/1.0/_/_/build/54899e12a3af6fe447947590ce807456934636ce' && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCONAN_IN_LOCAL_CACHE="ON" -DCONAN_COMPILER="gcc" -DCONAN_COMPILER_VERSION="9" -DCONAN_CXX_FLAGS="-m64" -DCONAN_SHARED_LINKER_FLAGS="-m64" -DCONAN_C_FLAGS="-m64" -DCONAN_LIBCXX="libstdc++" -DBUILD_SHARED_LIBS="OFF" -DCMAKE_INSTALL_PREFIX="/home/paul/.conan/data/libTest/1.0/_/_/package/54899e12a3af6fe447947590ce807456934636ce" -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_SBINDIR="bin" -DCMAKE_INSTALL_LIBEXECDIR="bin" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" -DCMAKE_INSTALL_OLDINCLUDEDIR="include" -DCMAKE_INSTALL_DATAROOTDIR="share" -DCONAN_CMAKE_POSITION_INDEPENDENT_CODE="ON" -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY="ON" -DCONAN_EXPORTED="1" -Wno-dev '/home/paul/.conan/data/libTest/1.0/_/_/build/54899e12a3af6fe447947590ce807456934636ce/src'
% perl -npe "s#private=True#private=False#" -i conanfile.py
% git diff
diff --git a/conanfile.py b/conanfile.py
index c7feff5..7e3b4ae 100644
--- a/conanfile.py
+++ b/conanfile.py
@@ -16,7 +16,7 @@ class LibTestConan(ConanFile):
     exports_sources = "src/*"

     def requirements(self):
-        self.requires("gtest/1.10.0", private=True)
+        self.requires("gtest/1.10.0", private=False)

     def config_options(self):
         if self.settings.os == "Windows":
% conan create . -pr default -pr:b default
...
libTest/1.0: Created package revision a075cba8e91cc194d7ae6ad6effe3882

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
memshardedcommented, May 5, 2022

Yes, deps_cpp_info is also deprecated, and the new generators and build system integrations no longer use deps_cpp_info nor deps_env_info, but they use the new self.dependencies access: https://docs.conan.io/en/latest/reference/conanfile/dependencies.html

When using the 2 profiles, deps_cpp_info will no longer contain information from the build context.

0reactions
Paultergeistcommented, May 5, 2022

Reproducible in 1.48.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[question] Private dependencies won't let CMake generator ...
L has some dependencies to header-only and static libraries (lets' call ... on a private dependency, cmake generator and CONAN_PKG targets:
Read more >
Conan Documentation
Conan is a software package manager which is intended for C and C++ developers. Conan is universal and portable. It works in all...
Read more >
Unable to find the requested Boost libraries in cmake with conan
I'd strongly suggest to try the Conan way (using conan_basic_setup(TARGETS) and linking with target CONAN_PKG::boost ), or maybe trying the new ...
Read more >
Conan Package Manager for C++ in Practice - YouTube
By Jerry Wiltse, presented at Core C++ [online] meetup, March 2021. The slides can be found at http://bit.ly/ConanDemo, more links to Conan ...
Read more >
Advanced Dependencies Model in Conan 2.0 C, C++ ...
Join The ACCU Membership For Exclusive Benefits, Discounts & Reduced Conference Ticket ...
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