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.

Did version_range resolving get error answer?

See original GitHub issue

Hi all, feel lucky to use Conan(version 1.38.0) such a good tool to manage my C++ library and APP. But I got some problem these day.

I am building an APP, and there are three Conan packages used for this APP, called lib_C, lib_E, lib_D. lib_C is depend on the lib_E and lib_D, and the conanfile.py of lib_C is below, where I use version_range to manage the library:

from conans import ConanFile, tools
import os


class PackageConan(ConanFile):
  settings = ()

  revision_mode = "scm"
  scm = {
        "type": "git",
        "url": "xxx/lib_C",
        "revision": "auto"
  }
  url = 'xxx/lib_C'

  license = 'aaa'
  description = 'bbb'
  settings = 'os', 'compiler', 'build_type', 'arch'
  generators = 'cmake'

  requires = ("lib_D/[0.0.0> <0.1.0]@lzh/stable",
              "lib_E/[0.1.0>= <0.2.0]@lzh/stable")

  build_requires = ()

  def imports(self):
    pass

  def package(self):
    source_dir = os.environ.get('PACKAGE_SOURCE_DIR')
    build_dir = os.environ.get('PACKAGE_BUILD_DIR')
    install_dir = os.environ.get('PACKAGE_INSTALL_DIR')
    self.copy('*',
              dst='include',
              src='{}/include'.format(install_dir),
              symlinks=True)
    self.copy('*', dst='lib', src='{}/lib'.format(install_dir), symlinks=True)

  def package_id(self):
    self.info.requires.minor_mode()

  def package_info(self):
    self.cpp_info.libs = tools.collect_libs(self)

And there are two Conan remotes in my system, called them conan-stable, conan-dev (the priority of conan-stable is higher than conan-dev). And the available version of lib_E in conan-stable is such below: image

however, in conan-dev is: image

Based on the environment, I am creating the lockfile of lib_C, and expect to get the 0.1.0 version of lib_E in the lockfile,but when I run the command:

conan lock create conanfile.py --lockfile-out=dep_base.lock --update --base

the output of this command is below: image

As you can see from this picture, Conan only try to solve version from conan-stable, but not conan-dev, thus got a wrong version of lib_E which should be 0.1.0. And, in my opinion, it should search from conan-dev, since there is not any version in conan-stable satisfy the range [0.1.0>= <0.2.0]. But if I change the require from “lib_E/[0.1.0>= <0.2.0]@lzh/stable” to “lib_E/0.1.0@lzh/stable”, it works well.

Is there some mistake in my project or Conan?

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
memshardedcommented, Jul 28, 2022

Hi @liao-zhihan

Are you sure your requires are correct? I see [0.0.0> <0.1.0]@lzh/stable", but that looks weird, probably should be [>0.0.0 <0.1.0]@lzh/stable"

0reactions
liao-zhihancommented, Jul 28, 2022

@memsharded I got the answer in https://github.com/conan-io/conan/issues/3113 this seems a problem in Conan 1.x, I will try other method. thx!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error when resolving version ranges for dependencies inside ...
As part of our build process, I'd like to run mvn versions:resolve-ranges to resolve the version range [2.17.1,2.18) to the 2.17.1 (latest ...
Read more >
Unable to resolve maven dependency locally for version range
This builds a 2.0-SNAPSHOT jar for this client pom in my local m2 repository. Try to build web-server which is dependent on the...
Read more >
NuGet Package Version Reference - Microsoft Learn
By design, floating versions do not resolve prerelease versions unless opted ... Without a version or version range, NuGet 2.8.x and earlier ...
Read more >
Error handling with promises
If an exception happens, it gets caught and treated as a rejection. For instance, this code: new Promise((resolve, reject) => { throw new...
Read more >
CloudBees CD/RO API error messages
To resolve this error, find the failed operation in the batch API, fix it, ... sent an API request in a protocol version...
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