1

I am trying to install python package "M2Crypto" via requirements.txt and I receive the following error message:

/usr/include/openssl/opensslconf.h:36: Error: CPP #error ""This openssl-devel package does not work your architecture?"". Use the -cpperraswarn option to continue swig processing.

error: command 'swig' failed with exit status 1

I tried passing

option_name: SWIG_FEATURES value: "-cpperraswarn -includeall -I/usr/include/openssl"

But the error persists. Any idea?

amertkara
  • 1,369
  • 14
  • 19
  • Perhaps this question will help you http://stackoverflow.com/questions/7772965/m2crypto-doesnt-install-in-venv-or-swig-doesnt-define-x86-64-which-breaks – HavelTheGreat Feb 12 '15 at 20:23
  • @Elizion Thanks, I am not sure how to get `./fedora_setup.sh build` and `./fedora_setup.sh install` work on a Beanstalk instance. If I could know where absolute path of the virtualenv, maybe I could try that. – amertkara Feb 12 '15 at 20:25

2 Answers2

1

The following config file (placed in .ebextensions) works for me:

packages:
    yum:
        swig: []

container_commands:
    01_m2crypto:
        command: 'SWIG_FEATURES="-cpperraswarn -includeall -D`uname -m` -I/usr/include/openssl" pip install M2Crypto==0.21.1'

Make sure you don't specify M2Crypto in your requirements.txt though, Elastic Beanstalk will try to install all dependencies before running the container commands.

0

I have found a solution that gets M2Crypto installed on Beanstalk but it is a bit of hack and it is your responsibility to make sure that it is good for a production environment. I dropped M2Crypto from my project because this issue is ridiculous, try pycrypto if you can.

Based on (I only added python setup.py test):

#!/bin/bash
python -c "import M2Crypto" 2> /dev/null
if [ "$?" == 1 ]
then
    cd /tmp/ 
    pip install -d . --use-mirrors M2Crypto==0.21.1
    tar xvfz M2Crypto-0.21.1.tar.gz
    cd M2Crypto-0.21.1
    ./fedora_setup.sh build
    ./fedora_setup.sh install
    python setup.py test
fi`

In the environment config file

commands:
    m2crypto:
        command: scripts/m2crypto.sh
        ignoreErrors: True
        test: echo '! python -c "import M2Crypto"' | bash

ignoreErrors is NOT a good idea but I just used it to test if the package actually gets installed and seems like it.

Again, this might seem to get the package installed but I am not sure because removing ignoreErrors causes failure. Therefore, I won't mark this as the accepted answer but it was way too much to be a comment.

amertkara
  • 1,369
  • 14
  • 19