sqlite3_open_v2 error - ruby

after turnning on the server (rails s), getting error message when browsing to the remote link.
then:
/usr/bin/ruby: symbol lookup error: /usr/lib/ruby/gems/1.9.1/gems/sqlite3-1.3.4/lib/sqlite3/sqlite3_native.so: undefined symbol: sqlite3_open_v2
tryed to install sqlite3 gem / downgrade and nothing solves it.
what am i doing wrong?

I got this error this week, and resolved it by adding the path to the sqlite library to LD_LIBRARY_PATH:
This was the path
[/usr/local/lib]$ ls
... libsqlite3.a libsqlite3.la libsqlite3.so libsqlite3.so.0 libsqlite3.so.0.8.6
And I added it in the profile:
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export LD_LIBRARY_PATH
This resolved the issue for me.

I had this problem too.
I resolved it this way :
mv /usr/lib/libsqlite3.so.0 /usr/lib/libsqlite3.so.0.back
gem install sqlite3 -- --with-sqlite3-include=/usr/local/include --with-sqlite3-lib=/usr/local/lib

FWIW, I had to first install sqlite3 because my existing version was too old, and then build sqlite3 gem while pointing to the correct libraries:
wget http://www.sqlite.org/sqlite-autoconf-3070701.tar.gz
tar -zxvf sqlite-autoconf-3070701.tar.gz
cd sqlite-autoconf-3070701
./configure
make && make install
gem install sqlite3 -- --with-sqlite3-include=/usr/local/include --with-sqlite3-lib=/usr/local/lib

Related

Error installing SASS gem - don't have permissions

I'm not well versed in terminal, but I'll try my best to make this as clear and concise as I can.
I'm trying to install SASS and get the following errors:
When using gem install sass I get .
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
When using sudo gem install sass I get .
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
I have Xcode installed and I have agreed to the terms.
I even tried updating my Ruby, but terminal tells me I already have the most updated version.
ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]
The worst part of all of this is that when I navigate to my Ruby/Gems/2.3.0/gems directory, there is a sass-3.5.5 folder!!! (linked image to follow)
Ruby directory path to sass folder
I try running sass -v and get -bash: sass: command not found
I feel like I've tried everything that I can think of or find online. I'm at a loss and definitely need some help.
The issue can be fixed by installing RVM or Rbenv for managing ruby versions and gems.
Also, FilePermissionError can be fixed using the -n parameter
sudo gem install sass -n /usr/bin
I prefer not touching sudo command, so I managed to solve this issue by referring to SASS home page:
If you use Node.js, you can also install Sass using npm by running
npm install -g sass
If you find it helpful, kindly upvote or leave comment so that I know it can solve your issues too.
Or one could update the directory for where gems are installed.
Please see the origional answer here: https://stackoverflow.com/a/2619731/3302764
export GEM_HOME=~/.gem
export GEM_PATH=~/.gem

Trouble installing bropages on OSX

When I try to install bropages on Mavericks, I get:
$ gem install bropages
Building native extensions. This could take a while...
ERROR: Error installing bropages:
ERROR: Failed to build gem native extension.
No such file or directory # dir_chdir - /Users/christian/.gem/gems/unf_ext-0.0.6/ext/unf_ext
Gem files will remain installed in /Users/christian/.gem/gems/unf_ext-0.0.6 for inspection.
Results logged to /Users/christian/.gem/extensions/x86_64-darwin-13/2.2.0- static/unf_ext-0.0.6/gem_make.out
And then:
$ cat /Users/christian/.gem/extensions/x86_64-darwin-13/2.2.0-static/unf_ext-0.0.6/gem_make.out
No such file or directory # dir_chdir - /Users/christian/.gem/gems/unf_ext-0.0.6/ext/unf_ext
I'm using ruby 2.2.1 and gem 2.4.5, both managed with rbenv. Any idea what could cause this?
Have you tried it with sudo, I am running into the same issues as you, but my errors mentioned permissions, so I am going to go with sudo. It is strange, as I had it installed once before, and now it no longer seems to be there.
Make sure you've installed the Xcode Command Line Tools, which brings with it a bunch of utilities, including what you need to build a gem module.
xcode-select --install
After you've installed the package, give the install another go.
I guess you are using a .gemrc in your home directory, where you specify the gemhome. Instead of using a ~ for your home directory you should enter the complete path. In your example it should look as follow:
$ cat ~/.gemrc
gemhome: /Users/christian/.gem/
There must be some inconsistency between the ruby/gem tools. If you use a ~ in .gemrc, a subdirectory called /current/working/directory/~/.gem is created, while the extensions are put into your homes /home/user/.gem/ directory.

Cannot install Ruby with homebrew

I'm trying to install Ruby using Homebrew. When I run brew install ruby I get
Warning: The post-install step did not complete successfully
You can try again using 'brew postinstall ruby'
And when I try that it says
Error: Directory not empty - /usr/local/Cellar/ruby/2.1.2_1/lib/ruby/gems
So I tried deleting the contents of that folder and now it says
Error: undefined method `symlink' for #<Pathname:/usr/local/Cellar/ruby/2.1.2_1/lib/ruby/gems>
Does anyone know why this happening?
you can track the issue at ruby: Fix undefined method and directory not empty errors #29986 or follow the discussion link

hubris fails to install with: Missing C libraries: ruby, ruby, ruby

I am desperately trying to install Hubris but the installation fails whenever I run "cabal install".
Link to Hurbis:
https://github.com/mwotton/Hubris/tree/master/Haskell
Link to the Cabal file:
https://github.com/mwotton/Hubris/blob/master/Haskell/hubris.cabal
The cabal command that fails is:
cabal install --extra-include-dirs=/usr/include/ruby-1.9.1/x86_64-linux --extra-include-dirs=/usr/include/ruby-1.9.1 --extra-lib-dirs=/usr/lib --user --enable-shared --with-ghc=/usr/local/bin/ghc
The error message is:
Resolving dependencies...
Configuring hubris-0.0.4...
cabal: Missing dependencies on foreign libraries:
* Missing C libraries: ruby, ruby, ruby
This problem can usually be solved by installing the system packages that
provide these libraries (you may need the "-dev" versions). If the libraries
are already installed but in a non-standard location then you can use the
flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are.
cabal: Error: some packages failed to install:
hubris-0.0.4 failed during the configure step. The exception was:
ExitFailure 1
THE RAKE ERROR IS THE SAME:
+install -c tmp/x86_64-linux/stub/1.9.3/stub.so lib/stub.so
cabal: Missing dependencies on foreign libraries:
* Missing C libraries: ruby, ruby, ruby
This problem can usually be solved by installing the system packages that
provide these libraries (you may need the "-dev" versions). If the libraries
are already installed but in a non-standard location then you can use the
flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are.
cabal: Error: some packages failed to install:
hubris-0.0.4 failed during the configure step. The exception was:
ExitFailure 1
rake aborted!
ERROR: ran cabal update; cd Haskell; cabal install --extra-include-
dirs=/usr/include/ruby-1.9.1/x86_64-linux --extra-include-dirs=/usr/include/ruby-1.9.1 -
-extra-lib-dirs=/usr/lib --user --enable-shared --with-ghc=/usr/local/bin/ghc, got
Downloading the latest package list from hackage.haskell.org
I also installed 'ruby-dev', e.g.
apt-get install ruby1.9.1-dev
Probably the error is related to missing header files and wrong include directories when I run the cabal command.
.
System Configuration:
ubuntu 12.04
GHC version 7.4.1
ruby version 1.9.3p0
gem version 1.8.24
You should install Hubris using rake. Simply invoking rake in the root of the repository should work. The task that builds the library will find the relevant ruby include directories for you.
I had to make some changes to make the compile work with modern Haskell (E.g. Haskell Platform 2012.2.0.0). The changes are available at https://github.com/dflemstr/Hubris.
It works for me on Arch Linux:
Arch ... well it's rolling release, so there is no version number
GHC version 7.4.2
ruby version 1.9.3p194 (2012-04-20 revision 35410)
gem version 1.8.23
FINAL ANSWER!!! EVERYTHING WORKS!!!
The credit for the right answer goes to User 'dflemstr'. BUT look at this answer for some details, especially for Ubuntu Users. Credit also goes to Mark Wotton, as the install errors where mainly due to Haskell/Cabal and Ubuntu.
_
Requirements:
(tested with this setup, other version probably work too)
Ubuntu 12.04 (Arch Linux works too)
Ruby 1.9.3p0
GHC 7.4.1
Haskell Platform 2012.2.0.0
_
Ruby Installation
sudo apt-get install libruby1.9.1 libruby1.9.1-dbg libtcltk-ruby1.9.1 ruby1.9.1 ruby1.9.1-dev ruby1.9.1-examples ruby1.9.1-full rubybook rubygems
_
Gem Update System (optional)
sudo env REALLY_GEM_UPDATE_SYSTEM=1 gem update --system
_
Fix for Ubuntu
(error Missing C libraries: ruby, ruby, ruby)
cd /usr/lib
ln -s libruby-1.9.1.so ./libruby.so
_
GHC Installation
NOTE: I don't use any ubuntu packages for GHC and the haskell platform. Some people on stackoverflow recommend this.
http://www.haskell.org/ghc/download_ghc_7_4_1
(follow the instructions on the website)
_
Haskel Platform Installation
http://lambda.haskell.org/platform/download/2012.2.0.0/haskell-platform-2012.2.0.0.tar.gz
(again follow the instructions on the website)
.
_
Enable shared library support for haskell packages
Add the following line: "shared: True"
nano ~/.cabal/config
_
Reinstall every haskell package with shared support
Follow the instructions given in:
Building a haskell interpreter (hint) as dynamic library, useable from C++: Missing Interpreter.dyn_hi
Cabal rebuild all with enable-shared flag
NOTE: The above instructions did not work for me!!
In that case, manually reinstall every package by hand (!) with force:
cabal install hint-0.3.3.4 --reinstall --force-reinstall
Repeat with every installed package! e.g. also the mtl package, etc. You may get the same error with a package that is needed for the reinstallation. Just reinstall that package and any recursive dependencies.
If you install Hubris right away, i.e. skipping this step, you get the following error (only in ubuntu, not arch linux):
Language/Ruby/Hubris/LibraryBuilder.hs:13:8:
Could not find module `Control.Monad.Error.Class'
Perhaps you haven't installed the "dyn" libraries for package `mtl-2.0.1.0'?
Use -v to see a list of the files searched for.
cabal: Error: some packages failed to install:
Install needed haskell packages
cabal install c2hs
Install needed ruby packages
sudo gem install rake open4 rspec hoe
sudo gem install bundler
sudo gem install rake-compiler
sudo gem install rspec
Get Hurbis via github
git clone https://github.com/dflemstr/Hubris.git
(Note: This is just for now. As the changes are merged, the original github version from Mark Wotton should be pulled!)
Fix Rakefile to find GHC in ubuntu
Change "/usr/bin/ghc" to "/usr/local/bin/ghc":
cd Hubris
nano Rakefile
Run rake
cd Hubris
rake
If you get errors like "Perhaps you haven't installed the 'dyn' libraries for" here it is possibly due that some package are not reinstalled (see step: 'Reinstall every haskell package with shared support').
**Install Hubris*
cd Hubris
sudo rake install
Install rake
Fix permissions:
chmod -R 777 /var/hubris
NOTE: Don't use 777!! If you do, change later to 755 or 766, etc. This is just for testing!
This is needed because rake install is done with 'sudo' but the cabal packages are installed with a different user. Hubris compiles the haskell files in /var/hubris/ which is not accessible for a regular user unless you change the permissions.
Run test example
Add the following lines to "test.rb":
require 'hubris' # best line ever
class Target
hubris :inline =>"triple::Int->Int; triple n = 10*n"
end
t = Target.new
puts t.triple(3)
Execute test.rb:
ruby test.rb
Check if the result is okay:
The last three lines of the console output should be:
... many lines and possibly GHC error messages ...
|
error ||
30
If the last line is "30" then everything works!! Note that when you run the command a second time the inline haskell is not recompiled, therefore the output is much shorter, but the last line is still "30".
Final Words
Thanks to Mark Wotton for providing Hubris!! It is an excellent starting point to add new features to the library. Great that it is open source!

Not able to install a gem file?

Hi People I am trying to install a gem file through command prompt on MAC using the following command "gem install filename" but whenever I try to execute the command I get the following error
WARNING: Installing to ~/.gem since /Library/Ruby/Gems/1.8 and
/usr/bin aren't both writable.
WARNING: You don't have /Users/hemmanshu/.gem/ruby/1.8/bin in your PATH,
gem executables will not run.
ERROR: Error installing frank-cucumber-0.8.14:
cucumber requires gherkin (~> 2.10.0, runtime)
every time I try to execute this command the same thing pops up.
You need to install gems with superuser privileges so you should to use
sudo gem install [gemname]
instead of
gem install [gemname]
U try with sudo. like "sudo gem install filename"
...Most of the time this is a PATH issue, Suppose you are using zshell as me, then add this line at the end of ~/.zshrc file
export PATH="$PATH:$HOME/.gem/ruby/2.1.0/bin"
If you are using bash as default shell then add this line to end of ~/.bashrc file
export PATH="$PATH:$HOME/.gem/ruby/2.1.0/bin"
For your case it will be like this:
export PATH="$PATH:$HOME/.gem/ruby/1.8/bin
Lastly don't forget to reload the shell by source ~/.zshrc incase of z-shell or source ~/.bashrc incase of bash-shell. I think this helps someone.

Resources