Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] PkgConfigDeps fails in generate() (Conan 1) #15311

Closed
db4 opened this issue Dec 20, 2023 · 3 comments
Closed

[bug] PkgConfigDeps fails in generate() (Conan 1) #15311

db4 opened this issue Dec 20, 2023 · 3 comments
Assignees
Milestone

Comments

@db4
Copy link
Contributor

db4 commented Dec 20, 2023

Environment details

  • Conan version: 1.62.0

Steps to reproduce

Unpack the attached archive and run build.bat. BTW, Conan 2 doesn't suffer from that.
test_case.zip

Logs


U:\Work\conan_test\override>conan create pkg2.py pkg2/1.0@  --build missing 
Conan 1 is on a deprecation path, please consider migrating to Conan 2
Exporting package recipe
pkg2/1.0: The stored package has not changed
pkg2/1.0: Using the exported files summary hash as the recipe revision: e303c7731dd0a637598b9e4f19459095 
pkg2/1.0: Exported revision: e303c7731dd0a637598b9e4f19459095
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=Visual Studio
compiler.runtime=MD
compiler.version=15
os=Windows
os_build=Windows
[options]
[build_requires]
[env]

Installing package: pkg2/1.0
Requirements
    pkg2/1.0 from local cache - Cache
    zlib/1.2.13 from 'conancenter' - Cache
Packages
    pkg2/1.0:606fdb601e335c2001bdf31d478826b644747077 - Cache
    zlib/1.2.13:6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7 - Cache

Installing (downloading, building) binaries...
zlib/1.2.13: Already installed!
pkg2/1.0: Already installed!

U:\Work\conan_test\override>conan create pkg2.py pkg2/1.0+private@ 
Conan 1 is on a deprecation path, please consider migrating to Conan 2
Exporting package recipe
pkg2/1.0+private: The stored package has not changed
pkg2/1.0+private: Using the exported files summary hash as the recipe revision: e303c7731dd0a637598b9e4f19459095 
pkg2/1.0+private: Exported revision: e303c7731dd0a637598b9e4f19459095
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=Visual Studio
compiler.runtime=MD
compiler.version=15
os=Windows
os_build=Windows
[options]
[build_requires]
[env]

pkg2/1.0+private: Forced build from source
Installing package: pkg2/1.0+private
Requirements
    pkg2/1.0+private from local cache - Cache
    zlib/1.2.13 from 'conancenter' - Cache
Packages
    pkg2/1.0+private:606fdb601e335c2001bdf31d478826b644747077 - Build
    zlib/1.2.13:6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7 - Cache

Installing (downloading, building) binaries...
zlib/1.2.13: Already installed!
pkg2/1.0+private: Applying build-requirement: zlib/1.2.13
pkg2/1.0+private: Copying sources to build folder
pkg2/1.0+private: Building your package in D:\.conan\data\pkg2\1.0+private\_\_\build\606fdb601e335c2001bdf31d478826b644747077
pkg2/1.0+private: Generator txt created conanbuildinfo.txt
pkg2/1.0+private: Aggregating env generators
pkg2/1.0+private: Calling build()
pkg2/1.0+private: WARN: This conanfile has no build step
pkg2/1.0+private: Package '606fdb601e335c2001bdf31d478826b644747077' built
pkg2/1.0+private: Build folder D:\.conan\data\pkg2\1.0+private\_\_\build\606fdb601e335c2001bdf31d478826b644747077
pkg2/1.0+private: Generated conaninfo.txt
pkg2/1.0+private: Generated conanbuildinfo.txt
pkg2/1.0+private: Generating the package
pkg2/1.0+private: Package folder D:\.conan\data\pkg2\1.0+private\_\_\package\606fdb601e335c2001bdf31d478826b644747077
pkg2/1.0+private: Calling package()
pkg2/1.0+private: WARN: This conanfile has no package step
pkg2/1.0+private package(): WARN: No files in this package!
pkg2/1.0+private: Package '606fdb601e335c2001bdf31d478826b644747077' created
pkg2/1.0+private: Created package revision 3e7d88b7fb07aa9c5711d05fd56e7620

U:\Work\conan_test\override>conan create pkg1.py pkg1/1.0@ 
Conan 1 is on a deprecation path, please consider migrating to Conan 2
Exporting package recipe
pkg1/1.0: The stored package has not changed
pkg1/1.0: Using the exported files summary hash as the recipe revision: dd32f861b50f614ceccc73803976f9b7 
pkg1/1.0: Exported revision: dd32f861b50f614ceccc73803976f9b7
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=Visual Studio
compiler.runtime=MD
compiler.version=15
os=Windows
os_build=Windows
[options]
[build_requires]
[env]

