Problem installing sqlite3-ruby!

前端 未结 7 2039
再見小時候
再見小時候 2020-12-19 03:44

I\'m having issues installing the sqlite3-ruby gem on crunchbang linux. After googling the past few hours and following several people with the same problem, I still haven\

相关标签:
7条回答
  • 2020-12-19 03:51

    I had the exact same problem. Jarek's solution worked when I moved all of the files (not just libsqlite3.a) from ~/sqlite/lib to gems/sqlite3-ruby-1.3.1/ext/sqlite3.

    0 讨论(0)
  • 2020-12-19 03:54

    Install a lower version of sqlite3-ruby should resolve your problem:

    sudo gem install sqlite3-ruby --version=1.2.5
    
    0 讨论(0)
  • 2020-12-19 03:57

    Per the sqlite3-ruby (now named sqlite3) README.rdoc, you can use the following method to direct to the correct libraries:

    If you have sqlite3 installed in a non-standard location, you can specify the location of the include and lib files by doing:

    gem install sqlite3 -- --with-sqlite3-include=/opt/local/include \

    --with-sqlite3-lib=/opt/local/lib

    0 讨论(0)
  • 2020-12-19 03:59

    I had a similar issue - I simply commented out the following annoying line from ./Gemfile in the project directory to:

    # gem 'sqlite3-ruby', :require => 'sqlite3'
    

    and did:

    bundle install
    

    script/rails server was working fine again. Phew!

    Seems like sqlite3 is duplicated - weird

    0 讨论(0)
  • 2020-12-19 04:05

    Shawn, let me try to elaborate.

    Ruby is adapting to the sqlite3 library by compiling petty examples and verifying if compile was successfull. This picks up the old library, which does not include the required functions.

    The first solution is to remove the old library and to direct ruby to the directory you downloaded the new version to. Depending on the system you are using you have to choose the right package manager: apt-get, dpkg, yum, yast, ipkg, ... to remove the obsolete package. This makes sure your build is not picking up any old pieces. Then you have to make sure you are pointing ruby to the right directory where the new library is located with --with-sqlite3-dir option.

    The second solution is a kind of a hack. It relies on C compiler picking up the files in the current directory before the others. You can use cp, mc, or any other file manager to copy the .a libraries and .h headers to the build directory. The build shoud be ok, but your sqlite3 command will still be the old one, possibly incompatible with the databases created with your new library.

    HTH, Jarek

    0 讨论(0)
  • 2020-12-19 04:08

    This is due to extconf.rb picking up your old 3.5.9 library when testing for functions before putting together the Makefile.

    One solution to cut this short is to apt-get remove sqlite3 and retry

    sudo gem install sqlite3-ruby -- --with-sqlite3-dir=$HOME/sqlite
    

    This may save you from incompatibilities if you want to use sqlite3 command line binary.

    Another solution is to copy your new ~/sqlite/lib/libsqlite3.a into the build directory of your gem (see gem env, something like gems/sqlite3-ruby-1.3.1/ext/sqlite3) and retry

    sudo gem install sqlite3-ruby
    

    The test should pick up your new library now and install fine.

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