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

Cross compiling with virtual packages #5341

Closed
2 tasks done
isuruf opened this issue May 14, 2024 · 2 comments · Fixed by #5350
Closed
2 tasks done

Cross compiling with virtual packages #5341

isuruf opened this issue May 14, 2024 · 2 comments · Fixed by #5350
Labels
in-progress issue is actively being worked on source::community catch-all for issues filed by community members type::bug describes erroneous operation, use severity::* to classify the type
Milestone

Comments

@isuruf
Copy link
Contributor

isuruf commented May 14, 2024

Checklist

  • I added a descriptive title
  • I searched open reports and couldn't find a duplicate

What happened?

Building on a x86 Linux machine for x86 windows fails.

$ cat meta.yaml 
package:
  name: foo
  version: 0.0.1

build:
  number: 0
  script:
    - echo 'hello'
    - ls $PREFIX
    # this is the unix layout.
    - test ! -d $PREFIX/x86_64-w64-mingw32
    - test -d $PREFIX/Library

requirements:
  build:
  host:
    - m2w64-sysroot_win-64
  run:
$ cat conda_build_config.yaml 
target_platform:
  - win-64

Running

conda build . -c conda-forge/label/m2w64-experimental -c conda-forge

fails the test, because it uses the unix noarch package instead of the windows noarch package.

cc @mbargull @jaimergp

Conda Info

active environment : base
    active env location : /home/isuru/miniforge3
            shell level : 1
       user config file : /home/isuru/.condarc
 populated config files : /home/isuru/miniforge3/.condarc
                          /home/isuru/.condarc
          conda version : 24.5.0
    conda-build version : 24.5.0
         python version : 3.10.13.final.0
                 solver : libmamba (default)
       virtual packages : __archspec=1=zen3
                          __conda=24.5.0=0
                          __glibc=2.35=0
                          __linux=6.5.0=0
                          __unix=0=0
       base environment : /home/isuru/miniforge3  (writable)
      conda av data dir : /home/isuru/miniforge3/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : /home/isuru/miniforge3/pkgs
                          /home/isuru/.conda/pkgs
       envs directories : /home/isuru/miniforge3/envs
                          /home/isuru/.conda/envs
               platform : linux-64
             user-agent : conda/24.5.0 requests/2.31.0 CPython/3.10.13 Linux/6.5.0-28-generic ubuntu/22.04.4 glibc/2.35 solver/libmamba conda-libmamba-solver/24.1.0 libmambapy/1.5.7
                UID:GID : 1000:1000
             netrc file : /home/isuru/.netrc
           offline mode : False

Conda Config

==> /home/isuru/miniforge3/.condarc <==
channels:
  - conda-forge
solver: libmamba

==> /home/isuru/.condarc <==
channels:
  - conda-forge
report_errors: False
solver: libmamba
conda_build:
  pkg_format: 2

Conda list

$ conda list --show-channel-urls | grep "^conda"
conda                     24.5.0          py310hff52083_0    conda-forge
conda-build               24.5.0          py310hff52083_1    conda-forge
conda-content-trust       0.2.0              pyhd8ed1ab_0    conda-forge
conda-forge-metadata      0.5.3                    pypi_0    pypi
conda-forge-pinning       2023.11.07.18.09.01      hd8ed1ab_0    conda-forge
conda-index               0.4.0              pyhd8ed1ab_0    conda-forge
conda-libmamba-solver     24.1.0             pyhd8ed1ab_0    conda-forge
conda-lock                2.4.2              pyhd8ed1ab_0    conda-forge
conda-oci-mirror          0.1.0                    pypi_0    pypi
conda-pack                0.7.1              pyhd8ed1ab_0    conda-forge
conda-package-handling    2.2.0              pyh38be061_0    conda-forge
conda-package-streaming   0.9.0              pyhd8ed1ab_0    conda-forge
conda-smithy              3.35.0             pyhd8ed1ab_0    conda-forge
conda-souschef            2.2.3              pyhd8ed1ab_0    conda-forge
conda-suggest             0.1.1              pyh9f0ad1d_0    conda-forge
conda-suggest-conda-forge 2021.8.24            ha770c72_0    conda-forge
conda-tree                1.1.0              pyhd8ed1ab_2    conda-forge

Additional Context

No response

@isuruf isuruf added the type::bug describes erroneous operation, use severity::* to classify the type label May 14, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in 🧭 Planning May 14, 2024
@mbargull
Copy link
Member

I took a quick look:
Fixing this should be fairly simple with just

     with env_vars(
         {
             "CONDA_ALLOW_NON_CHANNEL_URLS": "true",
             "CONDA_SOLVER_IGNORE_TIMESTAMPS": "false",
+            "CONDA_SUBDIR": subdir,
         },
         callback=reset_context,
     ):

at https://github.com/conda/conda-build/blob/24.5.0/conda_build/environ.py#L1263-L1269 and passing subdir on to install_actions from get_install_actions/get_package_records, i.e., adding a simple test would be most of the work.
(Yeah, that's an unexpectedly obvious oversight on our part, whoops. Should also be fixed when gh-5154 gets tackled.)

As for when/how to include this:

  1. We could include this in a 24.5.x patch release ("fixes cross-platform building with virtual packages"),
  2. or include this only in 24.7.x ("adding support for proper cross-platform building").

In principle, I'd be in favor of option 1, but am also not sure if this could be an "unexpected environment resolving change for a patch release" for some.

@jaimergp
Copy link
Contributor

Added #5350 with a test

@kenodegard kenodegard added source::community catch-all for issues filed by community members in-progress issue is actively being worked on labels May 23, 2024
@kenodegard kenodegard moved this from 🆕 New to 👀 In Review in 🧭 Planning May 23, 2024
@kenodegard kenodegard moved this from 👀 In Review to ✅ Approved in 🧭 Planning May 23, 2024
@beeankha beeankha added this to the 24.7.x milestone May 23, 2024
@github-project-automation github-project-automation bot moved this from ✅ Approved to 🏁 Done in 🧭 Planning Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in-progress issue is actively being worked on source::community catch-all for issues filed by community members type::bug describes erroneous operation, use severity::* to classify the type
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants