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] Install packages compatible with incorrect architecture #14567

Closed
1 task done
LielHarel opened this issue Aug 24, 2023 · 2 comments · Fixed by #14752
Closed
1 task done

[bug] Install packages compatible with incorrect architecture #14567

LielHarel opened this issue Aug 24, 2023 · 2 comments · Fixed by #14752

Comments

@LielHarel
Copy link
Contributor

LielHarel commented Aug 24, 2023

Environment details

  • Operating System+version: all
  • Compiler+version: all
  • Conan version: 2.0.9 (latest)
  • Python version: all

Steps to reproduce

  1. Make sure settings.arch in your profile differs your host architecture, for example:
    If your host architecture is x86 and in your profile is defined:
[settings]
arch=armv7
....
[conf]
tools.system.package_manager:mode=install
tools.system.package_manager:sudo=True
  1. In the conan file you should use _SystemPackageManagerTool in some way, for example:
def system_requirements(self):
        apt = Apt(self)
        apt.install(["tree"], update=True, check=True)

For installing requirements for building the conan package.

  1. Then execute conan build -pr <your_profile> ....

  2. If on your system the command tree is not found (in linux you can uninstall it with the command apt-get remove tree to try this), conan will try to install the package for arm and not for your host architecture (x86), means it will try to install tree:arm instead of just tree.

Logs

conan executes something like that apt-get install tree:arm on x86 architecture and we get an error that the architecture is suitable for our device.

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@LielHarel LielHarel changed the title Install packages compatible with incorrect architecture [bug] Install packages compatible with incorrect architecture Aug 24, 2023
@memsharded memsharded self-assigned this Sep 10, 2023
@memsharded
Copy link
Member

Hi @LielHarel

Thanks for your report.

It is not completely clear that the "build" package is always the one to be installed. I understood that some distros allow the :arch precisely to be able to install some packages that can be used in cross-compilation scenarios, even if they don't match the current machine "build" architecture. This is the case when the system requirements are libraries to link.

On the other hand, I understand that some tools executables, intended to be run in the "build" context (the tree example), which is a different use case than the "host" cross-build scenario of the libraries.

So I think this is not exactly a bug that is solved by changing the context for all install, but I think that what we are missing here is a qualifier in the install methods that specify whether a system-require is a tool build=True for example or it is a library (maybe the default, build=False?). Based on that qualifier, the internal will decide to append the :arch host architecture or not.

If you would like to contribute such a feature, it will be very appreciated of course :) Thanks very much!

@LielHarel
Copy link
Contributor Author

LielHarel commented Sep 15, 2023

I would love to add the feature that enables the user to indicate if the installed package is a host tool or a library :)
Open a PR for this #14752 :)

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