I am deploying Rails app using Capistrano to Centos VPS. On my VPS I can gem install pg, however when I run cap staging deploy, the process failed due to
An error occurred while installing pg (0.17.1), and Bundler cannot continue.
DEBUG[07a4f16d] Make sure that `gem install pg -v '0.17.1'` succeeds before bundling.
When the command 'cd /var/www/projectx/releases/20141117004357 && /usr/local/rvm/bin/rvm default do bundle install --binstubs /var/www/projectx/shared/bin --path /var/www/projectx/shared/bundle --without development test --deployment --quiet'
So on the VPS I can install pg gem globally, but it failed when it trys to run bundle in my release directory cd /var/www/projectx/releases/20141117004357
The error :
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-2.1.0/bin/ruby -r ./siteconf20141116-8316-zgkk04.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.
Is it caused by --with-pg-config=/opt/local/lib/postgresql91/bin/pg_config, my pg_config is is a different location, how do I change this?
any idea?
Thanks
Related
I'm running bundle install and it failed in the middle with the error:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/Mahmoud/dev-reps/non-docker/normal/vendor/bundle/ruby/2.5.0/gems/puma-4.3.1/ext/puma_http11
/Users/Mahmoud/.rbenv/versions/2.5.5/bin/ruby -r ./siteconf20220308-96584-8zjcoy.rb extconf.rb --with-cppflags=-I/usr/local/opt/openssl/include
checking for BIO_read() in -lcrypto... yes
...
...
An error occurred while installing puma (4.3.1), and Bundler cannot continue.
Make sure that `gem install puma -v '4.3.1' --source 'http://rubygems.org/'` succeeds before bundling.
After some failures to install puma, and after much searching and many trials, I was able to install it through:
gem install puma:4.3.1 -- --with-cflags="-Wno-error=implicit-function-declaration"
and the gem installed successfully, giving:
Building native extensions with: '--with-cflags=-Wno-error=implicit-function-declaration'
This could take a while...
Successfully installed puma-4.3.1
Parsing documentation for puma-4.3.1
Done installing documentation for puma after 0 seconds
1 gem installed
My problem currently is that trying bundle install again still fails with the same error. Tried restarting terminal, but still same. It's as if puma has not been installed at all. What am I doing wrong?
Finally got bundle to work using:
bundle config build.puma --with-cflags="-Wno-error=implicit-function-declaration"
from this answer here
Getting the following error on bundle install during deployment with capistrano3
I have atomic gem in my Gemfile.lock with the specific version it asks me to install.
atomic (1.1.16) and having manually installed in my ec2 machine too. But during deployment it repeatedly says the following.
$cap development deploy
INFO [44c32ab1] Running ~/.rvm/bin/rvm default do bundle install --binstubs /home/ec2-user/apps/dev/shared/bin --path /home/ec2-user/apps/dev/shared/bundle --without development test --deployment --quiet on 54.201.16.12
DEBUG [44c32ab1] Command: cd /home/ec2-user/apps/dev/releases/20140423071010 && ~/.rvm/bin/rvm default do bundle install --binstubs /home/ec2-user/apps/dev/shared/bin --path /home/ec2-user/apps/ybench_dev/shared/bundle --without development test --deployment --quiet
DEBUG [44c32ab1] Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
DEBUG [44c32ab1]
DEBUG [44c32ab1] /home/ec2-user/.rvm/rubies/ruby-2.1.0/bin/ruby extconf.rb
DEBUG [44c32ab1] Cannot allocate memory - /home/ec2-user/.rvm/rubies/ruby-2.1.0/bin/ruby extconf.rb 2>&1
DEBUG [44c32ab1]
DEBUG [44c32ab1] Gem files will remain installed in /home/ec2-user/apps/dev/shared/bundle/ruby/2.1.0/gems/atomic-1.1.16 for inspection.
DEBUG [44c32ab1] Results logged to /home/ec2-user/apps/dev/shared/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0/atomic-1.1.16/gem_make.out
DEBUG [44c32ab1] An error occurred while installing atomic (1.1.16), and Bundler cannot continue.
DEBUG [44c32ab1] Make sure that `gem install atomic -v '1.1.16'` succeeds before bundling.
cap aborted!
Try this.
https://github.com/classmethod-aws/ec2-swap
ec2-swap: create and swapon swap image on EC2 instance store ec2-swap
is an RPM package project to create and swapon an swap image on EC2
instance store on Linux boot sequence.
I am trying to install ruby but everytime sudo bundle --without production the installation crash when it comes to therubyracer:
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 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.
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/therubyracer-0.9.10 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/therubyracer-0.9.10/ext/v8/gem_make.out
An error occurred while installing therubyracer (0.9.10), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.9.10'` succeeds before bundling.
Is there any way to make this work?
Thanks
I'm trying to bundle a new rails app using Postgres.
I get this error each time I try to bundle.
Errno::EACCES: Permission denied - /usr/local/var/rbenv/versions/2.0.0- p353/lib/ruby/gems/2.0.0/gems/pg-0.17.0/.gemtest
An error occurred while installing pg (0.17.0), and Bundler cannot continue.
Make sure that `gem install pg -v '0.17.0'` succeeds before bundling.
When I try to install the pg gem with sudo it says:
➜ wandrr sudo gem install pg -v '0.17.0'
Password:
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/usr/local/var/rbenv/versions/2.0.0-p353/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.
I've read pg app's documentation and still not sure.
My zshrc file looks like this
# Customize to your needs...
PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
export RBENV_ROOT=/usr/local/var/rbenv
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
I used homebrew to install rbenv and ruby-build.
I've check ruby gems is up to date aswel.
Any suggestions on how to get the pg gem to succeed?
SOLUTION FOUND
My initial problem of trying to get gem install pg to work was due to the postgres app not working right. The problem was fixed by checking the path set in my ZSHRC file.
Here's what it looks like now:
# Customize to your needs...
PATH=/Applications/Postgres93.app/Contents/MacOS/bin:$PATH
eval "$(rbenv init -)";
Note: the docs said to use
PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
however the application in this instance is called Postgres93.app
I'm using a bitnami ruby stack appliance, and trying to set up capistrano to deploy my app from my MS windows laptop to the appliance. During the bundle install portion the deployment fails when native extensions can't be built. This happens for nokogiri and pg gems so far.
For example:
* ←[33mexecuting "cd /opt/bitnami/projects/melvin/releases/20130826221225 && bundle
install --gemfile /opt/bitnami/projects/melvin/releases/20130826221225/Gemfile --path
/opt/bitnami/projects/melvin/shared/bundle --deployment --quiet --without development
test"←[0m
produces:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/opt/bitnami/ruby/bin/ruby extconf.rb --with-pg-config=/usr/pgsql-9.2/bin/pg_config
Using config values from /usr/pgsql-9.2/bin/pg_config
sh: 1: /usr/pgsql-9.2/bin/pg_config: not found
sh: 1: /usr/pgsql-9.2/bin/pg_config: not found
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.
But if I open a terminal and ssh in, and issue gem install pg -v '0.16.0' it works fine.
So what is different about what I'm doing from the ssh terminal, and what capistrano is doing (presumably from the same ssh connection)?
I've edited the PATH in my .bashrc to use the same PATH as in the bitnami console.
Anyone ever used capistrano to deploy to a bitnami ruby stack appliance (ubuntu 12.04 I think)?
UPDATE ---
I just tried cap deploy -d and aborted the deploy just before it rm's the release directory. Then I used my ssh terminal and went to the release directory and issued "sudo bundle install" which also gave the error above. So maybe it's not a difference between capistrano and manual ssh, but it must be something in the release directory, since "sudo gem install 'pg'" works, which doesn't matter which directory I'm in.
Also, because I can get the gem to install means the necessary libraries, etc. are installed on my machine somewhere - but bundler seems to have trouble accessing them.
So I'm thinking this is a bundler issue not a capistrano issue, maybe?
Confirmed, I'm bypassing capistrano and it's a problem with bundler.
So why would gem install pg -v '0.16.0' work but bundle install not?
MORE ---
So, bundle install --system works. Then I can do a bundle install --local.
But a bundle install --local --deployment fails, 'could not find pg-0.16.0 in any of the sources'. I don't understand what that means, it's on the system and shows up in a 'gem list'.
I wonder if there's a way to force capistrano to do this?