conda-incubator / conda-press

Press conda packages into wheels
https://regro.github.io/conda-press-docs/
BSD 3-Clause "New" or "Revised" License
116 stars 10 forks source link

patchelf: not an ELF executable error #38

Closed rth closed 5 years ago

rth commented 5 years ago

Thanks for this project!

When I am trying to make wheels for MacOS, I always get an error in patchelf,

$ conda press --subdir osx-64 --skip-python --fatten 'scikit-image=0.15.0=py37*'
[...]
Downloading https://conda.anaconda.org/conda-forge/osx-64/scikit-image-0.15.0-py37h86efe34_2.tar.bz2
Download complete
rewriting shebang for bin/skivi
rewriting RPATH for lib/python3.7/site-packages/skimage/_shared/geometry.cpython-37m-darwin.so
Traceback (most recent call last):
  File "/home/rth/.miniconda3/bin/conda-press", line 4, in <module>
    main()
  File "/home/rth/.miniconda3/lib/python3.6/site-packages/conda_press/main.xsh", line 63, in main
    only_pypi=ns.only_pypi
  File "/home/rth/.miniconda3/lib/python3.6/site-packages/conda_press/condatools.xsh", line 866, in artifact_ref_dependency_tree_to_wheels
    only_pypi=only_pypi
  File "/home/rth/.miniconda3/lib/python3.6/site-packages/conda_press/condatools.xsh", line 799, in package_to_wheel
    only_pypi=only_pypi
  File "/home/rth/.miniconda3/lib/python3.6/site-packages/conda_press/condatools.xsh", line 766, in artifact_to_wheel
    wheel.rewrite_rpaths()
  File "/home/rth/.miniconda3/lib/python3.6/site-packages/conda_press/wheel.xsh", line 582, in rewrite_rpaths
    current_rpath = $(patchelf --print-rpath @(fspath)).strip()
  File "/home/rth/.miniconda3/lib/python3.6/site-packages/xonsh/__amalgam__.py", line 22440, in subproc_captured_stdout
    return run_subproc(cmds, captured="stdout")
  File "/home/rth/.miniconda3/lib/python3.6/site-packages/xonsh/__amalgam__.py", line 22424, in run_subproc
    command.end()
  File "/home/rth/.miniconda3/lib/python3.6/site-packages/xonsh/__amalgam__.py", line 15671, in end
    self._end(tee_output=tee_output)
  File "/home/rth/.miniconda3/lib/python3.6/site-packages/xonsh/__amalgam__.py", line 15690, in _end
    self._raise_subproc_error()
  File "/home/rth/.miniconda3/lib/python3.6/site-packages/xonsh/__amalgam__.py", line 15816, in _raise_subproc_error
    raise subprocess.CalledProcessError(rtn, spec.args, output=self.output)
subprocess.CalledProcessError: Command '['patchelf', '--print-rpath', '/tmp/scikit-image-0.15.0-py37h86efe34_2vu_2br8v/lib/python3.7/site-packages/skimage/_shared/geometry.cpython-37m-darwin.so']' returned non-zero exit status 1.

the actual error is,

$ patchelf --print-rpath /tmp/scikit-image-0.15.0-py37h86efe34_2vu_2br8v/lib/python3.7/site-packages/skimage/_shared/geometry.cpython-37m-darwin.so      
patchelf: not an ELF executable

and otherwise patchelf looks fine

$ which patchelf
/home/rth/.miniconda3/envs/conda-press-env/bin/patchelf
$ /home/rth/.miniconda3/envs/conda-press-env/bin/patchelf --version
patchelf 0.10

conda-press installed in a clean conda virtualenv. The output of conda list is below,

% conda list       
# packages in environment at /home/rth/.miniconda3/envs/conda-press-env:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
asn1crypto                0.24.0                py37_1003    conda-forge
binutils                  2.32                 he1b5a44_3    conda-forge
bzip2                     1.0.8                h516909a_1    conda-forge
ca-certificates           2019.9.11            hecc5488_0    conda-forge
certifi                   2019.9.11                py37_0    conda-forge
cffi                      1.12.3           py37h8022711_0    conda-forge
chardet                   3.0.4                 py37_1003    conda-forge
conda                     4.7.12                   py37_0    conda-forge
conda-package-handling    1.6.0            py37h516909a_0    conda-forge
conda-press               0.0.4                    py37_0    conda-forge
cryptography              2.7              py37h72c5cf5_0    conda-forge
idna                      2.8                   py37_1000    conda-forge
lazyasd                   0.1.4                      py_1    conda-forge
libffi                    3.2.1             he1b5a44_1006    conda-forge
libgcc-ng                 9.1.0                hdf63c60_0  
libstdcxx-ng              9.1.0                hdf63c60_0  
ncurses                   6.1               hf484d3e_1002    conda-forge
openssl                   1.1.1c               h516909a_0    conda-forge
patchelf                  0.10                 he1b5a44_0    conda-forge
pip                       19.2.3                   py37_0    conda-forge
prompt_toolkit            2.0.9                      py_0    conda-forge
pycosat                   0.6.3           py37h14c3975_1001    conda-forge
pycparser                 2.19                     py37_1    conda-forge
pygments                  2.4.2                      py_0    conda-forge
pyopenssl                 19.0.0                   py37_0    conda-forge
pysocks                   1.7.1                    py37_0    conda-forge
python                    3.7.3                h33d41f4_1    conda-forge
readline                  8.0                  hf8c457e_0    conda-forge
requests                  2.22.0                   py37_1    conda-forge
ruamel.yaml               0.16.5           py37h516909a_1    conda-forge
ruamel.yaml.clib          0.2.0            py37h516909a_0    conda-forge
ruamel_yaml               0.15.71         py37h14c3975_1000    conda-forge
setproctitle              1.1.10          py37h14c3975_1001    conda-forge
setuptools                41.2.0                   py37_0    conda-forge
six                       1.12.0                py37_1000    conda-forge
sqlite                    3.29.0               hcee41ef_1    conda-forge
tk                        8.6.9             hed695b0_1003    conda-forge
tqdm                      4.36.1                     py_0    conda-forge
urllib3                   1.25.6                   py37_0    conda-forge
wcwidth                   0.1.7                      py_1    conda-forge
wheel                     0.33.6                   py37_0    conda-forge
xonsh                     0.9.11                   py37_0    conda-forge
xz                        5.2.4             h14c3975_1001    conda-forge
yaml                      0.1.7             h14c3975_1001    conda-forge
zlib                      1.2.11            h516909a_1006    conda-forge

This happened for multiple packages that I tried...

marcelotrevisani commented 5 years ago

Hi @rth , thanks for reporting this! I will try to reproduce later this bug on Linux, if I am successful I will investigate it. Unfortunately, I don't have an osx machine with me. Do you know if this problem also occurs on Linux? But I saw some problems on osx with the patchelf in another project, idk if it is related to it as well.

rth commented 5 years ago

Unfortunately, I don't have an osx machine with me. Do you know if this problem also occurs on Linux?

Thanks @marcelotrevisani ! Sorry, forgot to mention, that this happens on Gentoo Linux. I don't have an osx machine either.

scopatz commented 5 years ago

Thanks for reporting @rth!

scopatz commented 5 years ago

FWIW, I can reproduce this issue

scopatz commented 5 years ago

Actually, wait, are you trying to run with --subdir osx-64 on Linux? That will certainly fail because the proper toolchain is not available to rewrite the binaries with. Right now, we need to run conda-press on the target platform. Kinda sucks, I know :frowning_face:

rth commented 5 years ago

Right now, we need to run conda-press on the target platform.

Aww, that would explain it :) But then running it with --subdir win-64 on Linux seems to work? At least it succeeds without errors.

scopatz commented 5 years ago

That is... unexpected. I think that is a short term thing because we are not yet stripping binaries for Windows packages (mostly because I don't know how). Once that is added, I wouldn't expect it to work on Linux or Mac anymore :wink:

rth commented 5 years ago

Thanks for the explanation! Closing a not a bug then.

Opened a separate issue https://github.com/regro/conda-press/issues/40 to discuss if making wheels on a different platform than the target one could be a possibility one day..