conda-forge / llvmdev-feedstock

A conda-smithy repository for llvmdev.
BSD 3-Clause "New" or "Revised" License
8 stars 41 forks source link

llvm-lit.py is not run on windows in bld.bat #200

Closed gshimansky closed 1 year ago

gshimansky commented 1 year ago

Solution to issue cannot be found in the documentation.

Issue

Script bld.bat calls llvm-lit.py but on windows you cannot just call a .py file unless an extension association is made between .py extension and a python interpreter. Instead it is necessary to call python explicitly.

Installed packages

# packages in environment at C:\Users\gashiman\AppData\Local\miniconda3\envs\my-conda-build:
#
# Name                    Version                   Build  Channel
beautifulsoup4            4.11.2             pyha770c72_0    conda-forge
brotlipy                  0.7.0           py310h8d17308_1005    conda-forge
bzip2                     1.0.8                h8ffe710_4    conda-forge
ca-certificates           2022.12.7            h5b45459_0    conda-forge
certifi                   2022.12.7          pyhd8ed1ab_0    conda-forge
cffi                      1.15.1          py310h628cb3f_3    conda-forge
chardet                   5.1.0           py310h5588dad_0    conda-forge
charset-normalizer        2.1.1              pyhd8ed1ab_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
conda                     23.1.0          py310h5588dad_0    conda-forge
conda-build               3.23.3          py310h5588dad_1    conda-forge
conda-package-handling    2.0.2              pyh38be061_0    conda-forge
conda-package-streaming   0.7.0              pyhd8ed1ab_1    conda-forge
cryptography              39.0.2          py310h6e82f81_0    conda-forge
filelock                  3.9.0              pyhd8ed1ab_0    conda-forge
glob2                     0.7                        py_0    conda-forge
idna                      3.4                pyhd8ed1ab_0    conda-forge
jinja2                    3.1.2              pyhd8ed1ab_1    conda-forge
libarchive                3.6.2                h27c7867_0    conda-forge
libffi                    3.4.2                h8ffe710_5    conda-forge
libiconv                  1.17                 h8ffe710_0    conda-forge
liblief                   0.12.3               h63175ca_0    conda-forge
libsqlite                 3.40.0               hcfcfb64_0    conda-forge
libxml2                   2.10.3               hc3477c8_0    conda-forge
libzlib                   1.2.13               hcfcfb64_4    conda-forge
lz4-c                     1.9.4                hcfcfb64_0    conda-forge
lzo                       2.10              he774522_1000    conda-forge
m2-msys2-runtime          2.5.0.17080.65c939c               3    conda-forge
m2-patch                  2.7.5                         2    conda-forge
m2w64-gcc-libgfortran     5.3.0                         6    conda-forge
m2w64-gcc-libs            5.3.0                         7    conda-forge
m2w64-gcc-libs-core       5.3.0                         7    conda-forge
m2w64-gmp                 6.1.0                         2    conda-forge
m2w64-libwinpthread-git   5.0.0.4634.697f757               2    conda-forge
markupsafe                2.1.2           py310h8d17308_0    conda-forge
menuinst                  1.4.19          py310h5588dad_1    conda-forge
msys2-conda-epoch         20160418                      1    conda-forge
openssl                   3.0.8                hcfcfb64_0    conda-forge
pip                       23.0.1             pyhd8ed1ab_0    conda-forge
pkginfo                   1.9.6              pyhd8ed1ab_0    conda-forge
pluggy                    1.0.0              pyhd8ed1ab_5    conda-forge
psutil                    5.9.4           py310h8d17308_0    conda-forge
py-lief                   0.12.3          py310h00ffb61_0    conda-forge
pycosat                   0.6.4           py310h8d17308_1    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pyopenssl                 23.0.0             pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1              pyh0701188_6    conda-forge
python                    3.10.9          h4de0772_0_cpython    conda-forge
python-libarchive-c       4.0             py310h5588dad_2    conda-forge
python_abi                3.10                    3_cp310    conda-forge
pytz                      2022.7.1           pyhd8ed1ab_0    conda-forge
pyyaml                    6.0             py310h8d17308_5    conda-forge
requests                  2.28.2             pyhd8ed1ab_0    conda-forge
ripgrep                   13.0.0               h7f3b576_2    conda-forge
ruamel.yaml               0.17.21         py310h8d17308_3    conda-forge
ruamel.yaml.clib          0.2.7           py310h8d17308_1    conda-forge
setuptools                65.3.0          py310h5588dad_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
soupsieve                 2.3.2.post1        pyhd8ed1ab_0    conda-forge
tk                        8.6.12               h8ffe710_0    conda-forge
toml                      0.10.2             pyhd8ed1ab_0    conda-forge
toolz                     0.12.0             pyhd8ed1ab_0    conda-forge
tqdm                      4.65.0             pyhd8ed1ab_1    conda-forge
tzdata                    2022g                h191b570_0    conda-forge
ucrt                      10.0.22621.0         h57928b3_0    conda-forge
urllib3                   1.26.14            pyhd8ed1ab_0    conda-forge
vc                        14.3                hb6edc58_10    conda-forge
vs2015_runtime            14.34.31931         h4c5c07a_10    conda-forge
wheel                     0.38.4             pyhd8ed1ab_0    conda-forge
win_inet_pton             1.1.0              pyhd8ed1ab_6    conda-forge
xz                        5.2.6                h8d14728_0    conda-forge
yaml                      0.2.5                h8ffe710_2    conda-forge
zstandard                 0.19.0          py310h0009e47_1    conda-forge
zstd                      1.5.2                h12be248_6    conda-forge

Environment info

active environment : base
    active env location : C:\Users\gashiman\AppData\Local\miniconda3\envs\my-conda-build
            shell level : 3
       user config file : C:\Users\gashiman\.condarc
 populated config files :
          conda version : 23.1.0
    conda-build version : 3.23.3
         python version : 3.10.9.final.0
       virtual packages : __archspec=1=x86_64
                          __win=0=0
       base environment : C:\Users\gashiman\AppData\Local\miniconda3\envs\my-conda-build  (writable)
      conda av data dir : C:\Users\gashiman\AppData\Local\miniconda3\envs\my-conda-build\etc\conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Users\gashiman\AppData\Local\miniconda3\envs\my-conda-build\pkgs
                          C:\Users\gashiman\.conda\pkgs
                          C:\Users\gashiman\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\gashiman\AppData\Local\miniconda3\envs\my-conda-build\envs
                          C:\Users\gashiman\.conda\envs
                          C:\Users\gashiman\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/23.1.0 requests/2.28.2 CPython/3.10.9 Windows/10 Windows/10.0.22000
          administrator : False
             netrc file : None
           offline mode : False
sumit0190 commented 1 year ago

There's two problems here:

  1. The llvm-lit script needs to be called explicitly with the SYS_PYTHON executable. Calling it with the local Python executable will result in an error.
  2. Even after doing so, the lit.site.cfg.py.in template is not used to generate the actual config unless DLLVM_INCLUDE_TESTS is set to ON, like it is for the Unix builds. I think (I am not sure) this is what generates the real config; without it the llvm-lit script complains about being unable to find a test configuration.

I verified that at least on Anaconda's fork of this recipe (which is virtually identical), the above steps resolve this issue correctly and all the specified tests execute (and pass).

gshimansky commented 1 year ago

Yes I tried calling llvm-lit script as just python ..\..\build\bin\llvm-lit.py and it didn't work for me, so some other modifications are necessary.

h-vetinari commented 1 year ago

PRs welcome :)

sumit0190 commented 1 year ago

@h-vetinari I created a PR and verified in the logs that the tests run correctly (and all pass).

gshimansky commented 1 year ago

Can you please also update branch 14.x? Someone like me may be trying to build llvm-14, so they may be wondering too whether tests in that version pass or not.

sumit0190 commented 1 year ago

@gshimansky Sure; once the PR is approved I'll create another one for the 14 branch.