-
Notifications
You must be signed in to change notification settings - Fork 993
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] "No such file or directory" when manipulating build_id and package_id #14537
Comments
I am trying to reproduce this, putting it as a test: def test_build_id_error():
c = TestClient()
myconan = textwrap.dedent("""
from conan import ConanFile
from conan.tools.scm import Version
import os
import glob
class BuildIdTestConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
options = {"shared": [True, False]}
default_options = {
"shared": False, }
def build_id(self):
self.info_build.settings.build_type = "Any"
self.info_build.options.shared = "Any"
if self.settings.os == "Windows":
self.info_build.settings.compiler.runtime = "Any"
def build(self):
pass
def package_id(self):
# Since we only get gcc7 and vs2017 binaries, we re-use
# the same ones for future versions.
compilerVer = Version(str(self.info.settings.compiler.version))
if self.info.settings.compiler == "gcc":
if compilerVer >= "7":
self.info.settings.compiler.version = "7+"
elif str(self.info.settings.compiler) == "Visual Studio":
if compilerVer >= "15":
self.info.settings.compiler.version = "15+"
elif str(self.info.settings.compiler) == "msvc":
if compilerVer >= "191":
self.info.settings.compiler.version = "191+"
""")
c.save({"conanfile.py": myconan})
c.run("create . --name=test_build_id --version=1.0.0 "
"-s os=Linux -s compiler=gcc -s compiler.version=8 -s compiler.libcxx=libstdc++11 "
"--settings=build_type=Release --options=test_build_id/*:shared=False") And it is passing successfully. As an automated test, it guarantees that the cache is completely empty. Could you please double check it? A couple of hints:
|
I'm using 2.0.9. Oops, left that off when I copy/pasted. Also try the other permutations of Release/Debug and shared. Some of them work and some don't. |
I am trying adding to the test some more combinations like: c.run("create . --name=test_build_id --version=1.0.0 "
"-s os=Linux -s compiler=gcc -s compiler.version=7 -s compiler.libcxx=libstdc++11 "
"-s build_type=Debug --options=test_build_id/*:shared=False")
c.run("create . --name=test_build_id --version=1.0.0 "
"-s os=Linux -s compiler=gcc -s compiler.version=8 -s compiler.libcxx=libstdc++11 "
"-s build_type=Debug --options=test_build_id/*:shared=False")
c.run("create . --name=test_build_id --version=1.0.0 "
"-s os=Linux -s compiler=gcc -s compiler.version=8 -s compiler.libcxx=libstdc++11 "
"-s build_type=Release --options=test_build_id/*:shared=False")
c.run("create . --name=test_build_id --version=1.0.0 "
"-s os=Linux -s compiler=gcc -s compiler.version=8 -s compiler.libcxx=libstdc++11 "
"-s build_type=Debug --options=test_build_id/*:shared=True")
c.run("create . --name=test_build_id --version=1.0.0 "
"-s os=Linux -s compiler=gcc -s compiler.version=8 -s compiler.libcxx=libstdc++11 "
"-s build_type=Release --options=test_build_id/*:shared=True") Including changing the compiler version, build_type, and shared, but still couldn't make it fail. Not sure what else to try, any further suggestion? |
Did some more digging with a default profile. It has something to do with setting the cppstd (I had it set to gnu17 in my profile) and the order of the arguments (?). This does not make it happen: conan create . --name=test_build_id --version=1.0.0 -s os=Linux -s compiler=gcc -s compiler.version=8 -s compiler.libcxx=libstdc++11 -s build_type=Release --options=test_build_id/*:shared=True -s compiler.cppstd=gnu17 --user="my" --channel="test" But this does: conan create . --name="test_build_id" --version="1.0.0" --user="my" --channel="test" --settings="build_type=Release" --options="test_build_id/*:shared=False" -s os=Linux -s compiler=gcc -s compiler.version=8 -s compiler.libcxx=libstdc++11 -s compiler.cppstd=gnu17 |
It's so strange. I tried to make a test for you, but I can't get it to fail in there. I can consistently do it on the command line :/ |
Are you trying the test in the I don't know where the difference could be otherwise, do you have a command line repro, like the above |
Ok, try this: (fails in both def test_build_id_error():
c = TestClient()
myconan = textwrap.dedent("""
from conan import ConanFile
from conan.tools.scm import Version
import os
import glob
class BuildIdTestConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
options = {"shared": [True, False]}
default_options = {
"shared": False, }
def build_id(self):
self.info_build.settings.build_type = "Any"
self.info_build.options.shared = "Any"
if self.settings.os == "Windows":
self.info_build.settings.compiler.runtime = "Any"
def build(self):
pass
def package_id(self):
# Since we only get gcc7 and vs2017 binaries, we re-use
# the same ones for future versions.
compilerVer = Version(str(self.info.settings.compiler.version))
if self.info.settings.compiler == "gcc":
if compilerVer >= "7":
self.info.settings.compiler.version = "7+"
elif str(self.info.settings.compiler) == "Visual Studio":
if compilerVer >= "15":
self.info.settings.compiler.version = "15+"
elif str(self.info.settings.compiler) == "msvc":
if compilerVer >= "191":
self.info.settings.compiler.version = "191+"
host_profile = textwrap.dedent("""
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=8
os=Linux
""")
build_profile = textwrap.dedent("""
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=8
os=Linux
""")
c.save({"conanfile.py": myconan, "myhostprofile" : host_profile, "mybuildprofile" : build_profile })
c.run("create . "
"--profile:host myhostprofile --profile:build mybuildprofile "
"--name=test_build_id --version=1.0.0 --user=my --channel=test --settings=build_type=Debug --options=test_build_id/*:shared=True")
c.run("create . "
"--profile:host myhostprofile --profile:build mybuildprofile "
"--name=test_build_id --version=1.0.0 --user=my --channel=test --settings=build_type=Debug --options=test_build_id/*:shared=False")
c.run("create . "
"--profile:host myhostprofile --profile:build mybuildprofile "
"--name=test_build_id --version=1.0.0 --user=my --channel=test --settings=build_type=Release --options=test_build_id/*:shared=True")
c.run("create . "
"--profile:host myhostprofile --profile:build mybuildprofile "
"--name=test_build_id --version=1.0.0 --user=my --channel=test --settings=build_type=Release --options=test_build_id/*:shared=False") |
It seems |
After fixing the quotes, I have managed to reproduce! :) |
This was a challenging one! But thanks to your efforts in reproducing, I managed to come up with an understanding of the root causes and a fix in #14555, proposing it for next 2.0.10. Thanks very much again for your feedback and hard work to reproduce it! 🙂 The root cause was the relative order in the DB of the different packages reusing the same |
Excellent! Glad it was helpful and you were able to squash it. |
Environment details
Steps to reproduce
I am packaging some existing binaries from a vendor, so I'm trying to reuse the build_id to avoid running their installer multiple times.
conanfile.py
Command
Note that this only occurs with a clean cache (
${CONAN_HOME}/p/b/
is empty)Also interesting is that a build folder is created in the cache, just not the one it's looking for (it has a different hash)
Logs
The text was updated successfully, but these errors were encountered: