I am using Ubuntu 20.0.4. Ruby version is:
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
Gem version is:
gem --version
3.1.4
I have installed imagemagick:
convert --version
Version: ImageMagick 6.9.10-23 Q16 x86_64
Then I installed required packages:
sudo apt-get install libmagickwand-dev
And then I installed Rmagick:
sudo gem install rmagick
Building native extensions. This could take a while...
Successfully installed rmagick-4.2.6
Parsing documentation for rmagick-4.2.6
Done installing documentation for rmagick after 0 seconds
1 gem installed
This shows that rmagick is installed but once I try to run command:
ruby pheno_gram.rb -i phenogram-sample.txt -g human_genome.txt -Y cytoBand-human.txt -c exhaustive -p proximity -f png -p equal -o plot_phenogram -t "New Image"
I get msg:
cannot load such file -- rvg/rvg
Please install RMagick -- See documentation for pheno_gram or http://rmagick.rubyforge.org/install-faq.html
It seems that I need to install ruby rvg library,so I tried to install it using command:
sudo snap install hello-rvg --candidate
But still getting same error. Secodly, Do I need to add rmagick path somewhere, if yes how can I do that?
I have also tried to install rmagick without sudo but it gives error:
gem install rmagick
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
current directory: /home/super/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/rmagick-4.2.6/ext/RMagick
/home/super/.rbenv/versions/2.7.2/bin/ruby -I /home/super/.rbenv/versions/2.7.2/lib/ruby/2.7.0 -r ./siteconf20220827-10097-72cju5.rb extconf.rb
checking for brew... no
checking for pacman... yes
checking for Ruby version >= 2.3.0... yes
checking for pkg-config... yes
checking for outdated ImageMagick version (<= 6.7.7)... no
checking for /home/super/miniconda3/bin/x86_64-conda-linux-gnu-cc... yes
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/super/.rbenv/versions/2.7.2/bin/$(RUBY_BASE_NAME)
/home/super/.rbenv/versions/2.7.2/lib/ruby/2.7.0/mkmf.rb:471:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /home/super/.rbenv/versions/2.7.2/lib/ruby/2.7.0/mkmf.rb:564:in `try_link0'
from /home/super/.rbenv/versions/2.7.2/lib/ruby/2.7.0/mkmf.rb:582:in `try_link'
from extconf.rb:79:in `configure_compile_options'
from extconf.rb:19:in `initialize'
from extconf.rb:405:in `new'
from extconf.rb:405:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/super/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/rmagick-4.2.6/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/super/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/rmagick-4.2.6 for inspection.
Results logged to /home/super/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/rmagick-4.2.6/gem_make.out
Any help will be highly appreciated.
It seems your problem is associated with your user role.
brute force possible solution: use sudo for running sudo ruby pheno_gram.rb -i phenogram-sample.txt -g human_genome.txt -Y cytoBand-human.txt -c exhaustive -p proximity -f png -p equal -o plot_phenogram -t "New Image"
check these out:
did you install your ruby with sudo user?
did you check what is ruby installation folder ownership? and your user are added to owner group?
with cmd sudo usermod -a -G <GROUP> $USER
Related
i tried for a few weeks to install mysql2 for ruby so i can use it with dashing. But the only thing i get is:
gem install mysql2 --platform=ruby -- '--with-mysql-dir="/usr/include/mysql"'
Building native extensions with: '--with-mysql-dir="/usr/include/mysql"'
This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-2.2.4/bin/ruby -r ./siteconf20160203-7890-abpifj.rb extconf.rb --with-mysql-dir="/usr/include/mysql"
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
-----
Cannot find include dir(s) /usr/include/mysql/include
-----
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/rvm/rubies/ruby-2.2.4/bin/$(RUBY_BASE_NAME)
--with-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
extconf failed, exit code 1
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.2.4/gems/mysql2-0.4.2 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.2.4/extensions/armv7l-linux/2.2.0/mysql2-0.4.2/gem_make.out
it is a Raspberry Pi 2 with Ruby 2.2.4 via RVM installed.
libmysqlclient-dev is installed.
mkmf.log tells me:
have_func: checking for rb_thread_blocking_region()... -------------------- no
"gcc -o conftest -I/usr/local/rvm/rubies/ruby-2.2.4/include/ruby-2.2.0/armv7l-linux-eabihf -I/usr/local/rvm/rubies/ruby-2.2.4/include/ruby-2.2.0/ruby/backward -I/usr/local/rvm/rubies/ruby-2.2.4/include/ruby-2.2.0 -I. -D_FILE_OFFSET_BITS=64$
conftest.c: In function ‘t’:
conftest.c:13:57: error: ‘rb_thread_blocking_region’ undeclared (first use in this function)
conftest.c:13:57: note: each undeclared identifier is reported only once for each function it appears in
conftest.c:13:32: warning: variable ‘p’ set but not used [-Wunused-but-set-variable]
It looks like there is a bug in the mysql2 gem you're trying to install.
Try install the previous stable version, 0.3.X
gem install mysql2 --platform=ruby -v '~> 0.3.0'
If that doesn't work, try update your Ruby version.
sudo apt-get install ruby2.2
Or, if you can, upgrade
sudo apt-get install ruby2.3
Install the raspbian specific package, before trying to get the gem this worked for me.
apt-get install ruby-mysql2
ruby new projectname -dmysql
I finally got around this error with the following:
apt-get install libmysql++-dev
you should
apt-get install libmariadbclient-dev
This question already has answers here:
Can't find the PostgreSQL client library (libpq)
(23 answers)
Closed 7 years ago.
I think I have tried all the suggestions I could find regarding this issue. Still not working for me.
When I try to bundle ...
$ bundle
...
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/local/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--with-pg
--without-pg
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
--with-ms/libpqlib
--without-ms/libpqlib
Gem files will remain installed in
...
An error occurred while installing pg (0.17.1), and Bundler cannot
continue.
Make sure that `gem install pg -v '0.17.1'` succeeds before
bundling.
Output from previous code...
$ which bundle
/Users/Loren/.rvm/gems/ruby-2.1.1#global/bin/bundle
$ which gem
/Users/Loren/.rvm/rubies/ruby-2.1.1/bin/gem
$ which psql
/usr/local/bin/psql
I tried to uninstall postgresql using Homebrew and reinstall and that didn't help.
I tried...
ARCHFLAGS="-arch x86_64" gem install pg
and that completes successfully but then when I run bundle I still get the same error.
I tried ...
gem install pg -- --with-pg-config=/Applications/Postgres93.app/Contents/MacOS/bin/pg_config
and that didn't work.
I tried ...
gem install pg -v '0.17.1' -- --with-pg-config=/usr/local/Cellar/postgresql/9.3.2/bin/pg_config
and that didn't work either.
I am not sure what else to try at this point.
Thanks for any help.
My solution ended up at this
ARCHFLAGS="-arch x86_64" bundle install
Based on this post's answer and it worked for me (Yosemite OSX 10.10), you can try the following:
$ sudo su
$ env ARCHFLAGS="-arch x86_64" gem install pg
You don't have to reinstall pg from homebrew.
sudo ARCHFLAGS="-arch x86_64" gem install pg
DID THE TRICK FOR ME...thanks for tip on a thread given by Jakob#github
My system: OSX 10.9.4, Ruby 2.0.0, local ( non-homebrew) Postgresql 9.3.5
Building native extensions. This could take a while...
Successfully installed pg-0.17.1
invalid options: -f fivefish
(invalid options are ignored)
Parsing documentation for pg-0.17.1
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for lib/pg_ext.bundle, skipping
Installing ri documentation for pg-0.17.1
1 gem installed
I uninstalled postgresql using home-brew ( I had used it to install postgresql before )
I installed the Postgres.app and this updated my PATH
I then had to stop the currently running postgresql db
I then was able to launch the Postgres.app and it started on port 5432
I then had to restart my terminal
Then I was able to run bundle and it worked.
In my particular instance I was trying to run bundle install on my first heroku app. I did all the items that #boobooninja listed (with slightly different paths, of course). What ended up working for me was a combination of two answers. I needed to
$ sudo su
$ env ARCHFLAGS="-arch x86_64" gem install pg -v '0.17.1'
By adding the -v 0.17.1 and specifying the version needed by heroku I was able to complete my bundle and proceed.
For ease of management and upgrading, etc. I have used the (PostgreSQL Application on my Mac with the following gem install (same as yours above).
gem install pg -- --with-pg-config=/Applications/Postgres__version__.app/Contents/MacOS/bin/pg_config
I have had no issues with this approach (versus a custom install or via Homebrew from which I have had a few problems).
Please make sure that you have the 'libpq-dev' package installed on your system
So try installing libpq-dev:
for Ubuntu systems: sudo apt-get install libpq-dev
on RHEL systems: yum install postgresql-devel
for Mac: brew install postgresql
Then install pg gem
$ gem install pg -v '0.17.1'
$ bundle
For me, the trick was to re-link Postgres 9.3.0
brew link postgresql
If you want to still be able to add gem 'pg' to your gemfile and use bundle install, and you know PostgreSQL and libpq-dev are installed (which I believe both should be since OS X ships with PostgreSQL) you need only tell your $PATH where to find pg_config. Try this:
$ ln -s /Library/PostgreSQL/9.1/bin/pg_config /usr/local/bin/pg_config
Make sure to replace 9.1 with whatever PostgreSQL version you have installed. And make sure wherever you're creating the link is in your $PATH. Once that's done, run bundle install to install the pg gem.
I have a problem installing my bundle.
These were my last steps:
git clone http:...
git checkout -b daniel
bundle install
The error I got was:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native
extension.
/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby extconf.rb checking for main() in -lpthread... yes checking for main() in
-lobjc... yes
*** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check
the mkmf.log file for more details. You may need configuration
options.
Provided configuration options: --with-opt-dir --without-opt-dir
--with-opt-include --without-opt-include=${opt-dir}/include
--with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog
--without-make-prog --srcdir=. --curdir
--ruby=/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby
--with-pthreadlib --without-pthreadlib --with-objclib
--without-objclib --enable-debug --disable-debug
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0/ext/v8/build.rb:50:in
`build_with_rubygem_libv8': undefined local variable or method
`libv8_include_flags' for main:Object (NameError) from
extconf.rb:20:in `<main>'
Gem files will remain installed in
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0 for
inspection. Results logged to
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0/ext/v8/gem_make.out
An error occurred while installing therubyracer (0.11.0), and Bundler
cannot continue. Make sure that `gem install therubyracer -v '0.11.0'`
succeeds before bundling.
When I tried to run gem install therubyracer -v '0.11.0' I got:
Building native extensions. This could take a while... ERROR: Error
installing therubyracer: ERROR: Failed to build gem native extension.
/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby extconf.rb checking for main() in -lpthread... yes checking for main() in
-lobjc... yes
*** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check
the mkmf.log file for more details. You may need configuration
options.
Provided configuration options: --with-opt-dir --without-opt-dir
--with-opt-include --without-opt-include=${opt-dir}/include
--with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog
--without-make-prog --srcdir=. --curdir
--ruby=/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby
--with-pthreadlib --without-pthreadlib --with-objclib
--without-objclib --enable-debug --disable-debug
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0/ext/v8/build.rb:50:in
`build_with_rubygem_libv8': undefined local variable or method
`libv8_include_flags' for main:Object (NameError) from
extconf.rb:20:in `<main>'
Gem files will remain installed in
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0 for
inspection. Results logged to
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0/ext/v8/gem_make.out
I am working on Mac OS 10.7.5. Xcode and its command line tools and Rails are up to date.
SQLite 3 is also installed.
Can anyone help me?
EDIT:
I also tried to delete the repository and to clone it again, with the same errors.
EDIT:
Is the installation path of Rails and Sqlite3 correct?
daniel:~
daniel$ sudo gem update --system Latest version currently
installed. Aborting.
daniel:~
daniel$ sudo gem install rails
Fetching:
rails-3.2.11.gem (100%) Successfully installed
rails-3.2.11 1 gem installed
Installing ri documentation for rails-3.2.11...
Installing RDoc documentation for rails-3.2.11...
daniel:~
daniel$ sudo gem install sqlite3
Fetching: sqlite3-1.3.7.gem (100%)
Building native extensions. This could take a while...
Successfully installed sqlite3-1.3.7 1 gem installed
Installing ri documentation for sqlite3-1.3.7...
Installing RDoc documentation for sqlite3-1.3.7...
daniel:~
daniel$ which ruby irb gem rake
/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby
/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/irb
/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/gem
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/bin/rake
At least one problem is that you are running RVM, but used sudo to install gems on your system.
Read "RVM and RubyGems", especially the part that says:
"DO NOT use sudo..."
RVM creates a sandbox for you, the user, in your own user-space on a machine, that allows you to manage it without needing to be the system administrator. In other words, that means you don't have to use sudo for any RVM or gems management.
If you do use sudo, you temporarily cease being you, the user, and become the administrator, with administrator privileges and the administrator's environment, which does NOT include the RVM sandbox in your /Users/daniel/.rvm/rubies/ruby-1.9.3-p286 path. Knowledge of the sandbox is carried by the PATH in your environment, which the root on your machine doesn't use. Gems installed inside that sudo sub-shell get installed into the location that the administrator account knows about, which is inside the System Ruby installation, which is why your RVM sandboxed Ruby doesn't see them: There is no crossover between the System's Ruby and your RVM-controlled RUby. That's the whole idea of a sandbox: separation of the elements and resources to avoid contamination.
You could have figured this all out by looking at the output of:
which ruby irb gem rake
The path for all of them is pointing to your sandbox:
/Users/daniel/.rvm/rubies
On a Mac OS system, that command should have reported:
/usr/bin/ruby
/usr/bin/irb
/usr/bin/gem
/usr/bin/rake
Reinstall Rails and the SQLite gem using:
gem install rails sqlite3
and see how your bundle behaves.
And, by the way, do NOT use sudo to deliberately try to manage/delete the System installed Ruby. That was installed by Apple for their own purposes, to enable software they installed. It's OK to take advantage of its existence, but it's there for their use. Use a RVM-managed Ruby for your own purposes.
I'm running an instance built off ami-595a0a1c which is Amazon's customized Linux. I am trying to install the sqlite3 (or sqlite) gem and it's failing with the below error:
$ sudo gem install sqlite3
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite3-devel' and check your shared library search path
(the
location where your sqlite3 shared library is located).
extconf.rb failed *
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for
more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/sqlite3-1.3.3 for inspection. Results logged to /usr/lib64/ruby/gems/1.8/gems/sqlite3-1.3.3/ext/sqlite3/gem_make.out
Typically, this just means you need to install the development libraries and everything is cool. However, I have installed the sqlite-devel packages and still no dice. Since this is the Amazon Linux instance, I'd rather not add more repositories than the ones Amazon provides if possible. What can i do to get this thing to compile? Thanks for any insight!
From a brand new instance, here's what I've done:
$ sudo yum install rubygems ruby-devel
$ sudo gem update --system
$ sudo gem install rails
$ rails new app
$ cd app
$ rails server
Could not find gem 'sqlite3 (>= 0)' in any of the gem sources listed in your Gemfile.
$ sudo yum install sqlite-devel
$ sudo gem install sqlite (or sqlite3 -- same result)
See breakage above. And note - I do realize I can comment out the line in the gemfile to get rails to run but I actually need the gem. Thanks in advance!
Ran into this as well. Surprisingly the stock amazon linux doesn't have make or gcc installed.
sudo yum install gcc
sudo yum install make
$ sudo yum install libsqlite3-dev
Note the version 3.
Or if the package is available in your OS install libsqlite3-ruby
I'm trying to install the gem dm-mysql-adapter with the following
command:
gem install dm-mysql-adapter -- --with-mysql-config=/usr/bin/mysql
--with-mysql-lib=/usr/lib/mysql
and got this result:
Building native extensions. This could take a while...
ERROR: Error installing dm-mysql-adapter:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb --with-mysql-config=/usr/bin/mysql
--with-mysql-lib=/usr/lib/mysql
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby
--with-mysql-config
extconf.rb:43:in `': undefined method `split' for nil:NilClass
(NoMethodError)
Gem files will remain installed in
/usr/local/lib/ruby/gems/1.9.1/gems/do_mysql-0.10.2 for inspection.
Results logged to
/usr/local/lib/ruby/gems/1.9.1/gems/do_mysql-0.10.2/ext/do_mysql/gem_make.out
Has anyone experience the same problem? What should I do to fix this?
Thanks!
I had this exact same problem. I'm on OS X 10.6 with the latest MySQL 5.1 package from dev.mysql.com.
Anyway, it turns out the fix was really simple, I just needed to add the mysql bin directory to my path:
$ export PATH=$PATH:/usr/local/mysql/bin
Then, from the same command prompt (because the path only gets changed for that session), I installed the gem with the following command:
sudo sudo env ARCHFLAGS="-arch x86_64" gem install dm-mysql-adapter
I appreciate that this question is 3 months old, but this page is the top hit for 'can't install dm-mysql-adapter on osx', and hopefully this will help somebody out.
On Mac Big Sur (11.6.2), first running
brew install mysql
and then runnimg the gem command worked for me.
In my case I had to install mysql-client first. At the end of install brew tells where /bin is - you may need to replace it
brew install mysql-client
export PATH=$PATH:/usr/local/opt/mysql-client/bin
gem install mysql2
I got a similar error when running gem install mysql2 -v 0.5.4 on Manjaro.
I solved it by running sudo pacman -S mysql