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.

deps_cpp_info and cpp_info not consistent between conan install and conan build

See original GitHub issue

I 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:closed
  • Created 7 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
memshardedcommented, Oct 21, 2016

Confirmed, it was a small bug in the parsing of the conanbuildinfo.txt generated from the txt generator, I will soon submit a fix.

0reactions
memshardedcommented, Oct 25, 2016

Fixed, will be released in next conan 0.15.

Read more comments on GitHub >

github_iconTop 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 >

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