Upgrading Rails 4.1 - 4.2 and Postgres

Along my way of bringing my app up to supported versions, I’m migrating from Rails 4.1 to 4.2 (started at 3.2). Running Ruby 2.0. Once I made the necessary changes to my Gemfile to get the program to run, I got this error:

/Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/connection_specification.rb:177:in `rescue in spec': Specified 'postgresql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)
  from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/connection_specification.rb:174:in `spec'
  from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_handling.rb:50:in `establish_connection'
  from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0/lib/active_record/railtie.rb:120:in `block (2 levels) in <class:Railtie>'
  from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
  from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
  from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
  from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:44:in `each'
  from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
  from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0/lib/active_record/base.rb:316:in `<module:ActiveRecord>'
  from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0/lib/active_record/base.rb:26:in `<top (required)>'
  from /Users/jackrg/Documents/Novelty-Stats/config/initializers/active_record.rb:1:in `<top (required)>’
...

Mind you, I’ve been running Postgres on my development system from he beginning, so it’s not the absence of pg in the bundle, so it must be the version. Sure enough, looking at the PostgreSQL adapter in Rails 4.2, they now require pg version 0.15, whereas they previously required 0.13.2. So I attempted to install the 0.15 gem (“bundle update pg”), only to get the dreaded "Failed to build gem native extension” error. Looking at the log more closely, it’s dying on a test to see if the local PG library supports “PQconnectionUsedPassword”, which was not part of the library with my Postgres 9.2 installation. So I went out and found a Postgres 10.0 installation (actually, it’s the multi-version installation for Mac OS X) and installed it, and migrated my databases from the 9.2 database to the new 10.0 database.

So I re-ran the "bundle update pg" to build the bundle and I still get the same error — it can’t find “PQconnectionUsedPassword” in the library. I looked in the 10.0 installation and was able to find a source file (libpq-fe.h) that contained a declaration of PQconnectionUsedPassword, so I’m left wondering why the gem installation isn’t find it. If it makes a difference, here is the output from pg_config (the include folder named below includes the libpq-fe.h file that declares the “missing” function.

BINDIR = /Applications/Postgres.app/Contents/Versions/10/bin
DOCDIR = /Applications/Postgres.app/Contents/Versions/10/share/doc/postgresql
HTMLDIR = /Applications/Postgres.app/Contents/Versions/10/share/doc/postgresql
INCLUDEDIR = /Applications/Postgres.app/Contents/Versions/10/include
PKGINCLUDEDIR = /Applications/Postgres.app/Contents/Versions/10/include/postgresql
INCLUDEDIR-SERVER = /Applications/Postgres.app/Contents/Versions/10/include/postgresql/server
LIBDIR = /Applications/Postgres.app/Contents/Versions/10/lib
PKGLIBDIR = /Applications/Postgres.app/Contents/Versions/10/lib/postgresql
LOCALEDIR = /Applications/Postgres.app/Contents/Versions/10/share/locale
MANDIR = /Applications/Postgres.app/Contents/Versions/10/share/man
SHAREDIR = /Applications/Postgres.app/Contents/Versions/10/share/postgresql
SYSCONFDIR = /Applications/Postgres.app/Contents/Versions/10/etc/postgresql
PGXS = /Applications/Postgres.app/Contents/Versions/10/lib/postgresql/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--prefix=/Applications/Postgres.app/Contents/Versions/10' '--with-includes=/Applications/Postgres.app/Contents/Versions/10/include' '--with-libraries=/Applications/Postgres.app/Contents/Versions/10/lib' '--enable-thread-safety' '--with-openssl' '--with-gssapi' '--with-bonjour' '--with-libxml' '--with-libxslt' '--with-perl' '--with-python' '--with-readline' '--with-uuid=e2fs' '--with-icu' 'CFLAGS= -mmacosx-version-min=10.7' 'PKG_CONFIG_LIBDIR=/Applications/Postgres.app/Contents/Versions/10/lib/pkgconfig' 'ICU_CFLAGS=-I/Applications/Postgres.app/Contents/Versions/10/share/icu' 'ICU_LIBS=-licui18n -licuuc'
CC = gcc
CPPFLAGS = -I/Applications/Postgres.app/Contents/Versions/10/share/icu -I/Applications/Postgres.app/Contents/Versions/10/include/libxml2 -I/Applications/Postgres.app/Contents/Versions/10/include
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -mmacosx-version-min=10.7
CFLAGS_SL =
LDFLAGS = -L/Applications/Postgres.app/Contents/Versions/10/lib -L/Applications/Postgres.app/Contents/Versions/10/lib -Wl,-dead_strip_dylibs
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgcommon -lpgport -lxslt -lxml2 -lssl -lcrypto -lgssapi_krb5 -lz -lreadline -lm
VERSION = PostgreSQL 10.14

You might consider doing a fresh rails build, copying over your code,
exporting + importing the db data, then running your tests.

When upgrades get too complicated for me I often prefer to build a fresh
new version then copy over code and data. Gives a good opportunity to see
where there are holes in your test coverage as well.

···

On Mon, Oct 5, 2020 at 5:44 PM Jack Royal-Gordon <jackrg@pobox.com> wrote:

Along my way of bringing my app up to supported versions, I’m migrating
from Rails 4.1 to 4.2 (started at 3.2). Running Ruby 2.0. Once I made the
necessary changes to my Gemfile to get the program to run, I got this error:

/Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/connection_specification.rb:177:in `rescue
in spec': Specified 'postgresql' for database adapter, but the gem is not
loaded. Add `gem 'pg'` to your Gemfile (and ensure its version is at
the minimum required by ActiveRecord). (Gem::LoadError)
from
/Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/connection_specification.rb:174:in
`spec'
from
/Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_handling.rb:50:in `establish_connection'
from
/Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0/lib/active_record/railtie.rb:120:in
`block (2 levels) in <class:Railtie>'
from
/Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:38:in
`instance_eval'
from
/Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:38:in
`execute_hook'
from
/Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:45:in
`block in run_load_hooks'
from
/Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:44:in
`each'
from
/Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
from
/Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0/lib/active_record/base.rb:316:in
`<module:ActiveRecord>'
from
/Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0/lib/active_record/base.rb:26:in
`<top (required)>'
from
/Users/jackrg/Documents/Novelty-Stats/config/initializers/active_record.rb:1:in
`<top (required)>’
...

Mind you, I’ve been running Postgres on my development system from he
beginning, so it’s not the absence of pg in the bundle, so it must be the
version. Sure enough, looking at the PostgreSQL adapter in Rails 4.2, they
now require pg version 0.15, whereas they previously required 0.13.2. So I
attempted to install the 0.15 gem (“bundle update pg”), only to get the
dreaded "Failed to build gem native extension” error. Looking at the log
more closely, it’s dying on a test to see if the local PG library supports
“PQconnectionUsedPassword”, which was not part of the library with my
Postgres 9.2 installation. So I went out and found a Postgres 10.0
installation (actually, it’s the multi-version installation for Mac OS X)
and installed it, and migrated my databases from the 9.2 database to the
new 10.0 database.

So I re-ran the "bundle update pg" to build the bundle and I still get the
same error — it can’t find “PQconnectionUsedPassword” in the library. I
looked in the 10.0 installation and was able to find a source file
(libpq-fe.h) that contained a declaration of PQconnectionUsedPassword, so
I’m left wondering why the gem installation isn’t find it. If it makes
a difference, here is the output from pg_config (the include folder named
below includes the libpq-fe.h file that declares the “missing” function.

BINDIR = /Applications/Postgres.app/Contents/Versions/10/bin
DOCDIR =
/Applications/Postgres.app/Contents/Versions/10/share/doc/postgresql
HTMLDIR =
/Applications/Postgres.app/Contents/Versions/10/share/doc/postgresql
INCLUDEDIR = /Applications/Postgres.app/Contents/Versions/10/include
PKGINCLUDEDIR =
/Applications/Postgres.app/Contents/Versions/10/include/postgresql
INCLUDEDIR-SERVER =
/Applications/Postgres.app/Contents/Versions/10/include/postgresql/server
LIBDIR = /Applications/Postgres.app/Contents/Versions/10/lib
PKGLIBDIR = /Applications/Postgres.app/Contents/Versions/10/lib/postgresql
LOCALEDIR = /Applications/Postgres.app/Contents/Versions/10/share/locale
MANDIR = /Applications/Postgres.app/Contents/Versions/10/share/man
SHAREDIR = /Applications/Postgres.app/Contents/Versions/10/share/postgresql
SYSCONFDIR = /Applications/Postgres.app/Contents/Versions/10/etc/postgresql
PGXS =
/Applications/Postgres.app/Contents/Versions/10/lib/postgresql/pgxs/src/makefiles/
pgxs.mk
CONFIGURE = '--prefix=/Applications/Postgres.app/Contents/Versions/10'
'--with-includes=/Applications/Postgres.app/Contents/Versions/10/include'
'--with-libraries=/Applications/Postgres.app/Contents/Versions/10/lib'
'--enable-thread-safety' '--with-openssl' '--with-gssapi' '--with-bonjour'
'--with-libxml' '--with-libxslt' '--with-perl' '--with-python'
'--with-readline' '--with-uuid=e2fs' '--with-icu' 'CFLAGS=
-mmacosx-version-min=10.7' 'PKG_CONFIG_LIBDIR=/Applications/Postgres.app/Contents/Versions/10/lib/pkgconfig'
'ICU_CFLAGS=-I/Applications/Postgres.app/Contents/Versions/10/share/icu' 'ICU_LIBS=-licui18n
-licuuc'
CC = gcc
CPPFLAGS = -I/Applications/Postgres.app/Contents/Versions/10/share/icu
-I/Applications/Postgres.app/Contents/Versions/10/include/libxml2
-I/Applications/Postgres.app/Contents/Versions/10/include
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute
-Wformat-security -fno-strict-aliasing -fwrapv
-Wno-unused-command-line-argument -mmacosx-version-min=10.7
CFLAGS_SL =
LDFLAGS = -L/Applications/Postgres.app/Contents/Versions/10/lib
-L/Applications/Postgres.app/Contents/Versions/10/lib -Wl,-dead_strip_dylibs
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgcommon -lpgport -lxslt -lxml2 -lssl -lcrypto -lgssapi_krb5 -lz
-lreadline -lm
VERSION = PostgreSQL 10.14

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

--
A musician must make music, an artist must paint, a poet must write, if he
is to be ultimately at peace with himself.
- Abraham Maslow

Quoting Jack Royal-Gordon (jackrg@pobox.com):

   Along my way of bringing my app up to supported versions, I’m migrating
   from Rails 4.1 to 4.2 (started at 3.2). Running Ruby 2.0. Once I made the
   necessary changes to my Gemfile to get the program to run, I got this
   error:

....
....

Disclaimer: I know too little about rails and macos to presume I could
be of real help.

I would go to the directory where the pg gem is installed (somewhere
under
/Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems), go
where the C stuff resides (inside ext/<something>) and run

ruby extconf.rb
make clean
make

and see if the error about missing PQconnectionUsedPassword still pops
out. If so, that probably means more than one postgres configuration
tools are lying around in your machine, and you pick up the wrong one
when compiling the gem. If you do not see the error, then purging
(with gem uninstall) and reinstalling (with gem install) the gem
should fix your problem...

Carlo

···

Subject: Upgrading Rails 4.1 - 4.2 and Postgres
  Date: Mon 05 Oct 20 05:43:39PM -0700

--
  * Se la Strada e la sua Virtu' non fossero state messe da parte,
* K * Carlo E. Prelz - fluido@fluido.as che bisogno ci sarebbe
  * di parlare tanto di amore e di rettitudine? (Chuang-Tzu)

Hi Sean,

Thanks for the suggestion. I’m tempted to save your idea for the 4.2 -> 5.0 upgrade, which is coming as soon as I can stabilize and test 4.2. It just sounds like an idea that’s best for a major upgrade.

Jack

···

On Oct 5, 2020, at 9:32 PM, Sean Felipe Wolfe <ether.joe@gmail.com> wrote:

You might consider doing a fresh rails build, copying over your code, exporting + importing the db data, then running your tests.

When upgrades get too complicated for me I often prefer to build a fresh new version then copy over code and data. Gives a good opportunity to see where there are holes in your test coverage as well.

On Mon, Oct 5, 2020 at 5:44 PM Jack Royal-Gordon <jackrg@pobox.com <mailto:jackrg@pobox.com>> wrote:
Along my way of bringing my app up to supported versions, I’m migrating from Rails 4.1 to 4.2 (started at 3.2). Running Ruby 2.0. Once I made the necessary changes to my Gemfile to get the program to run, I got this error:

/Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/connection_specification.rb:177:in `rescue in spec': Specified 'postgresql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)
  from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/connection_specification.rb:174:in `spec'
  from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_handling.rb:50:in `establish_connection'
  from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0/lib/active_record/railtie.rb:120:in `block (2 levels) in <class:Railtie>'
  from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
  from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
  from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
  from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:44:in `each'
  from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
  from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0/lib/active_record/base.rb:316:in `<module:ActiveRecord>'
  from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0/lib/active_record/base.rb:26:in `<top (required)>'
  from /Users/jackrg/Documents/Novelty-Stats/config/initializers/active_record.rb:1:in `<top (required)>’
...

Mind you, I’ve been running Postgres on my development system from he beginning, so it’s not the absence of pg in the bundle, so it must be the version. Sure enough, looking at the PostgreSQL adapter in Rails 4.2, they now require pg version 0.15, whereas they previously required 0.13.2. So I attempted to install the 0.15 gem (“bundle update pg”), only to get the dreaded "Failed to build gem native extension” error. Looking at the log more closely, it’s dying on a test to see if the local PG library supports “PQconnectionUsedPassword”, which was not part of the library with my Postgres 9.2 installation. So I went out and found a Postgres 10.0 installation (actually, it’s the multi-version installation for Mac OS X) and installed it, and migrated my databases from the 9.2 database to the new 10.0 database.

So I re-ran the "bundle update pg" to build the bundle and I still get the same error — it can’t find “PQconnectionUsedPassword” in the library. I looked in the 10.0 installation and was able to find a source file (libpq-fe.h) that contained a declaration of PQconnectionUsedPassword, so I’m left wondering why the gem installation isn’t find it. If it makes a difference, here is the output from pg_config (the include folder named below includes the libpq-fe.h file that declares the “missing” function.

BINDIR = /Applications/Postgres.app/Contents/Versions/10/bin
DOCDIR = /Applications/Postgres.app/Contents/Versions/10/share/doc/postgresql
HTMLDIR = /Applications/Postgres.app/Contents/Versions/10/share/doc/postgresql
INCLUDEDIR = /Applications/Postgres.app/Contents/Versions/10/include
PKGINCLUDEDIR = /Applications/Postgres.app/Contents/Versions/10/include/postgresql
INCLUDEDIR-SERVER = /Applications/Postgres.app/Contents/Versions/10/include/postgresql/server
LIBDIR = /Applications/Postgres.app/Contents/Versions/10/lib
PKGLIBDIR = /Applications/Postgres.app/Contents/Versions/10/lib/postgresql
LOCALEDIR = /Applications/Postgres.app/Contents/Versions/10/share/locale
MANDIR = /Applications/Postgres.app/Contents/Versions/10/share/man
SHAREDIR = /Applications/Postgres.app/Contents/Versions/10/share/postgresql
SYSCONFDIR = /Applications/Postgres.app/Contents/Versions/10/etc/postgresql
PGXS = /Applications/Postgres.app/Contents/Versions/10/lib/postgresql/pgxs/src/makefiles/pgxs.mk <http://pgxs.mk/>
CONFIGURE = '--prefix=/Applications/Postgres.app/Contents/Versions/10' '--with-includes=/Applications/Postgres.app/Contents/Versions/10/include' '--with-libraries=/Applications/Postgres.app/Contents/Versions/10/lib' '--enable-thread-safety' '--with-openssl' '--with-gssapi' '--with-bonjour' '--with-libxml' '--with-libxslt' '--with-perl' '--with-python' '--with-readline' '--with-uuid=e2fs' '--with-icu' 'CFLAGS= -mmacosx-version-min=10.7' 'PKG_CONFIG_LIBDIR=/Applications/Postgres.app/Contents/Versions/10/lib/pkgconfig' 'ICU_CFLAGS=-I/Applications/Postgres.app/Contents/Versions/10/share/icu' 'ICU_LIBS=-licui18n -licuuc'
CC = gcc
CPPFLAGS = -I/Applications/Postgres.app/Contents/Versions/10/share/icu -I/Applications/Postgres.app/Contents/Versions/10/include/libxml2 -I/Applications/Postgres.app/Contents/Versions/10/include
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -mmacosx-version-min=10.7
CFLAGS_SL =
LDFLAGS = -L/Applications/Postgres.app/Contents/Versions/10/lib -L/Applications/Postgres.app/Contents/Versions/10/lib -Wl,-dead_strip_dylibs
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgcommon -lpgport -lxslt -lxml2 -lssl -lcrypto -lgssapi_krb5 -lz -lreadline -lm
VERSION = PostgreSQL 10.14

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

--
A musician must make music, an artist must paint, a poet must write, if he is to be ultimately at peace with himself.
- Abraham Maslow

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Hi Carlo,

I will give that a try. I do suspect that what you’re saying about multiple configurations is indeed what is happening because I had a 9.2 installation which seemed to be the genesis of the error message.

One thing I’d like to find out (and I’ve asked on the pg gem support list) is how the gem install procedure finds the library headers, so that I can make sure it finds the newer ones.

Thanks for the suggestion.

Jack

···

On Oct 5, 2020, at 9:35 PM, Carlo E. Prelz <fluido@fluido.as> wrote:

  Subject: Upgrading Rails 4.1 - 4.2 and Postgres
  Date: Mon 05 Oct 20 05:43:39PM -0700

Quoting Jack Royal-Gordon (jackrg@pobox.com):

  Along my way of bringing my app up to supported versions, I’m migrating
  from Rails 4.1 to 4.2 (started at 3.2). Running Ruby 2.0. Once I made the
  necessary changes to my Gemfile to get the program to run, I got this
  error:

....
....

Disclaimer: I know too little about rails and macos to presume I could
be of real help.

I would go to the directory where the pg gem is installed (somewhere
under
/Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems), go
where the C stuff resides (inside ext/<something>) and run

ruby extconf.rb
make clean
make

and see if the error about missing PQconnectionUsedPassword still pops
out. If so, that probably means more than one postgres configuration
tools are lying around in your machine, and you pick up the wrong one
when compiling the gem. If you do not see the error, then purging
(with gem uninstall) and reinstalling (with gem install) the gem
should fix your problem...

Carlo

--
* Se la Strada e la sua Virtu' non fossero state messe da parte,
* K * Carlo E. Prelz - fluido@fluido.as che bisogno ci sarebbe
* di parlare tanto di amore e di rettitudine? (Chuang-Tzu)

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Quoting Jack Royal-Gordon (jackrg@pobox.com):

One thing I’d like to find out (and I’ve asked on the pg gem support
list) is how the gem install procedure finds the library headers, so
that I can make sure it finds the newer ones.

That stuff generally takes place in the extconf.rb script, which is
responsible for creating the makefile that is used to build the
extension. If you modify that script, keep in mind that any gem update
will overwrite your changes.

Carlo

···

Subject: Re: Upgrading Rails 4.1 - 4.2 and Postgres
  Date: Mon 05 Oct 20 11:50:17PM -0700

--
  * Se la Strada e la sua Virtu' non fossero state messe da parte,
* K * Carlo E. Prelz - fluido@fluido.as che bisogno ci sarebbe
  * di parlare tanto di amore e di rettitudine? (Chuang-Tzu)

Yep, got it. Thanks for the advice.

···

On Oct 5, 2020, at 11:56 PM, Carlo E. Prelz <fluido@fluido.as> wrote:

  Subject: Re: Upgrading Rails 4.1 - 4.2 and Postgres
  Date: Mon 05 Oct 20 11:50:17PM -0700

Quoting Jack Royal-Gordon (jackrg@pobox.com):

One thing I’d like to find out (and I’ve asked on the pg gem support
list) is how the gem install procedure finds the library headers, so
that I can make sure it finds the newer ones.

That stuff generally takes place in the extconf.rb script, which is
responsible for creating the makefile that is used to build the
extension. If you modify that script, keep in mind that any gem update
will overwrite your changes.

Carlo

--
* Se la Strada e la sua Virtu' non fossero state messe da parte,
* K * Carlo E. Prelz - fluido@fluido.as che bisogno ci sarebbe
* di parlare tanto di amore e di rettitudine? (Chuang-Tzu)

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

So I went out and found a Postgres 10.0 installation (actually, it’s the

multi-version installation for Mac OS X) and installed it, and migrated my
databases from the 9.2 database to the new 10.0 database.

I would also double check my PATH to make sure the legacy Postgres isn't
getting in the way somehow.

···

On Tue, Oct 6, 2020 at 3:00 AM Jack Royal-Gordon <jackrg@pobox.com> wrote:

Yep, got it. Thanks for the advice.

> On Oct 5, 2020, at 11:56 PM, Carlo E. Prelz <fluido@fluido.as> wrote:
>
> Subject: Re: Upgrading Rails 4.1 - 4.2 and Postgres
> Date: Mon 05 Oct 20 11:50:17PM -0700
>
> Quoting Jack Royal-Gordon (jackrg@pobox.com):
>
>> One thing I’d like to find out (and I’ve asked on the pg gem support
>> list) is how the gem install procedure finds the library headers, so
>> that I can make sure it finds the newer ones.
>
> That stuff generally takes place in the extconf.rb script, which is
> responsible for creating the makefile that is used to build the
> extension. If you modify that script, keep in mind that any gem update
> will overwrite your changes.
>
> Carlo
>
> --
> * Se la Strada e la sua Virtu' non fossero state messe da parte,
> * K * Carlo E. Prelz - fluido@fluido.as che bisogno ci
sarebbe
> * di parlare tanto di amore e di rettitudine? (Chuang-Tzu)
>
> Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org
?subject=unsubscribe>
> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

I did check the path and the legacy installation was there; I substituted the new installation, but the only thing that changed is that “gem install pg -v 0.15.1” now gives the same result as “bundle update pg” because it can now find the pg_config program. It seems like that ought to solve the problem, but the problem with seeing the wrong headers persists.

···

On Oct 6, 2020, at 7:17 AM, Michael Bostler <mbostler@gmail.com> wrote:

> So I went out and found a Postgres 10.0 installation (actually, it’s the multi-version installation for Mac OS X) and installed it, and migrated my databases from the 9.2 database to the new 10.0 database.

I would also double check my PATH to make sure the legacy Postgres isn't getting in the way somehow.

On Tue, Oct 6, 2020 at 3:00 AM Jack Royal-Gordon <jackrg@pobox.com <mailto:jackrg@pobox.com>> wrote:
Yep, got it. Thanks for the advice.

> On Oct 5, 2020, at 11:56 PM, Carlo E. Prelz <fluido@fluido.as <mailto:fluido@fluido.as>> wrote:
>
> Subject: Re: Upgrading Rails 4.1 - 4.2 and Postgres
> Date: Mon 05 Oct 20 11:50:17PM -0700
>
> Quoting Jack Royal-Gordon (jackrg@pobox.com <mailto:jackrg@pobox.com>):
>
>> One thing I’d like to find out (and I’ve asked on the pg gem support
>> list) is how the gem install procedure finds the library headers, so
>> that I can make sure it finds the newer ones.
>
> That stuff generally takes place in the extconf.rb script, which is
> responsible for creating the makefile that is used to build the
> extension. If you modify that script, keep in mind that any gem update
> will overwrite your changes.
>
> Carlo
>
> --
> * Se la Strada e la sua Virtu' non fossero state messe da parte,
> * K * Carlo E. Prelz - fluido@fluido.as <mailto:fluido@fluido.as> che bisogno ci sarebbe
> * di parlare tanto di amore e di rettitudine? (Chuang-Tzu)
>
> Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Hi Jack... I had a similar problem some weeks ago, and shared a solution on
stackoverflow... maybe you can try it to see if it also work for you

···

El mar., 6 oct. 2020 a las 11:57, Jack Royal-Gordon (<jackrg@pobox.com>) escribió:

I did check the path and the legacy installation was there; I substituted
the new installation, but the only thing that changed is that “gem install
pg -v 0.15.1” now gives the same result as “bundle update pg” because it
can now find the pg_config program. It seems like that ought to solve the
problem, but the problem with seeing the wrong headers persists.

On Oct 6, 2020, at 7:17 AM, Michael Bostler <mbostler@gmail.com> wrote:

> So I went out and found a Postgres 10.0 installation (actually, it’s the
multi-version installation for Mac OS X) and installed it, and migrated my
databases from the 9.2 database to the new 10.0 database.

I would also double check my PATH to make sure the legacy Postgres isn't
getting in the way somehow.

On Tue, Oct 6, 2020 at 3:00 AM Jack Royal-Gordon <jackrg@pobox.com> wrote:

Yep, got it. Thanks for the advice.

> On Oct 5, 2020, at 11:56 PM, Carlo E. Prelz <fluido@fluido.as> wrote:
>
> Subject: Re: Upgrading Rails 4.1 - 4.2 and Postgres
> Date: Mon 05 Oct 20 11:50:17PM -0700
>
> Quoting Jack Royal-Gordon (jackrg@pobox.com):
>
>> One thing I’d like to find out (and I’ve asked on the pg gem support
>> list) is how the gem install procedure finds the library headers, so
>> that I can make sure it finds the newer ones.
>
> That stuff generally takes place in the extconf.rb script, which is
> responsible for creating the makefile that is used to build the
> extension. If you modify that script, keep in mind that any gem update
> will overwrite your changes.
>
> Carlo
>
> --
> * Se la Strada e la sua Virtu' non fossero state messe da
parte,
> * K * Carlo E. Prelz - fluido@fluido.as che bisogno ci
sarebbe
> * di parlare tanto di amore e di rettitudine?
(Chuang-Tzu)
>
> Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org
?subject=unsubscribe>
> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe
<ruby-talk-request@ruby-lang.org?subject=unsubscribe>>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Benito, you nailed it!

$ gem install pg -v '0.15.1' -- --with-cflags="-Wno-error=implicit-function-declaration"
Building native extensions with: '--with-cflags=-Wno-error=implicit-function-declaration'
This could take a while...
Successfully installed pg-0.15.1
1 gem installed

Thanks so much for your help!

···

On Oct 7, 2020, at 10:58 AM, Benito Serna <bhserna@gmail.com> wrote:

Hi Jack... I had a similar problem some weeks ago, and shared a solution on stackoverflow... maybe you can try it to see if it also work for you https://stackoverflow.com/questions/36455625/postgresql-gem-install-pg-0-18-4-passes-bundle-install-fails/63583496#63583496
El mar., 6 oct. 2020 a las 11:57, Jack Royal-Gordon (<jackrg@pobox.com <mailto:jackrg@pobox.com>>) escribió:
I did check the path and the legacy installation was there; I substituted the new installation, but the only thing that changed is that “gem install pg -v 0.15.1” now gives the same result as “bundle update pg” because it can now find the pg_config program. It seems like that ought to solve the problem, but the problem with seeing the wrong headers persists.

On Oct 6, 2020, at 7:17 AM, Michael Bostler <mbostler@gmail.com <mailto:mbostler@gmail.com>> wrote:

> So I went out and found a Postgres 10.0 installation (actually, it’s the multi-version installation for Mac OS X) and installed it, and migrated my databases from the 9.2 database to the new 10.0 database.

I would also double check my PATH to make sure the legacy Postgres isn't getting in the way somehow.

On Tue, Oct 6, 2020 at 3:00 AM Jack Royal-Gordon <jackrg@pobox.com <mailto:jackrg@pobox.com>> wrote:
Yep, got it. Thanks for the advice.

> On Oct 5, 2020, at 11:56 PM, Carlo E. Prelz <fluido@fluido.as <mailto:fluido@fluido.as>> wrote:
>
> Subject: Re: Upgrading Rails 4.1 - 4.2 and Postgres
> Date: Mon 05 Oct 20 11:50:17PM -0700
>
> Quoting Jack Royal-Gordon (jackrg@pobox.com <mailto:jackrg@pobox.com>):
>
>> One thing I’d like to find out (and I’ve asked on the pg gem support
>> list) is how the gem install procedure finds the library headers, so
>> that I can make sure it finds the newer ones.
>
> That stuff generally takes place in the extconf.rb script, which is
> responsible for creating the makefile that is used to build the
> extension. If you modify that script, keep in mind that any gem update
> will overwrite your changes.
>
> Carlo
>
> --
> * Se la Strada e la sua Virtu' non fossero state messe da parte,
> * K * Carlo E. Prelz - fluido@fluido.as <mailto:fluido@fluido.as> che bisogno ci sarebbe
> * di parlare tanto di amore e di rettitudine? (Chuang-Tzu)
>
> Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Awesome!!

···

El mié., 7 oct. 2020 a las 14:55, Jack Royal-Gordon (<jackrg@pobox.com>) escribió:

Benito, you nailed it!

$ gem install pg -v '0.15.1' --
--with-cflags="-Wno-error=implicit-function-declaration"
Building native extensions with:
'--with-cflags=-Wno-error=implicit-function-declaration'
This could take a while...
Successfully installed pg-0.15.1
1 gem installed

Thanks so much for your help!

On Oct 7, 2020, at 10:58 AM, Benito Serna <bhserna@gmail.com> wrote:

Hi Jack... I had a similar problem some weeks ago, and shared a solution
on stackoverflow... maybe you can try it to see if it also work for you
https://stackoverflow.com/questions/36455625/postgresql-gem-install-pg-0-18-4-passes-bundle-install-fails/63583496#63583496

El mar., 6 oct. 2020 a las 11:57, Jack Royal-Gordon (<jackrg@pobox.com>) > escribió:

I did check the path and the legacy installation was there; I substituted
the new installation, but the only thing that changed is that “gem install
pg -v 0.15.1” now gives the same result as “bundle update pg” because it
can now find the pg_config program. It seems like that ought to solve the
problem, but the problem with seeing the wrong headers persists.

On Oct 6, 2020, at 7:17 AM, Michael Bostler <mbostler@gmail.com> wrote:

> So I went out and found a Postgres 10.0 installation (actually, it’s
the multi-version installation for Mac OS X) and installed it, and migrated
my databases from the 9.2 database to the new 10.0 database.

I would also double check my PATH to make sure the legacy Postgres isn't
getting in the way somehow.

On Tue, Oct 6, 2020 at 3:00 AM Jack Royal-Gordon <jackrg@pobox.com> >> wrote:

Yep, got it. Thanks for the advice.

> On Oct 5, 2020, at 11:56 PM, Carlo E. Prelz <fluido@fluido.as> wrote:
>
> Subject: Re: Upgrading Rails 4.1 - 4.2 and Postgres
> Date: Mon 05 Oct 20 11:50:17PM -0700
>
> Quoting Jack Royal-Gordon (jackrg@pobox.com):
>
>> One thing I’d like to find out (and I’ve asked on the pg gem support
>> list) is how the gem install procedure finds the library headers, so
>> that I can make sure it finds the newer ones.
>
> That stuff generally takes place in the extconf.rb script, which is
> responsible for creating the makefile that is used to build the
> extension. If you modify that script, keep in mind that any gem update
> will overwrite your changes.
>
> Carlo
>
> --
> * Se la Strada e la sua Virtu' non fossero state messe da
parte,
> * K * Carlo E. Prelz - fluido@fluido.as che bisogno ci
sarebbe
> * di parlare tanto di amore e di rettitudine?
(Chuang-Tzu)
>
> Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org
?subject=unsubscribe>
> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org
?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe
<ruby-talk-request@ruby-lang.org?subject=unsubscribe>>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe
<ruby-talk-request@ruby-lang.org?subject=unsubscribe>>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>