Error when trying to install app with mysql2 gem

前端 未结 11 1969
鱼传尺愫
鱼传尺愫 2020-12-02 06:52

Im trying to install an open source rails 3.2.21 application that uses the mysql2 gem, but when i try and run the bundle commant I get the followin

相关标签:
11条回答
  • 2020-12-02 07:43

    Based on the solution here

    brew install openssl
    
    export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/
    

    solved the problem.

    0 讨论(0)
  • 2020-12-02 07:44
    sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
    

    From here: https://gorails.com/setup/osx/10.14-mojave

    0 讨论(0)
  • 2020-12-02 07:45

    I found that I had to use --with-opt-dir=/usr/local/opt.

    Specifically, I added the following to my ~/.bundle/config file:

    BUNDLE_BUILD__MYSQL2: "--with-opt-dir=/usr/local/opt"
    
    0 讨论(0)
  • 2020-12-02 07:46

    Seems that you miss the main files needed to build mysql2 gem

    sudo apt-get install libsqlite3-dev libmysqlclient-dev -y
    

    libsqlite3-dev is not mandatory but install it since it's the default rails DB.

    0 讨论(0)
  • 2020-12-02 07:48

    For anybody still experiencing the issue:

    When you install openssl via brew, you should get the following message:

    Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries

    Generally there are no consequences of this for you. If you build your own software and it requires this formula, you'll need to add to your build variables:

    LDFLAGS: -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include
    PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig

    You can set these build flags (for the local application) by running the following:

    bundle config --local build.mysql2 "--with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include"
    

    This worked for me.

    See bundler's documentation for more information.

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