I've been all over trying all sorts of solutions so I'd appreciate any help.
I have the following PostgreSQL items installed:
postgresql96.x86_64 - 9.6.12-1PGDG.rhel6
postgresql96-devel.x86_64 - 9.6.12-1PGDG.rhel6
postgresql96-libs.x86_64 - 9.6.12-1PGDG.rhel6
postgresql96-server.x86_64 - 9.6.12-1PGDG.rhel6
When I run bundle install, I get the following error:
Installing pg 1.1.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/home/admin/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/pg-1.1.4/ext
/home/admin/.rbenv/versions/2.6.1/bin/ruby -I
/home/admin/.rbenv/versions/2.6.1/lib/ruby/2.6.0 -r ./siteconf20190502-8579-10nqtt0.rb extconf.rb
--with-pg-config\=/opt/local/lib/postgresql91/bin/pg_config
Using config values from /opt/local/lib/postgresql91/bin/pg_config
sh: /opt/local/lib/postgresql91/bin/pg_config: No such file or directory
sh: /opt/local/lib/postgresql91/bin/pg_config: No such file or directory
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** 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.
A large majority of the guides say that we need to install the devel and libs packages but they are already installed. I am using CentOS 6.
Thanks!
Also I should add that I'm using yum as my package manager, thanks.
I am pretty sure you need the postgres client tools also... when compiling postgres on the server. You should install the devel packages for postgres server and the command line tools.
Looks like for CentOS libpq-fe.h header comes with postgresql-devel:
yum install postgresql-devel
Ref https://stackoverflow.com/a/6040822/4950680
Related
I am using cloud9.
I want to use gem 'rmagick', but using bundle, following error message occurs...
please help...
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/usr/local/rvm/gems/ruby-2.4.0/gems/rmagick-2.16.0/ext/RMagick
/usr/local/rvm/rubies/ruby-2.4.0/bin/ruby -r
./siteconf20180204-XXXXXX-oyXXpq.rb extconf.rb checking for gcc... yes
checking for Magick-config... no checking for pkg-config... yes
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc' to the
PKG_CONFIG_PATH environment variable No package 'MagickCore' found
checking for outdated ImageMagick version (<= 6.4.9)... * 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.
I just spun up a Cloud9 VM and tried it.
My Cloud9 VM I tried used yum as a package manager. Meaning I installed ImageMagick via sudo yum install ImageMagick-devel... when I did that my gem install rmagick worked.
Didn't try it with Bundler, but if gem install works then it should work in Bundler also.
Using the command prompt install/update imagemagick via
sudo apt-get update
Then
sudo apt-get install imagemagick
See more
Hope it helps
I cloned my code from git to my Windows machine and when I run bundle install, I am getting this error:
An error occurred while installing rmagick (2.13.4), and Bundler
cannot continue. Make sure that gem install rmagick -v '2.13.4'
succeeds before bundling.
D:\project\MyProject2>gem install rmagick -v '2.13.4'
Temporarily enhancing PATH to include DevKit... Building native
extensions. This could take a while... ERROR: Error installing
rmagick:
ERROR: Failed to build gem native extension.
D:/RailsInstaller/Ruby2.2.0/bin/ruby.exe -r ./siteconf20160721-7208-bn9t3e.rb extconf.rb checking for Ruby version
= 1.8.5... yes Invalid drive specification. Unable to get ImageMagick version
* 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.
I tried downloading ImageMagick, and set environment paths as:
CPATH=D:\ImageMagick-6.9.5-Q8\include
LIBRARY_PATH=D:\ImageMagick-6.9.5-Q8\lib
and run bundle install but no use and also tried running
gem install rmagick -v '2.13.4' --platform=ruby -- --with-opt-lib=D:\ImageMagick-6.9.5-Q8\lib --with-opt-include=D:\ImageMagick-6.9.5-Q8\include
it is showing:
Unable to get ImageMagick version
* 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.
Please help.
I had this same issue myself until I finally stumbled upon the answer on Stackoverflow here and here.
Basically you need to follow these steps:
Install DevKit. Since I used RailsInstaller to install Ruby on Rails on my laptop, it was already included in the default directory ‘C:\Serever\RailsInstaller\DevKit‘. Otherwise, find the .exe at the RubyInstallers downloads.
Install ImageMagick-6.9.5-9-Q16-x86-dll.exe from imagemagick.org. It seems that rmagik2.16 only supports ImageMagick 6, not ImageMagick 7.
Make sure that you install the correct version of ImageMagick x86 or x32. If you are unsure what ruby version you have install try this command: ruby -e "puts 1.size". It print 4 if x86 and 8 if x64. answer from here
Check the following options on the install screen (more info on the redmine website) :
[v] Add application directory to your system path
[v] Install development headers and libraries for C and C++
Setup in windows environment variables the PATH variable to include the path to ImageMagick. In my case: C:\Server\ImageMagick\. Make sure it is the first variable in the variables list, or you may encounter an “Invalid drive specification” error when extconf.rb tries to identify the ImageMagick version.
cd C:\YourRubyProject. Example: C:\Server\htdocs\dev-ruby\redmine.
Set CPATH and LIBRARY_PATH environment variables to point respectively to ImageMagick installation directory include and lib subdirectories (so the DevKit will find them at build time)
Open C:\Serever\RailsInstaller\DevKit\msys.bat. More details here
Run gem install rmagick --platform=ruby -- --with-opt-lib=C:/Server/ImageMagick/lib --with-opt-include=C:/Server/ImageMagick/include. Adjust paths as necessary for your project.
Finally, run bundle install, or if necessary bundle update
Note: for those that are looking to install redmine in xampp follow this tutorial. If you get stuck on installing the rmagick lib, return here to this answer and follow the provided steps.
I am using Ruby 1.9.3 and therefore have to use an older version of Nokogiri. I need to install Nokogiri v1.5.10.
Initially I got an error that libxml2 is missing. After installing libxml2 I got the following error:
ERROR: Error installing nokogiri-1.5.10.gem:
ERROR: Failed to build gem native extension.
/opt/ruby-1.9.3/bin/ruby extconf.rb
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... no
-----
libxslt is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** 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.
Do I need to install each and every dependency manually?
If so, how do i determine what version to use?
NOTE: The server does not have access to the internet. Therefore, I have to scp rpm or tar files to install.
Unfortunately yes, you will need to install each dependency manually with that version of Nokogiri as I don't believe they packaged the dependencies in until version 1.6.0.rc1.
Trying to get Ruby 2.0.0 running on CentOS 6.5 with nginx and Passenger. So far, having no luck due to the error: http://prntscr.com/3egoca
This is the process I used for installing the PostgreSQL server for use with Ruby:
sudo vi /etc/yum.repos.d/CentOS-Base.repo
# In both [base] and [updates] sections I added the following line to the file above:
# exclude=postgresql*
sudo rpm -Uvh http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm
sudo yum install postgresql93 postgresql93-devel postgresql93-server postgresql93-libs postgresql93-contrib
sudo /etc/init.d/postgresql-9.3 initdb
sudo service postgresql-9.3 start
sudo chkconfig --levels 235 postgresql-9.3 on
# At the bottom of this file I changed authentication method to md5:
sudo vi /var/lib/pgsql/9.3/data/pg_hba.conf
sudo service postgresql-9.3 restart
So far so good and PostgreSQL works as expected when tested, but then this is where it fails:
bundle install
This gives me the error:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/home/deploy/.rvm/rubies/ruby-2.0.0-p451/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** 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.
So I followed that advice and tried installing the PG gem separately like so:
gem install pg -- --with-pg-config=/usr/pgsql-9.3/bin/pg_config
When I try that, I get this output:
Building native extensions with: '--with-pg-config=/usr/pgsql-9.3/bin/pg_config'
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 "\xF0" from ASCII-8BIT to UTF-8 for ../../extensions/x86_64-linux/2.0.0/pg-0.17.1/pg_ext.so, skipping
unable to convert "\xF0" from ASCII-8BIT to UTF-8 for lib/pg_ext.so, skipping
1 gem installed
Despite saying it successfully installed I still get the Passenger error I posted a screenshot of and I still can't get bundle install to run successfully.
BTW, I am SSH'd in as user 'deploy' which is what nginx is also set as the user in the nginx.conf file.
Try:
export PATH=/usr/pgsql-9.3/bin:$PATH
bundle install
I have tried installing the packet libpq-dev, and installing postgresql, but bundle install still fails due to gem pg. This is the error I get:
$ gem install pg -v '0.15.1'
Building native extensions. This could take a while...
/.rvm/rubies/ruby-1.9.3-
p484/lib/ruby/site_ruby/1.9.1/rubygems/ext/builder.rb:73: warning: Insecure
world writable dir /usr/local in PATH, mode 040777
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/.rvm/rubies/ruby-1.9.3-p484/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again
with --with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** 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.
What is a proper way to clean up the mess?
If you are on Mac, install Homebrew and then install Postgres using the command
brew install postgresql
Or you can download and install Postgres from here depending on which OS you are using.
There isn't any "mess" - it's a standard issue where your system does not have the required libraries to install the gem
Library
As mentioned in the comments, you first need to install PGSQL, which will create the required library files to help the gem install, after that you can use some path references to help the gem install:
gem install pg -- --with-pg-dir="C:/Program Files/installer