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] failed to get spdlog with conan 2.0 #13940

Closed
define-private-public opened this issue Oct 30, 2022 · 5 comments · Fixed by #13939
Closed

[bug] failed to get spdlog with conan 2.0 #13940

define-private-public opened this issue Oct 30, 2022 · 5 comments · Fixed by #13939
Assignees

Comments

@define-private-public
Copy link

New to Conan, decided it would be okay to start using 2.0. I tried to setup a simple conan file to grab spdlog:

[requires]
spdlog/1.10.0

[generators]
CMakeDeps
CMakeToolchain

Using that zlib tutorial as a template. The conan install . --output-folder=build --build=missing command failed, here is the output:

-------- Input profiles --------
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=12
os=Linux

Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=12
os=Linux


-------- Computing dependency graph --------
Graph root
    conanfile.txt: /home/ben/Projects/MyProject/conanfile.txt
Requirements
    spdlog/1.10.0#bd2bfacf219f212f2874313ebd74da23 - Cache
Graph error
    Package 'fmt/8.1.1' not resolved: fmt/8.1.1: Cannot load recipe.
Error loading conanfile at '/home/ben/.conan2/p/3b07118b4d7a04c5/e/conanfile.py': Unable to load conanfile in /home/ben/.conan2/p/3b07118b4d7a04c5/e/conanfile.py
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/ben/.conan2/p/3b07118b4d7a04c5/e/conanfile.py", line 6, in <module>
    from conan.tools.layout import basic_layout, cmake_layout
ImportError: cannot import name 'cmake_layout' from 'conan.tools.layout' (/home/ben/.local/lib/python3.10/site-packages/conan/tools/layout/__init__.py)


-------- Computing necessary packages --------
ERROR: Package 'fmt/8.1.1' not resolved: fmt/8.1.1: Cannot load recipe.
Error loading conanfile at '/home/ben/.conan2/p/3b07118b4d7a04c5/e/conanfile.py': Unable to load conanfile in /home/ben/.conan2/p/3b07118b4d7a04c5/e/conanfile.py
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/ben/.conan2/p/3b07118b4d7a04c5/e/conanfile.py", line 6, in <module>
    from conan.tools.layout import basic_layout, cmake_layout
ImportError: cannot import name 'cmake_layout' from 'conan.tools.layout' (/home/ben/.local/lib/python3.10/site-packages/conan/tools/layout/__init__.py)

Environment Details (include every applicable attribute)

  • Operating System+version: Ubuntu 22.04 LTS
  • Compiler+version: gcc-12
  • Conan version: 2.0.0-beta4
  • Python version: 3.10
  • Installed using pip install conan --pre

I see that cmake_layout is missing:

ben@computer:MyProject$ python3
Python 3.10.6 (main, Aug 10 2022, 11:40:04) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import conan
>>> import conan.tools.layout
>>> from conan.tools.layout import cmake_layout
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'cmake_layout' from 'conan.tools.layout' (/home/ben/.local/lib/python3.10/site-packages/conan/tools/layout/__init__.py)
>>> dir(conan.tools.layout)
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'basic_layout', 'os']
@memsharded
Copy link
Member

Hi @define-private-public

The conan.tools.layout import has already been changed in 1.X to from conan.tools.cmake import cmake_layout (but the previous one has been left to not break 1.X, but it is removed in 2.0).

Furthermore, it is very likely that recipes from ConanCenter are still not Conan 2.0 ready, as the migration is an ongoing effort, but it is still not done to all recipes, and even some recipes that seems to be almost ready, might have small regressions.

So this doesn't seem a Conan issue, in that case it might be closed, please check it and let us know. Thanks.

@define-private-public
Copy link
Author

Okay, thanks for the heads up. I am a little surprised though since spdlog is a very popular package that it would be 2.0 ready. I'll hold off on using 2.0 then in the meantime until the full version is out of beta.

If I have any more issues like this, where can I leave a bug report at?

@memsharded
Copy link
Member

https://github.com/conan-io/conan-center-index is the repo you want to use for everything related to recipes of ConanCenter

I am checking also the 2.0 effort summary issue in #12888, and indeed spdlog seems green there.

But also, if I check the latest spdlog recipe in https://github.com/conan-io/conan-center-index/blob/master/recipes/spdlog/all/conanfile.py, it contains a from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout imports, and not the one you are reporting above, so something might be a bit outdated in your environment, could you please double check this?

@prince-chrismc
Copy link
Contributor

prince-chrismc commented Nov 1, 2022

The issue is not with spdlog but rather it's requirement of fmt

from conan.tools.layout import basic_layout, cmake_layout
unfortunately in the last PR it was added to the wrong line 😱

Should be fixed with #13939 with these changes locally I am able to get started with spdlog by running the command conan install --require spdlog/1.10.0 -of /tmp -s compiler.cppstd=11 -b missing -g CMakeDeps -g CMakeToolchain

If you want to try things locally, you can build my PR using conan create all --version 8.1.1 -s compiler.cppstd=11 the docs for working with CCI are https://github.com/conan-io/conan-center-index/blob/master/docs/developing_recipes_locally.md#developing-recipes-locally

@memsharded
Copy link
Member

Then, definitely not a Conan issue, so transferring this issue to conan-center-index repo. Thanks @prince-chrismc !

@memsharded memsharded transferred this issue from conan-io/conan Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants