Repository: pyca/cryptography

Issue:
Error installing 0.2.1 on Ubuntu 11.10
Trying to install 0.2.1 on Ubuntu 11.10 via pip, and getting the attached error.
Also tried with master and setup.py install, same error.
The latest cryptography version that I am able to successfully install via pip is 0.1.

```
Downloading/unpacking cryptography==0.2.1
  Downloading cryptography-0.2.1.tar.gz (13.8MB): 13.8MB downloaded
  Running setup.py (path:/tmp/pip_build_root/cryptography/setup.py) egg_info for package cryptography

    building '_cffi__xcfd0a060xfba2f231' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c cryptography/hazmat/primitives/__pycache__/_cffi__xcfd0a060xfba2f231.c -o /tmp/pip_build_root/cryptography/cryptography/hazmat/primitives/__pycache__/cryptography/hazmat/primitives/__pycache__/_cffi__xcfd0a060xfba2f231.o
    gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions /tmp/pip_build_root/cryptography/cryptography/hazmat/primitives/__pycache__/cryptography/hazmat/primitives/__pycache__/_cffi__xcfd0a060xfba2f231.o -o /tmp/pip_build_root/cryptography/cryptography/hazmat/primitives/__pycache__/_cffi__xcfd0a060xfba2f231.so
    building '_cffi__x5fea2bacx4a8b9ec1' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c cryptography/hazmat/primitives/__pycache__/_cffi__x5fea2bacx4a8b9ec1.c -o /tmp/pip_build_root/cryptography/cryptography/hazmat/primitives/__pycache__/cryptography/hazmat/primitives/__pycache__/_cffi__x5fea2bacx4a8b9ec1.o
    gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions /tmp/pip_build_root/cryptography/cryptography/hazmat/primitives/__pycache__/cryptography/hazmat/primitives/__pycache__/_cffi__x5fea2bacx4a8b9ec1.o -o /tmp/pip_build_root/cryptography/cryptography/hazmat/primitives/__pycache__/_cffi__x5fea2bacx4a8b9ec1.so
    building '_cffi__x9ee276ddxb4fc9075' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c cryptography/hazmat/bindings/__pycache__/_cffi__x9ee276ddxb4fc9075.c -o /tmp/pip_build_root/cryptography/cryptography/hazmat/bindings/__pycache__/cryptography/hazmat/bindings/__pycache__/_cffi__x9ee276ddxb4fc9075.o
    cryptography/hazmat/bindings/__pycache__/_cffi__x9ee276ddxb4fc9075.c: In function ‘_cffi_const_EVP_R_DISABLED_FOR_FIPS’:
    cryptography/hazmat/bindings/__pycache__/_cffi__x9ee276ddxb4fc9075.c:5702:20: error: ‘EVP_R_DISABLED_FOR_FIPS’ undeclared (first use in this function)
    cryptography/hazmat/bindings/__pycache__/_cffi__x9ee276ddxb4fc9075.c:5702:20: note: each undeclared identifier is reported only once for each function it appears in
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip_build_root/cryptography/setup.py", line 113, in <module>
        "build": cffi_build,
      File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
        dist.run_commands()
      File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "<string>", line 15, in replacement_run
      File "build/bdist.linux-i686/egg/setuptools/command/egg_info.py", line 186, in find_sources
      File "build/bdist.linux-i686/egg/setuptools/command/egg_info.py", line 246, in run
      File "build/bdist.linux-i686/egg/setuptools/command/egg_info.py", line 282, in add_defaults
      File "build/bdist.linux-i686/egg/setuptools/command/sdist.py", line 167, in add_defaults
      File "/usr/lib/python2.7/distutils/cmd.py", line 312, in get_finalized_command
        cmd_obj.ensure_finalized()
      File "/usr/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
        self.finalize_options()
      File "build/bdist.linux-i686/egg/setuptools/command/build_py.py", line 26, in finalize_options
      File "/usr/lib/python2.7/distutils/command/build_py.py", line 46, in finalize_options
        ('force', 'force'))
      File "/usr/lib/python2.7/distutils/cmd.py", line 298, in set_undefined_options
        src_cmd_obj.ensure_finalized()
      File "/usr/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
        self.finalize_options()
      File "/tmp/pip_build_root/cryptography/setup.py", line 55, in finalize_options
        OpenSSLBinding().ffi.verifier.get_extension(),
      File "cryptography/hazmat/bindings/openssl/binding.py", line 83, in __init__
        self._ensure_ffi_initialized()
      File "cryptography/hazmat/bindings/openssl/binding.py", line 99, in _ensure_ffi_initialized
        libraries)
      File "cryptography/hazmat/bindings/utils.py", line 72, in build_ffi
        ext_package="cryptography",
      File "/usr/local/lib/python2.7/dist-packages/cffi/api.py", line 339, in verify
        lib = self.verifier.load_library()
      File "/usr/local/lib/python2.7/dist-packages/cffi/verifier.py", line 74, in load_library
        self._compile_module()
      File "/usr/local/lib/python2.7/dist-packages/cffi/verifier.py", line 139, in _compile_module
        outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
      File "/usr/local/lib/python2.7/dist-packages/cffi/ffiplatform.py", line 25, in compile
        outputfilename = _build(tmpdir, ext)
      File "/usr/local/lib/python2.7/dist-packages/cffi/ffiplatform.py", line 50, in _build
        raise VerificationError('%s: %s' % (e.__class__.__name__, e))
    cffi.ffiplatform.VerificationError: CompileError: command 'gcc' failed with exit status 1
    Complete output from command python setup.py egg_info:
    running egg_info

creating pip-egg-info/cryptography.egg-info

writing requirements to pip-egg-info/cryptography.egg-info/requires.txt

writing pip-egg-info/cryptography.egg-info/PKG-INFO

writing top-level names to pip-egg-info/cryptography.egg-info/top_level.txt

writing dependency_links to pip-egg-info/cryptography.egg-info/dependency_links.txt

writing manifest file 'pip-egg-info/cryptography.egg-info/SOURCES.txt'

warning: manifest_maker: standard file '-c' not found



running build_ext

building '_cffi__xcfd0a060xfba2f231' extension

creating /tmp/pip_build_root/cryptography/cryptography/hazmat/primitives/__pycache__/cryptography

creating /tmp/pip_build_root/cryptography/cryptography/hazmat/primitives/__pycache__/cryptography/hazmat

creating /tmp/pip_build_root/cryptography/cryptography/hazmat/primitives/__pycache__/cryptography/hazmat/primitives

creating /tmp/pip_build_root/cryptography/cryptography/hazmat/primitives/__pycache__/cryptography/hazmat/primitives/__pycache__

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c cryptography/hazmat/primitives/__pycache__/_cffi__xcfd0a060xfba2f231.c -o /tmp/pip_build_root/cryptography/cryptography/hazmat/primitives/__pycache__/cryptography/hazmat/primitives/__pycache__/_cffi__xcfd0a060xfba2f231.o

gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions /tmp/pip_build_root/cryptography/cryptography/hazmat/primitives/__pycache__/cryptography/hazmat/primitives/__pycache__/_cffi__xcfd0a060xfba2f231.o -o /tmp/pip_build_root/cryptography/cryptography/hazmat/primitives/__pycache__/_cffi__xcfd0a060xfba2f231.so

running build_ext

building '_cffi__x5fea2bacx4a8b9ec1' extension

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c cryptography/hazmat/primitives/__pycache__/_cffi__x5fea2bacx4a8b9ec1.c -o /tmp/pip_build_root/cryptography/cryptography/hazmat/primitives/__pycache__/cryptography/hazmat/primitives/__pycache__/_cffi__x5fea2bacx4a8b9ec1.o

gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions /tmp/pip_build_root/cryptography/cryptography/hazmat/primitives/__pycache__/cryptography/hazmat/primitives/__pycache__/_cffi__x5fea2bacx4a8b9ec1.o -o /tmp/pip_build_root/cryptography/cryptography/hazmat/primitives/__pycache__/_cffi__x5fea2bacx4a8b9ec1.so

running build_ext

building '_cffi__x9ee276ddxb4fc9075' extension

creating /tmp/pip_build_root/cryptography/cryptography/hazmat/bindings/__pycache__/cryptography

creating /tmp/pip_build_root/cryptography/cryptography/hazmat/bindings/__pycache__/cryptography/hazmat

creating /tmp/pip_build_root/cryptography/cryptography/hazmat/bindings/__pycache__/cryptography/hazmat/bindings

creating /tmp/pip_build_root/cryptography/cryptography/hazmat/bindings/__pycache__/cryptography/hazmat/bindings/__pycache__

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c cryptography/hazmat/bindings/__pycache__/_cffi__x9ee276ddxb4fc9075.c -o /tmp/pip_build_root/cryptography/cryptography/hazmat/bindings/__pycache__/cryptography/hazmat/bindings/__pycache__/_cffi__x9ee276ddxb4fc9075.o

cryptography/hazmat/bindings/__pycache__/_cffi__x9ee276ddxb4fc9075.c: In function ‘_cffi_const_EVP_R_DISABLED_FOR_FIPS’:

cryptography/hazmat/bindings/__pycache__/_cffi__x9ee276ddxb4fc9075.c:5702:20: error: ‘EVP_R_DISABLED_FOR_FIPS’ undeclared (first use in this function)

cryptography/hazmat/bindings/__pycache__/_cffi__x9ee276ddxb4fc9075.c:5702:20: note: each undeclared identifier is reported only once for each function it appears in

Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/tmp/pip_build_root/cryptography/setup.py", line 113, in <module>

    "build": cffi_build,

  File "/usr/lib/python2.7/distutils/core.py", line 152, in setup

    dist.run_commands()

  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands

    self.run_command(cmd)

  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command

    cmd_obj.run()

  File "<string>", line 15, in replacement_run

  File "build/bdist.linux-i686/egg/setuptools/command/egg_info.py", line 186, in find_sources

  File "build/bdist.linux-i686/egg/setuptools/command/egg_info.py", line 246, in run

  File "build/bdist.linux-i686/egg/setuptools/command/egg_info.py", line 282, in add_defaults

  File "build/bdist.linux-i686/egg/setuptools/command/sdist.py", line 167, in add_defaults

  File "/usr/lib/python2.7/distutils/cmd.py", line 312, in get_finalized_command

    cmd_obj.ensure_finalized()

  File "/usr/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized

    self.finalize_options()

  File "build/bdist.linux-i686/egg/setuptools/command/build_py.py", line 26, in finalize_options

  File "/usr/lib/python2.7/distutils/command/build_py.py", line 46, in finalize_options

    ('force', 'force'))

  File "/usr/lib/python2.7/distutils/cmd.py", line 298, in set_undefined_options

    src_cmd_obj.ensure_finalized()

  File "/usr/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized

    self.finalize_options()

  File "/tmp/pip_build_root/cryptography/setup.py", line 55, in finalize_options

    OpenSSLBinding().ffi.verifier.get_extension(),

  File "cryptography/hazmat/bindings/openssl/binding.py", line 83, in __init__

    self._ensure_ffi_initialized()

  File "cryptography/hazmat/bindings/openssl/binding.py", line 99, in _ensure_ffi_initialized

    libraries)

  File "cryptography/hazmat/bindings/utils.py", line 72, in build_ffi

    ext_package="cryptography",

  File "/usr/local/lib/python2.7/dist-packages/cffi/api.py", line 339, in verify

    lib = self.verifier.load_library()

  File "/usr/local/lib/python2.7/dist-packages/cffi/verifier.py", line 74, in load_library

    self._compile_module()

  File "/usr/local/lib/python2.7/dist-packages/cffi/verifier.py", line 139, in _compile_module

    outputfilename = ffiplatform.compile(tmpdir, self.get_extension())

  File "/usr/local/lib/python2.7/dist-packages/cffi/ffiplatform.py", line 25, in compile

    outputfilename = _build(tmpdir, ext)

  File "/usr/local/lib/python2.7/dist-packages/cffi/ffiplatform.py", line 50, in _build

    raise VerificationError('%s: %s' % (e.__class__.__name__, e))

cffi.ffiplatform.VerificationError: CompileError: command 'gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/cryptography
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
  File "/usr/local/lib/python2.7/dist-packages/pip/__init__.py", line 185, in main
    return command.main(cmd_args)
  File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 86: ordinal not in range(128)
```



Discussion:
What version of libssl-dev do you have installed? The output of `dpkg -l | grep libssl` should do.

```
ii  libssl-dev                       1.0.0e-2ubuntu4.7                       SSL development libraries, header files and documentation
ii  libssl-doc                       1.0.0e-2ubuntu4.7                       SSL development documentation documentation
ii  libssl1.0.0                      1.0.0e-2ubuntu4.7                       SSL shared libraries
```

Thanks @giannisp, we've replicated this and we should have a fix in master soon.

Great, thank you!


Resolving patch:
diff --git a/cryptography/hazmat/bindings/openssl/err.py b/cryptography/hazmat/bindings/openssl/err.py
--- a/cryptography/hazmat/bindings/openssl/err.py
+++ b/cryptography/hazmat/bindings/openssl/err.py
@@ -151,7 +151,6 @@
 static const int EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH;
 static const int EVP_R_DECODE_ERROR;
 static const int EVP_R_DIFFERENT_KEY_TYPES;
-static const int EVP_R_DISABLED_FOR_FIPS;
 static const int EVP_R_ENCODE_ERROR;
 static const int EVP_R_INITIALIZATION_ERROR;
 static const int EVP_R_INPUT_NOT_INITIALIZED;


Test patch: