gem eventmachine fatal error: 'openssl/ssl.h' file not found

后端 未结 9 2281
时光说笑
时光说笑 2020-12-02 04:01

Just installed El Capitan and can\'t install gem eventmachine 1.0.7. openssl is at 1.0.2a-1. Tried to use --with-ss

相关标签:
9条回答
  • 2020-12-02 04:16

    This worked for me -

        gem install eventmachine -v '1.0.7' -- --debug --backtrace --with-cppflags=-I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib
        Building native extensions with: '--debug --backtrace --with-cppflags=-I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib'
        This could take a while...
        Successfully installed eventmachine-1.0.7
        Parsing documentation for eventmachine-1.0.7
        Installing ri documentation for eventmachine-1.0.7
        Done installing documentation for eventmachine after 9 seconds
        1 gem installed
    

    NOTE:- Before I was able to successfully install this gem, I had to do a few things. These might apply to you, so listing them here -

    1.) got off the corporate-VPN OR you might have to turn ON proxy settings

    2.) PKG_CONFIG_PATH was set to -

    echo $PKG_CONFIG_PATH
    /usr/local/opt/openssl/lib/pkgconfig
    

    3.) had to add the following to $PATH in bash_profile (in my case ~/.zshrc)

    export PATH="/usr/local/opt/openssl/bin:$PATH"
    

    4.) Also note, that contrary to some answers I got in this SO post, and also this thread on github-eventmachine, I was not able to install eventmachine

    gem install eventmachine -v '1.0.7' -- --debug --backtrace --with-cppflags=-I/usr/local/include --with-ldflags=-L/usr/local/lib
    Fetching: eventmachine-1.0.7.gem (100%)
    Building native extensions with: '--debug --backtrace --with-cppflags=-I/usr/local/include --with-ldflags=-L/usr/local/lib'
    This could take a while...
    ERROR:  Error installing eventmachine:
        ERROR: Failed to build gem native extension.
    

    It seems /usr/local/opt/openssl/include is the right location and not /usr/local/include when specifying the openssl location.

    0 讨论(0)
  • 2020-12-02 04:18

    When using bundler and homebrew:

    $ bundle config build.eventmachine --with-cppflags=-I$(brew --prefix openssl)/include
    $ bundle install
    
    0 讨论(0)
  • 2020-12-02 04:21
    gem pristine eventmachine -- --with-cppflags=-I/usr/local/opt/openssl/include
    

    pristine removes the old gem and recompiles it.

    The cpp flags option allows the compiler to find the openssl headers.

    You can also add the version if you like:

    gem pristine eventmachine -v '1.0.4' -- --with-cppflags=-I/usr/local/opt/openssl/include
    
    0 讨论(0)
  • 2020-12-02 04:22

    If you're installing EventMachine as a dependency of another gem, be sure to specify the correct version when you manually install the gem:

    gem install eventmachine -v 1.0.5 -- --with-cppflags=-I$(brew --prefix openssl)/include
    

    Then you can install the gem that you were originally trying to install:

    gem install mailcatcher
    
    0 讨论(0)
  • 2020-12-02 04:25
    $ gem install eventmachine -- --with-cppflags=-I/usr/local/opt/openssl/include                                                                                                             
    Building native extensions with: '--with-cppflags=-I/usr/local/opt/openssl/include'
    This could take a while...
    Successfully installed eventmachine-1.0.8
    1 gem installed
    

    You can also set up bundler like this but I think that is superficial

    bundle config build.eventmachine --with-cppflags=-I/usr/local/opt/openssl/include
    
    0 讨论(0)
  • 2020-12-02 04:31
    brew link --force openssl
    

    Then:

    gem install eventmachine
    

    It also fixes:

    • gem install taks
    • bundle install
    • rake and rails tasks

    P.S. Probably you'll need to remove and run brew install openssl again

    The issue happends because Apple had removed openssl from OSX (in El Captain build)

    0 讨论(0)
提交回复
热议问题