conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
7.95k stars 952 forks source link

[question] `conan create` complains about `settings.compiler.cppstd` #16574

Closed RobinQu closed 1 day ago

RobinQu commented 2 days ago

What is your question?

What happened

I am trying to create recipe for my own library. I forked conan-center-index and create the reciepe folder using your predefined template.

But as I tried to test it using following command, it complained about settings.compiler.cppstd.

% conan create . --version 0.1.5  -o shared=True -pr:b=default -pr:h=default --build=missing

ERROR: instinct-cpp/0.1.5: Error in validate() method, line 117
        if self.settings.compiler.cppstd:
        ConanException: 'settings.compiler.cppstd' doesn't exist for 'apple-clang'
'settings.compiler' possible configurations are ['version']

The recipe causing the promblem is here.

Is this a bug for conan with apple-clang or problem caused by my recipe?

Additional info

% conan -v
Conan version 2.4.1
% cat ~/.conan2/profiles/default 
[settings]
arch=armv8
build_type=Debug
compiler=apple-clang
compiler.cppstd=20
compiler.libcxx=libc++
compiler.version=15
os=Macos

Other solutions I tried

The problem persisted after actions above were taken.

Have you read the CONTRIBUTING guide?

AbrilRBS commented 2 days ago

Hi @RobinQu thanks a lot for taking the time to report the issue.

The recipe does not seem to be the issue here, it's treating the cppstd value as usual, and does not seem to be a bug in the client for apple-clang either.

Could you please share:

Thanks!

RobinQu commented 2 days ago

Sure. I will attach those files below.

Hi @RobinQu thanks a lot for taking the time to report the issue.

The recipe does not seem to be the issue here, it's treating the cppstd value as usual, and does not seem to be a bug in the client for apple-clang either.

Could you please share:

  • The full conan create output, feel free to remove anything sensitive/confidential etc

conan_create.log

  • The output of conan config home
% conan config home
WARN: Downgrading cache from Conan 2.4.1 to 2.1.0
WARN: Applying downgrade migration 2.4_1-migrate.py
Migration: Successfully updated cppstd_compat.py
/Users/robinqu/.conan2
  • The contents of your settings.yml. Additionaly, check if in that same folder you have a settings_user.yml file which might be modifying your settings, and if so, its contents would also be useful

settings.yml.txt

And no settings_user.yml is found in that folder.

Thanks!

AbrilRBS commented 2 days ago

Thanks for the logs. I don't see anything wrong with the logs per-se, but:

WARN: Downgrading cache from Conan 2.4.1 to 2.1.0 WARN: Applying downgrade migration 2.4_1-migrate.py

This is a bit suprising - you reported 2.4.1 and in fact, the create command seems to run on a new Conan version, but as per this output, the conan config home command was ran from Conan 2.1 🤔

RobinQu commented 2 days ago

Thanks for the logs. I don't see anything wrong with the logs per-se, but:

WARN: Downgrading cache from Conan 2.4.1 to 2.1.0 WARN: Applying downgrade migration 2.4_1-migrate.py

This is a bit suprising - you reported 2.4.1 and in fact, the create command seems to run on a new Conan version, but as per this output, the conan config home command was ran from Conan 2.1 🤔

Should I delete the cache folder and retry conan create ?

AbrilRBS commented 1 day ago

Hi @RobinQu - I had to ask @memsharded for a second look as I was not finding the issue, and lo and behold, your problematic line is here: https://github.com/RobinQu/conan-center-index/blob/feature/add-instinct-cpp/recipes/instinct-cpp/all/conanfile.py#L70

You're saying that this is a C library so there is no need for cppstd, but then in the validate you still check for it. Seeing the name of the library, I'd wager that this is in fact not a C-only library, and so those two lines should be deleted.

The recipe templates contain comments that should be addressed, some other examples are lines like https://github.com/RobinQu/conan-center-index/blob/feature/add-instinct-cpp/recipes/instinct-cpp/all/conanfile.py#L134 and https://github.com/RobinQu/conan-center-index/blob/feature/add-instinct-cpp/recipes/instinct-cpp/all/conanfile.py#L124 (but if your project does truly not support that, feel free to keep it!)

Let me know if this helps :)

RobinQu commented 1 day ago

Hi @RobinQu - I had to ask @memsharded for a second look as I was not finding the issue, and lo and behold, your problematic line is here: https://github.com/RobinQu/conan-center-index/blob/feature/add-instinct-cpp/recipes/instinct-cpp/all/conanfile.py#L70

You're saying that this is a C library so there is no need for cppstd, but then in the validate you still check for it. Seeing the name of the library, I'd wager that this is in fact not a C-only library, and so those two lines should be deleted.

The recipe templates contain comments that should be addressed, some other examples are lines like https://github.com/RobinQu/conan-center-index/blob/feature/add-instinct-cpp/recipes/instinct-cpp/all/conanfile.py#L134 and https://github.com/RobinQu/conan-center-index/blob/feature/add-instinct-cpp/recipes/instinct-cpp/all/conanfile.py#L124 (but if your project does truly not support that, feel free to keep it!)

Let me know if this helps :)

Wow, it works after removing those two lines. I didn't notice the comment.

AbrilRBS commented 1 day ago

Great to hear! Sorry I didn't spot it sooner. Closing this as solved

Once you're ready to open a pr in CCI we'll make sure to review it and help you with recipe issues :)