The minimal code which displays the problem, along with more details and reproduction steps is uploaded here.
Basically, the issue is that if you have a chain of dependencies which are by default static, except the top-level one which you want to build as shared, you have to call shared_library_package_id() in its package_id method so that all package IDs are generated properly. However, if any of the upstream dependencies are not available in cache and need to be built locally, package creation fails with an empty error message.
Hi! Thanks for submitting a reproducible example. I've removed some bits that are not needed to reproduce the bug. I'll add it as a test to reproduce (and fix) it in the codebase.
package1.py
from conans import ConanFile
class Package1Conan(ConanFile):
name = "package-1"
settings = "os", "arch", "compiler", "build_type"
options = {"shared": [True, False]}
default_options = {"shared": False}
package2.py
from conans import ConanFile
class Package2Conan(ConanFile):
name = "package-2"
settings = "os", "arch", "compiler", "build_type"
options = {"shared": [True, False]}
default_options = {"shared": False}
requires = "package-1/1.0@error/test"
package3.py
from conans import ConanFile, CMake, tools
class Package3Conan(ConanFile):
name = "package-3"
settings = "os", "arch", "compiler", "build_type"
options = {"shared": [True, False]}
default_options = {"shared": False}
requires = "package-2/1.0@error/test"
def package_id(self):
self.info.shared_library_package_id()
Prepare the cache:
conan create package1.py package-1/1.0@error/test
conan create package2.py package-2/1.0@error/test
conan create ./package-3/ 1.0@error/test -o package-3:shared=True --build=package-1
package-1/1.0@error/test: Forced build from source
Installing package: package-3/1.0@error/test
Requirements
package-1/1.0@error/test from local cache - Cache
package-2/1.0@error/test from local cache - Cache
package-3/1.0@error/test from local cache - Cache
Packages
package-1/1.0@error/test:103f6067a947f366ef91fc1b7da351c588d1827f - Build
package-2/1.0@error/test:36138b371baf7b74ebc20a3bb39e86331f10e311 - Cache
package-3/1.0@error/test:Package_ID_unknown - Unknown
...
package-3/1.0@error/test: Unknown binary for package-3/1.0@error/test, computing updated ID
package-3/1.0@error/test: Updated ID: Package_ID_unknown
Traceback (most recent call last):
File "/Users/jgsogo/dev/conan/conan/conans/client/command.py", line 2051, in run
method(args[0][1:])
File "/Users/jgsogo/dev/conan/conan/conans/client/command.py", line 371, in create
info = self._conan.create(args.path, name, version, user, channel,
File "/Users/jgsogo/dev/conan/conan/conans/client/conan_api.py", line 94, in wrapper
return f(api, *args, **kwargs)
File "/Users/jgsogo/dev/conan/conan/conans/client/conan_api.py", line 374, in create
create(self.app, ref, graph_info, remotes, update, build_modes,
File "/Users/jgsogo/dev/conan/conan/conans/client/cmd/create.py", line 45, in create
deps_install(app=app,
File "/Users/jgsogo/dev/conan/conan/conans/client/manager.py", line 76, in deps_install
installer.install(deps_graph, remotes, build_modes, update, keep_build=keep_build,
File "/Users/jgsogo/dev/conan/conan/conans/client/installer.py", line 295, in install
self._build(nodes_by_level, keep_build, root_node, graph_info, remotes, build_mode, update)
File "/Users/jgsogo/dev/conan/conan/conans/client/installer.py", line 421, in _build
self._binaries_analyzer.reevaluate_node(node, remotes, build_mode, update)
File "/Users/jgsogo/dev/conan/conan/conans/client/graph/graph_binaries.py", line 360, in reevaluate_node
assert node.package_id != PACKAGE_ID_UNKNOWN
This was fixed in https://github.com/conan-io/conan/pull/7353, will be released next 1.28. Thanks for reporting @jbatnozic !
Most helpful comment
Hi! Thanks for submitting a reproducible example. I've removed some bits that are not needed to reproduce the bug. I'll add it as a test to reproduce (and fix) it in the codebase.
package1.py
package2.py
package3.py
Prepare the cache:
Failure 1: