Problem installing tiny_tds gem in rails 3 - sql-server

I have succesfully installed free_tds on my mac and can use tsql to access the db and query tables.
However when I try to use the gem tiny_tds gem on rails 3 I get the following error:
Installing tiny_tds (0.4.5) with native extensions /Users/gugguson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:552:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/Users/gugguson/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
extconf.rb:12: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
looking for library directory /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#rails31/lib ... no
looking for library directory /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#rails31/lib/freetds ... no
looking for library directory /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#global/lib ... no
looking for library directory /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#global/lib/freetds ... no
looking for library directory /Users/gugguson/.rvm/rubies/ruby-1.9.2-p290/lib ... yes
checking for main() in -lsybdb... no
looking for library directory /Users/gugguson/.rvm/rubies/ruby-1.9.2-p290/lib/freetds ... no
looking for library directory /Users/gugguson/.rvm/lib ... yes
checking for main() in -lsybdb... no
looking for library directory /Users/gugguson/.rvm/lib/freetds ... no
looking for library directory /usr/lib ... yes
checking for main() in -lsybdb... no
looking for library directory /usr/lib/freetds ... no
looking for library directory /usr/local/lib ... yes
checking for main() in -lsybdb... no
looking for library directory /usr/local/lib/freetds ... no
looking for library directory /usr/X11/lib ... yes
checking for main() in -lsybdb... no
-----
Can not find FreeTDS's db-lib or include directory.
-----
*** 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/gugguson/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
--enable-iconv
--disable-iconv
--enable-iconv
--disable-iconv
--with-freetds-dir
--without-freetds-dir
--with-freetds-include
--without-freetds-include=${freetds-dir}/include
--with-freetds-lib
--without-freetds-lib=${freetds-dir}/lib
--enable-lookup
--disable-lookup
--with-sybdblib
--without-sybdblib
--with-sybdblib
--without-sybdblib
--with-sybdblib
--without-sybdblib
--with-sybdblib
--without-sybdblib
--with-sybdblib
--without-sybdblib
looking for library directory /usr/X11/lib/freetds ... no
Gem files will remain installed in /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#rails31/gems/tiny_tds-0.4.5 for inspection.
Results logged to /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#rails31/gems/tiny_tds-0.4.5/ext/tiny_tds/gem_make.out
from /Users/gugguson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:530:in `block in build_extensions'
from /Users/gugguson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:505:in `each'
from /Users/gugguson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:505:in `build_extensions'
from /Users/gugguson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:180:in `install'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#rails31/gems/bundler-1.0.15/lib/bundler/source.rb:101:in `block in install'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#rails31/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:78:in `preserve_paths'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#rails31/gems/bundler-1.0.15/lib/bundler/source.rb:91:in `install'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#rails31/gems/bundler-1.0.15/lib/bundler/installer.rb:58:in `block (2 levels) in run'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#rails31/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:93:in `with_build_args'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#rails31/gems/bundler-1.0.15/lib/bundler/installer.rb:57:in `block in run'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#rails31/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `block in each'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#rails31/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `each'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#rails31/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `each'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#rails31/gems/bundler-1.0.15/lib/bundler/installer.rb:49:in `run'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#rails31/gems/bundler-1.0.15/lib/bundler/installer.rb:8:in `install'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#rails31/gems/bundler-1.0.15/lib/bundler/cli.rb:270:in `update'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#rails31/gems/bundler-1.0.15/lib/bundler/vendor/thor/task.rb:22:in `run'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#rails31/gems/bundler-1.0.15/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#rails31/gems/bundler-1.0.15/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#rails31/gems/bundler-1.0.15/lib/bundler/vendor/thor/base.rb:389:in `start'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#rails31/gems/bundler-1.0.15/bin/bundle:13:in `<top (required)>'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#rails31/bin/bundle:19:in `load'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290#rails31/bin/bundle:19:in `<main>'
Does anybody know what can be causing this?

The message Can not find FreeTDS's db-lib or include directory says that you have to install FreeTDS.
If you are using Homebrew you can easily install FreeTDS like this:
brew install freetds
Hope it helps.

Or in linux install FreeTDS like this:
sudo apt-get install freetds-dev
:)

Related

Installing compass or FFI not working

I've tried installing compass and ffi on osx but get the same error.
I've reconfigured and reinstalled ruby, I've installed Xcode command line tools, I've rebooted my machine, nothing seems to fix the exact same error every single time. I'm about to wipe my machine and start anew, I have no idea why I can't get past this error when trying gem install compass:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20160508-18749-v694wb.rb extconf.rb
checking for ffi.h... *** 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-ffi_c-dir
--without-ffi_c-dir
--with-ffi_c-include
--without-ffi_c-include=${ffi_c-dir}/include
--with-ffi_c-lib
--without-ffi_c-lib=${ffi_c-dir}/
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `block in try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:502:in `with_werror'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:1038:in `block in have_header'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:889:in `block in checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:888:in `checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:1037:in `have_header'
from extconf.rb:16:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Library/Ruby/Gems/2.0.0/extensions/universal-darwin-15/2.0.0/ffi-1.9.10/mkmf.log
extconf failed, exit code 1

How to use selenium-webdriver to automate CEF3 application

I'm using selenium-webdriver to automate a CefSharp (CEF3) based application, but kept getting errors.
I use the following Ruby scripts to launch the CEF application:
require "selenium-webdriver"
cefpath = 'C:\mypathto\cefapp.exe'
Selenium::WebDriver::Chrome.path = cefpath
browser = Selenium::WebDriver.for :chrome
......
When running it, it does open the CEF application (a container of Chrome), but then gets stuck with the following error:
C:/Ruby200/lib/ruby/2.0.0/net/protocol.rb:158:in `rescue in rbuf_fill': Net::ReadTimeout (Net::ReadTimeout)
from C:/Ruby200/lib/ruby/2.0.0/net/protocol.rb:152:in `rbuf_fill'
from C:/Ruby200/lib/ruby/2.0.0/net/protocol.rb:134:in `readuntil'
from C:/Ruby200/lib/ruby/2.0.0/net/protocol.rb:144:in `readline'
from C:/Ruby200/lib/ruby/2.0.0/net/http/response.rb:39:in `read_status_line'
from C:/Ruby200/lib/ruby/2.0.0/net/http/response.rb:28:in `read_new'
from C:/Ruby200/lib/ruby/2.0.0/net/http.rb:1406:in `block in transport_request'
from C:/Ruby200/lib/ruby/2.0.0/net/http.rb:1403:in `catch'
from C:/Ruby200/lib/ruby/2.0.0/net/http.rb:1403:in `transport_request'
from C:/Ruby200/lib/ruby/2.0.0/net/http.rb:1376:in `request'
from C:/Ruby200/lib/ruby/2.0.0/net/http.rb:1369:in `block in request'
from C:/Ruby200/lib/ruby/2.0.0/net/http.rb:852:in `start'
from C:/Ruby200/lib/ruby/2.0.0/net/http.rb:1367:in `request'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/remote/http/default.rb:83:in `response_for'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/remote/http/default.rb:39:in `request'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/remote/bridge.rb:634:in `raw_execute'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/remote/bridge.rb:99:in `create_session'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/remote/bridge.rb:68:in `initialize'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/chrome/bridge.rb:29:in `initialize'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/common/driver.rb:37:in `new'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/common/driver.rb:37:in `for'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver.rb:67:in `for'
Any idea why?
Thanks a lot.
Make sure you use an up-to-date ChromiumDriver/Selenium versions. According to this:
https://code.google.com/p/chromiumembedded/wiki/UsingChromeDriver
CEF works fine with ChromeDriver version 2.14 and Selenium 2.44.0.

Vagrant Error, The box failed to unpackage properly

I have a question for help that I could not find on any of these topics already.
I am trying to implement vagrant against my pre-existing virtual box. Most of the topics online right now are referring to using a box from vagrant cloud, or building one from scratch etc. My issue is I have an already built virtual box using Virtualbox as the provider specifically 1.4.3 as the version. The box is 124GB so remaking it is not exactly ideal. I have the vagrant config file set to locate the virtual box at path /users/desktop/foldername/filename.vbox. Every time it tries to add the box I get the error
"The box failed to unpackage properly. Please verify that the box file you're trying to add is not corrupted and try again. The output from attemtping to unpackage (if any):
Bsdtar: Error opening archive: Unrecognized archive format."
My knowledge is that this is because Vagrant is looking to add a .tar file and the file is not a tar extension.
Your supposed to be able to configure vagrant file to recognize the provider which I have done as well. Mine is set to
config.vm.provider "virtualbox" do |vb|
vb.gui = true
end
But no matter what I try I'm always getting the error above.
One thing to note is I'm not sure how to go about providing the metadata.json file, or how I can find that to edit it. Perhaps that is my problem? I have the latest version of vagrant so that is not the issue.
Any assistance would be greatly appreciated.
I have tried the vagrant package and below is my error I'm getting Please see if you may be able to provide further assistance.
I tried what you have suggested and here is the error message that I'm getting. I greatly appreciate your help.
nokeys$ vagrant package --base Dev_Clonea --output /users/nokeys/desktop/Dev_Clone/Dev_Clone.vbox
/Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:306:in `id=': undefined method `children' for nil:NilClass (NoMethodError)
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:438:in `state'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/plugins/providers/virtualbox/action/created.rb:11:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/warden.rb:34:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/builder.rb:116:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/runner.rb:66:in `block in run'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/util/busy.rb:19:in `busy'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/runner.rb:66:in `run'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/builtin/call.rb:43:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/warden.rb:34:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/warden.rb:34:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/builder.rb:116:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/runner.rb:66:in `block in run'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/util/busy.rb:19:in `busy'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/runner.rb:66:in `run'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:196:in `action_raw'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:173:in `block in action'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/environment.rb:434:in `lock'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:161:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:161:in `action'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/plugins/commands/package/command.rb:83:in `package_vm'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/plugins/commands/package/command.rb:66:in `package_base'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/plugins/commands/package/command.rb:42:in `execute'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/cli.rb:42:in `execute'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/environment.rb:252:in `cli'
from /Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/bin/vagrant:166:in `<main>'
vagrant package --base <name of vm> --output <path>.box
Lets say you virtual machine is named 'my_vm' and you want to drop it into the home directory
vagrant package --base my_vm --output ~/my_vm.box
Vagrant will package your virtual machine into a base box. Whatever you name the box with the output flag, will be the name you use in your vagrantfile.

rails install pg - Can't find the 'libpq-fe.h header

$ sudo bundle install
Result
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Using rake (0.9.2.2)
Using i18n (0.6.1)
Using multi_json (1.3.6)
Using activesupport (3.2.8)
Using builder (3.0.4)
Using activemodel (3.2.8)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.3)
Using actionpack (3.2.8)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.11)
Using mail (2.4.4)
Using actionmailer (3.2.8)
Using arel (3.0.2)
Using tzinfo (0.3.33)
Using activerecord (3.2.8)
Using activeresource (3.2.8)
Using bundler (1.2.1)
Using coffee-script-source (1.4.0)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.7.5)
Using rdoc (3.12)
Using thor (0.16.0)
Using railties (3.2.8)
Using coffee-rails (3.2.2)
Using jquery-rails (2.1.3)
Installing pg (0.14.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
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.
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/ruby1.8
--with-pg
--without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
Gem files will remain installed in /var/lib/gems/1.8/gems/pg-0.14.1 for inspection.
Results logged to /var/lib/gems/1.8/gems/pg-0.14.1/ext/gem_make.out
An error occurred while installing pg (0.14.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.14.1'` succeeds before bundling.
I am make $ gem install pg -v '0.14.1' But this is not help
My Gemfile
source 'https://rubygems.org'
#gem 'rails', '3.0.9'
#gem 'sqlite3', '1.3.6', :group => :development
gem 'rails', '3.2.8'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'pg'
gem 'taps'
gem 'json'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
#group :production do
#gem 'pg'
#end
#group :development do
#gem 'sqlite3'
#end
gem_make.out
/usr/bin/ruby1.8 extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
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.
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/ruby1.8
--with-pg
--without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
mkmf.log
find_executable: checking for pg_config... -------------------- yes
--------------------
find_header: checking for libpq-fe.h... -------------------- no
"gcc -E -I. -I/usr/lib/ruby/1.8/i686-linux -I. -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -I -fno-strict-aliasing -g -g -O2 -fPIC conftest.c -o conftest.i"
conftest.c:1:22: fatal error: libpq-fe.h: No such file or directory
compilation terminated.
checked program was:
/* begin */
1: #include <libpq-fe.h>
/* end */
--------------------
Help me please. Thank you.
Sorry for this text.
Your post does not have much context to explain the code sections; please explain your scenario more clearly.
Just make this
$ sudo apt-get install libpq-dev
This is answered in Can't find the 'libpq-fe.h header when trying to install pg gem
Depending on your environment:
Mac: brew install postgresql
Ubuntu: sudo apt-get install libpq-dev
RHEL: yum install postgresql-devel
Alpine: apk add postgresql-dev
Then run gem install pg again
SO: Ubuntu
Language Programming: C
$ sudo apt-get install libpq-dev
In my case I was putting the directory path wrong. So:
From: gcc -o lib_version lib_version.c -I/usr/include/postgresql -lpq -std=c99
To: gcc -o lib_version lib_version.c -I /usr/include/postgresql -lpq -std=c99
GL
Try this:
brew install postgresql
gem install pg
bundle install
On Fedora/RHEL systems this did the trick:
sudo yum install libpqxx-devel
For Alpine Linux, you can add libpq-fe.h with:
apk add postgresql-dev
For Amazon Linux (AWS):
sudo yum install postgresql-devel
then run your command again
On Mac OS X run like this:
gem install pg -- --with-pg-config=***/path/to/pg_config***
***/path/to/pg_config*** is path to pg_config
I had this issue with a Jenkins server on Amazon AMI.
$ pg_config | grep VERSION
VERSION = PostgreSQL 9.4.9
Then depending on which version you need you can install the required lib
$ sudo yum list postgresql* | grep devel
postgresql92-devel.x86_64 9.2.18-1.59.amzn1 #amzn-main
postgresql94-devel.x86_64 9.4.9-1.67.amzn1 #amzn-main
postgresql8-devel.x86_64 8.4.20-5.52.amzn1 amzn-main
postgresql93-devel.x86_64 9.3.14-1.62.amzn1 amzn-main
postgresql95-devel.x86_64 9.5.4-1.71.amzn1 amzn-main
Then you can just install the corresponding version, in my case for version 9.4:
sudo yum install postgresql94-devel
This was happening me using capistrano while deploying my app in a centos7 distro. Apparently gem is requiring some header files which can be resolved installing the right development package.
I fixed it by running sudo yum search postgres | grep devel and found the right package for my postgres installation which was 10.
Then simply run sudo yum install postgresql10-devel, and eureka!
try this:
sudo apt-get install libpq-dev
gem install pg
it would be works!
On mac make sure your postgres is linked.
You can do it by
brew link --overwrite postgresql
This fixed the issue for me.
I use Ubuntu-16. And I use the method showed here:https://www.postgresql.org/download/linux/ubuntu/ to install postgresql-9.6;
And I use "sudo apt-get install libpq-dev" to install the devlib.But It still can't work. So I use the method ln to establish soft link, here it is :
sudo ln -s /usr/include/postgresql/libpq-fe.h /usr/include/;
sudo ln -s /usr/include/postgresql/postgres_ext.h /usr/include/
And I solve the problem at last.
brew install postgresql worked for me.
Installation of postgresql was giving another error
Error: The following directories are not writable by your user:
/usr/local/lib/pkgconfig
/usr/local/share/info
/usr/local/share/man/man3
This error was fixed by giving access to the mentioned directories to the current user
sudo chown -R $(whoami) (path)
This worked for me:
sudo gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
If you've installed postgresql on MacOS via Homebrew
brew install postgresql#95 # 9.5 is the version needed in my project
you may need to find the pg_config depending on your version of libpq
my project needed older version of pg.
gem install pg -v '0.20.0' -- --with-pg config=/usr/local/Cellar/libpq/13.1/bin/pg_config

Heroku rake db:migrate aborts; interning empty string... why?

Ok I've tried searching this site for other similar questions, but those that come close have no answers, so hopefully a rails/heroku guru can help me out.
I've created a basic rails app (I'm learning) and managed to have it run on my home machine perfectly. But when I push it to Heroku and type:
heroku rake db:migrate I get the following error/s:
c:\iltapp>heroku rake db:migrate --trace
rake aborted!
interning empty string
/app/.bundle/gems/ruby/1.8/gems/actionpack-3.0.5/lib/action_dispatch/routing/mapper.rb:1309:in `to_sym'
/app/.bundle/gems/ruby/1.8/gems/actionpack-3.0.5/lib/action_dispatch/routing/mapper.rb:1309:in `action_path'
/app/.bundle/gems/ruby/1.8/gems/actionpack-3.0.5/lib/action_dispatch/routing/mapper.rb:1304:in `path_for_action'
/app/.bundle/gems/ruby/1.8/gems/actionpack-3.0.5/lib/action_dispatch/routing/mapper.rb:1159:in `match'
/app/.bundle/gems/ruby/1.8/gems/actionpack-3.0.5/lib/action_dispatch/routing/mapper.rb:1360:in `match'
/app/config/routes.rb:11
/app/.bundle/gems/ruby/1.8/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:233:in `instance_exec'
/app/.bundle/gems/ruby/1.8/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:233:in `draw'
/app/config/routes.rb:1
/app/.bundle/gems/ruby/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:235:in `load'
/app/.bundle/gems/ruby/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:235:in `load'
/app/.bundle/gems/ruby/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:227:in `load_dependency'
/app/.bundle/gems/ruby/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:235:in `load'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:127:in `reload_routes!'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:127:in `each'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:127:in `reload_routes!'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:120:in `routes_reloader'
/app/.bundle/gems/ruby/1.8/gems/activesupport-3.0.5/lib/active_support/file_update_checker.rb:32:in `call'
/app/.bundle/gems/ruby/1.8/gems/activesupport-3.0.5/lib/active_support/file_update_checker.rb:32:in `execute_if_updated'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application/finisher.rb:51
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application/finisher.rb:52:in `call'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application/finisher.rb:52
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:25:in `instance_exec'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:25:in `run'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:50:in `run_initializers'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:49:in `each'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:49:in `run_initializers'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:134:in `initialize!'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:77:in `send'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:77:in `method_missing'
/app/config/environment.rb:5
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:103:in `require'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:103:in `require_environment!'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:216:in `initialize_tasks'
/app/.bundle/gems/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/app/.bundle/gems/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/app/.bundle/gems/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/app/.bundle/gems/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/app/.bundle/gems/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/usr/ruby1.8.7/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/app/.bundle/gems/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/app/.bundle/gems/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/app/.bundle/gems/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/app/.bundle/gems/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/app/.bundle/gems/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/usr/ruby1.8.7/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/app/.bundle/gems/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/app/.bundle/gems/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/app/.bundle/gems/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/app/.bundle/gems/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/app/.bundle/gems/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/app/.bundle/gems/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/app/.bundle/gems/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/app/.bundle/gems/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/app/.bundle/gems/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/app/.bundle/gems/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/app/.bundle/gems/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/app/.bundle/gems/ruby/1.8/gems/rake-0.8.7/bin/rake:31
/usr/ruby1.8.7/bin/rake:19:in `load'
/usr/ruby1.8.7/bin/rake:19
(in /app)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
Sorry for the long paste, but to be honest I don't know which part of that might me informative. What I have noticed and I hope this isnt the case is I have Ruby 1.9.2 & Rails 3 installed and I see heroku mentions 1.8 above. Would my code be totally incompatible with heroku if I stay with my version or if that is the issue, is there a way around it?
Update #1: I tried #Svilen's suggestion of reseting the db with herolu rake db:reset and get the same error and some new ones, which may or may not be related. And to clarify I am runnign it on a Bamboo Stack (bamboo-ree-1.8.7) Heres what i get:
Couldn't drop hvjiqvwyxn : #<ActiveRecord::StatementInvalid: PGError: ERROR: must be owner of database hvjiqvwyxn
: DROP DATABASE IF EXISTS "hvjiqvwyxn">
hvjiqvwyxn already exists
rake aborted!
interning empty string
Update #2: As per #Svilen's mention of the stacks I have migrated to bamboo-mri-1.9.2 where ruby 1.9.2 (and correct me if I'm wrong) supports "interning an empty string"
Any answers would be much appreciated.
Heroku support Ruby 1.9.2 only on the Bamboo stack. You can check which stack you are using by typing heroku stack. If you are on the old one - Aspen - you can easily move to Bamboo. Check this article in Heroku's Dev Center: http://devcenter.heroku.com/articles/stack
If that's not the case, try resetting the database and forcing all migrations (note: you will lose all existing data!) with heroku rake db:reset. You can also try restarting Heroku beforehand with heroku restart.
If you noticed anything strange during your git push to heroku, it might be relevant to the problem and worth updating your question with additional data.

Resources