deps_cpp_info and cpp_info not consistent between conan install and conan build
See original GitHub issueI have two packages:
from conans import ConanFile
class package1(ConanFile):
name = 'package1'
version = '0.1.0'
def build(self):
self.output.info("package1 rootpath: " + str(self.cpp_info.rootpath))
self.output.info("package1 includepath: " + str(self.cpp_info.includedirs))
and
from conans import ConanFile
class package2(ConanFile):
name = 'package2'
version = '0.1.0'
requires = 'package1/0.1.0@abusz/testing'
def build(self):
self.output.info("package1 rootpath: " + str(self.deps_cpp_info['package1'].rootpath))
self.output.info("package1 includedirs: " + str(self.deps_cpp_info['package1'].includedirs))
self.output.info("package2 rootpath: " + str(self.cpp_info.rootpath))
self.output.info("package2 includedirs: " + str(self.cpp_info.includedirs))
When I export these two recipes and do “conan install package2/0.1.0@abusz/testing --build” everything works:
package1/0.1.0@abusz/testing: package1 rootpath: /Users/abusz/.conan/data/package1/0.1.0/abusz/testing/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
package1/0.1.0@abusz/testing: package1 includepath: ['include']
...
package2/0.1.0@abusz/testing: package1 rootpath: /Users/abusz/.conan/data/package1/0.1.0/abusz/testing/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
package2/0.1.0@abusz/testing: package1 includedirs: ['include']
package2/0.1.0@abusz/testing: package2 rootpath: /Users/abusz/.conan/data/package2/0.1.0/abusz/testing/package/ece115d6e9f37d18b18b2ba1b5fe503efae713e4
package2/0.1.0@abusz/testing: package2 includedirs: ['include']
However when I try to use “conan install /path/to/package2 --build” to get dependencies and then “conan build /path/to/package2” to build it I get this:
Project: package1 rootpath:
Project: package1 includedirs: [u'/Users/abusz/.conan/data/package1/0.1.0/abusz/testing/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include']
ERROR: Unable to build it successfully
File "/Users/abusz/tmp3/package2/conanfile.py", line 12, in build
self.output.info("package2 rootpath: " + str(self.cpp_info.rootpath))
AttributeError: 'NoneType' object has no attribute 'rootpath'
I see two issues here:
- rootpath for dependencies is not populated when using conan build
- cpp_info variables (rootpath, includedirs etc.) are not available at all when using conan build
Is it possible to access that stuff in conan build? As a package maintainer I would find this “build” option very useful as I don’t need to export package all the time when developing recipe.
Tested on conan 0.14.1.
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Attributes — conan 1.53.0 documentation
For package recipes working in the user space, with local methods like conan install . and conan build ., there is no current...
Read more >conan install — conan 1.44.1 documentation
Installs the requirements specified in a recipe (conanfile.py or ... --build=missing Build packages from source whose binary package is not found.
Read more >Methods — conan 1.53.0 documentation
This method copies files from build/source folder to the package folder depending on two situations: Build folder and source folder are the same:...
Read more >Installing dependencies — conan 1.53.0 documentation
If you inspect the conanbuildinfo.cmake file that was created when running ... compile from the build folder (change the CMake generator if not...
Read more >conan install — conan 1.26.1 documentation
Installs the requirements specified in a recipe (conanfile.py or ... --build=missing Build packages from source whose binary package is not found.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Confirmed, it was a small bug in the parsing of the
conanbuildinfo.txt
generated from thetxt
generator, I will soon submit a fix.Fixed, will be released in next conan 0.15.