pkg1/1.0: Forced build from source
Installing package: pkg1/1.0
Requirements
    pkg1/1.0 from local cache - Cache
    pkg2/1.0 from local cache - Cache
    zlib/1.2.13 from 'conancenter' - Cache
Packages
    pkg1/1.0:b6717885bde1a6f867ba42aad86b8ee46fdde182 - Build
    pkg2/1.0:606fdb601e335c2001bdf31d478826b644747077 - Cache
    zlib/1.2.13:6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7 - Cache

Installing (downloading, building) binaries...
zlib/1.2.13: Already installed!
pkg2/1.0: Already installed!
pkg1/1.0: Copying sources to build folder
pkg1/1.0: Building your package in D:\.conan\data\pkg1\1.0\_\_\build\b6717885bde1a6f867ba42aad86b8ee46fdde182
pkg1/1.0: Generator txt created conanbuildinfo.txt
pkg1/1.0: Aggregating env generators
pkg1/1.0: Calling build()
pkg1/1.0: WARN: This conanfile has no build step
pkg1/1.0: Package 'b6717885bde1a6f867ba42aad86b8ee46fdde182' built
pkg1/1.0: Build folder D:\.conan\data\pkg1\1.0\_\_\build\b6717885bde1a6f867ba42aad86b8ee46fdde182
pkg1/1.0: Generated conaninfo.txt
pkg1/1.0: Generated conanbuildinfo.txt
pkg1/1.0: Generating the package
pkg1/1.0: Package folder D:\.conan\data\pkg1\1.0\_\_\package\b6717885bde1a6f867ba42aad86b8ee46fdde182
pkg1/1.0: Calling package()
pkg1/1.0: WARN: This conanfile has no package step
pkg1/1.0 package(): WARN: No files in this package!
pkg1/1.0: Package 'b6717885bde1a6f867ba42aad86b8ee46fdde182' created
pkg1/1.0: Created package revision eb0dee989f9c7f1fe6bd6ae0dcad8724

U:\Work\conan_test\override>conan install . -if build --build missing 
Conan 1 is on a deprecation path, please consider migrating to Conan 2
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=Visual Studio
compiler.runtime=MD
compiler.version=15
os=Windows
os_build=Windows
[options]
[build_requires]
[env]

WARN: pkg1/1.0: requirement pkg2/1.0 overridden by your conanfile to pkg2/1.0+private 
conanfile.py: Installing package
Requirements
    pkg1/1.0 from local cache - Cache
    pkg2/1.0+private from local cache - Cache
    zlib/1.2.13 from 'conancenter' - Cache
Packages
    pkg1/1.0:b6717885bde1a6f867ba42aad86b8ee46fdde182 - Cache
    pkg2/1.0+private:606fdb601e335c2001bdf31d478826b644747077 - Cache
    zlib/1.2.13:6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7 - Skip

Installing (downloading, building) binaries...
pkg2/1.0+private: Already installed!
pkg1/1.0: Already installed!
conanfile.py: Generator txt created conanbuildinfo.txt
conanfile.py: Calling generate()
ERROR: conanfile.py: Error in generate() method, line 14
	pc.generate()
	AttributeError: 'NoneType' object has no attribute 'includedirs'
@memsharded
Copy link
Member

Hi @db4

Thanks for your report. It seems the new PkgConfigDeps is not playing well with the legacy "private" requirement attribute, that has been replaced by visible=False in Conan 2.0, and by not processing it it is producing some errors.

I don't know how difficult this could be to fix, but lets give it a try.

@db4
Copy link
Contributor Author

db4 commented Dec 21, 2023

@memsharded
Many thanks for looking into this. Unfortunately due to some legacy recipes, I cannot immediately switch to Conan 2.0 (although I'm moving this way). I've done some debugging and can say that the problem occurs when the graph contains a "skipped" node:

zlib/1.2.13:6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7 - Skip

It's not possible to access cpp_info attribute for such a node (AttributeError("'NoneType' object has no attribute 'includedirs'") will be raised), so maybe this isn't only specific to PkgConfigDeps? Maybe "skipped" dependencies should not be included in dependencies.direct_host values? (currently, they are).
AttributeError exception is raised here:

pkg_name = dep.cpp_info.get_property("pkg_config_name") or _get_package_reference_name(dep)

@franramirez688
Copy link
Contributor

Hi @db4

The issue was solved by #15320

It'll be released in the next Conan 1.63 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants