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

install fails on arch linux because "cl" command exists, but is something different #54

Closed
f0rki opened this issue Jan 20, 2017 · 1 comment

Comments

@f0rki
Copy link
Contributor

f0rki commented Jan 20, 2017

I'm having trouble getting the latest pyvex to work on arch linux. I'm using a virtualenv. Install works fine with pip. When I try to import pyvex, I get the following error:

$ python -c 'import pyvex'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "~/.virtualenvs/pyvex/lib/python2.7/site-packages/pyvex/__init__.py", line 31, in <module>
    pvc = _find_c_lib()
  File "~/.virtualenvs/pyvex/lib/python2.7/site-packages/pyvex/__init__.py", line 23, in _find_c_lib
    ffi.cdef(_ffi_str)
  File "~/.virtualenvs/pyvex/lib/python2.7/site-packages/cffi/api.py", line 105, in cdef
    self._cdef(csource, override=override, packed=packed)
  File "~/.virtualenvs/pyvex/lib/python2.7/site-packages/cffi/api.py", line 119, in _cdef
    self._parser.parse(csource, override=override, **options)
  File "~/.virtualenvs/pyvex/lib/python2.7/site-packages/cffi/cparser.py", line 299, in parse
    self._internal_parse(csource)
  File "~/.virtualenvs/pyvex/lib/python2.7/site-packages/cffi/cparser.py", line 304, in _internal_parse
    ast, macros, csource = self._parse(csource)
  File "~/.virtualenvs/pyvex/lib/python2.7/site-packages/cffi/cparser.py", line 262, in _parse
    self.convert_pycparser_error(e, csource)
  File "~/.virtualenvs/pyvex/lib/python2.7/site-packages/cffi/cparser.py", line 291, in convert_pycparser_error
    raise api.CDefError(msg)
cffi.api.CDefError: cannot parse "extern VexControl vex_control;"
:3:19: before: vex_control

Apparently the file _ffi_str variable contains only the string "extern VexControl vex_control;".

After some digging I came to the conclusion that the issues is in make_ffi.py#L58. The first tried command is cl. This is a binary that does something completely different (apparently part of the cliquer package) on my system.
This fails silently as there is no check for Popen.returncode. Maybe using subprocess.check_output would be better suited here, since it throws an exception on non-zero exit status?

After switching cmd1 and cmd2, it properly generates the file (with pip install -e .). But I guess this might break other systems...

@ltfish
Copy link
Member

ltfish commented Jan 21, 2017

Good finding!

Since cffi is essential for angr as of now, I think we can do the following:

  • Make the path to cl and cpp configurable in PyVEX (and SimuVEX).
  • Add some simple checks at import time to make sure cl and cpp are indeed what we are expecting, otherwise display an error message, asking users to properly set the path to cl and cpp.

@rhelmot any comment on this?

f0rki added a commit to f0rki/pyvex that referenced this issue Jan 23, 2017
this fixes the silent install fail when 'cl' is existing, but is not a compiler

fixes issue angr#54
f0rki added a commit to f0rki/pyvex that referenced this issue Jan 23, 2017
this fixes the silent install fail when 'cl' is existing, but is not a compiler

fixes issue angr#54
f0rki added a commit to f0rki/pyvex that referenced this issue Jan 23, 2017
this fixes the silent install fail when 'cl' is existing, but is not a compiler

fixes issue angr#54
@f0rki f0rki closed this as completed Feb 10, 2017
rhelmot pushed a commit that referenced this issue Mar 16, 2017
this fixes the silent install fail when 'cl' is existing, but is not a compiler

fixes issue #54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants