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] export-pkg tries to install binaries #13320

Closed
RazielXYZ opened this issue Mar 3, 2023 · 6 comments · Fixed by #13324
Closed

[bug] export-pkg tries to install binaries #13320

RazielXYZ opened this issue Mar 3, 2023 · 6 comments · Fixed by #13324

Comments

@RazielXYZ
Copy link

Environment details

  • Operating System+version: Windows 10 22H2 19045.2604
  • Compiler+version: msvc193 17.5.1 cl 19.35.32215
  • Conan version: 2.0.1 (also 2.0)
  • Python version: 3.11.2

Steps to reproduce

Attempting to conan export-pkg a header-only lib that lists non-header-only libs as requirements causes conan 2.0 to attempt to install binaries of the requirements for the given profile. In conan 1.0 no binaries would be installed. This means that packaging header-only libs that declare a requirement of a non-header only lib require not just a valid profile, but one that binaries of those requirements are available for.
Furthermore, if the binaries are not available in the local cache, export-pkg will still fail with a Package not resolved: No remote defined error, even when a remote with the package and binaries is actually in the conan remotes on that machine. Currently the only workaround I've found is to manually conan install the requirements prior to export-pkg.
@prince-chrismc also mentioned that I should tag him, so, there we go!

Logs

PS C:\Programming\ADO-Dep\cppzmq> conan export-pkg . --user=cppzmq --channel=stable

======== Exporting recipe to the cache ========
cppzmq/4.9.0@cppzmq/stable: Exporting package recipe: C:\Programming\ADO-Dep\cppzmq\conanfile.py
cppzmq/4.9.0@cppzmq/stable: Copied 1 '.py' file: conanfile.py
cppzmq/4.9.0@cppzmq/stable: Exported to cache folder: C:\Users\Raziel\.conan2\p\cppzm58f7e97896a3e\e
cppzmq/4.9.0@cppzmq/stable: Exported: cppzmq/4.9.0@cppzmq/stable#c75458c81301ab642058b47cd98d4170 (2023-03-03 17:41:26 UTC)

======== Computing dependency graph ========
Graph root
    conanfile.py (cppzmq/4.9.0@cppzmq/stable): C:\Programming\ADO-Dep\cppzmq\conanfile.py
Requirements
    libsodium/1.0.18@libsodium/stable#198ad6829e8d6ac0ece1d5d6e278f3e7 - Cache
    zeromq/4.3.4@zeromq/stable#d07c1d563fe381db63d2550a1c132d1e - Cache

======== Computing necessary packages ========
libsodium/1.0.18@libsodium/stable: Compatible package ID 7bfde258ff4f62f75668d0896dbddedaa7480a0f equal to the default package ID
zeromq/4.3.4@zeromq/stable: Compatible package ID 54482f6c618abbb32948ae566f7a64644e82dab4 equal to the default package ID

======== Installing packages ========
ERROR: Missing binary: libsodium/1.0.18@libsodium/stable:7bfde258ff4f62f75668d0896dbddedaa7480a0f
ERROR: Missing binary: zeromq/4.3.4@zeromq/stable:54482f6c618abbb32948ae566f7a64644e82dab4
@memsharded
Copy link
Member

Hi @RazielXYZ

This is the reason this was introduced:

# It is necessary to install binaries, in case there are build_requires necessary to export
# But they should be local, if this was built here
conan_api.install.install_binaries(deps_graph=deps_graph, remotes=None)
source_folder = os.path.dirname(path)

There were users reporting that they were using tool_requires like cmake that are used in the package() method, and without installing the binary dependencies, this will not work, so making sure they are installed seems make sense.

Indeed the solution seems doing a conan install first.
The idea is that for developing such package, if it depends on some dependencies, those dependencies would have been installed previously, at least to be able to run the unit tests or something. Otherwise it means that the package with the artifacts hasn't been really built/tested at all.

@RazielXYZ
Copy link
Author

That makes sense; however, could it make sense for the install to use the configured remotes on the machine?
On a local machine where packages tend to be preinstalled or kept in the local cache from the prior build it doesn't make much of a difference, but on CI pipelines where a clean agent is used every time it's ever so slightly a pain.

@memsharded
Copy link
Member

could it make sense for the install to use the configured remotes on the machine?
On a local machine where packages tend to be preinstalled or kept in the local cache from the prior build it doesn't make much of a difference, but on CI pipelines where a clean agent is used every time it's ever so slightly a pain.

Yes, I think the resolution of the remotes could be added. Still, it would make the export-pkg slower than expected, but at least it would work. Let me think a bit about this use case...

@memsharded
Copy link
Member

I am proposing this #13324:

  • Using remotes to resolve missing dependencies
  • Introducing --skip-binaries to allow conan export-pkg to optimize and not require the binaries from dependencies

A bit preliminary, will request feedback from the team.

@RazielXYZ
Copy link
Author

Those both sound great to me, looking forward to see how it goes!

@memsharded
Copy link
Member

#13324 merged for next 2.0.2, thanks for the feedback!

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.

2 participants