Stuck on GDK install - pg gem

Overview

I tried to re-install GDK on my computer but got stuck on the pg gem problem when I run bundle install in gitlab. 😭

I really tried the troubleshooting steps, and tried other different ways, without success. I tried gem install, brew update, brew reinstall postgresql, nothing worked. @eread ideas?

When I run gdk doctor it says:

The following Ruby Gems have issues:

pg

Try running the following to fix:

gem pristine pg


Database Migrations
--------------------------------------------------------------------------------
There are pending database migrations.
To update your database, run `bundle exec rails db:migrate` in your `gitlab` directory.

And this is the output of bundle install (when it gets stuck):

(...)
Installing pg 1.2.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/ramosmd/.rvm/gems/ruby-2.6.6/gems/pg-1.2.2/ext
/Users/ramosmd/.rvm/rubies/ruby-2.6.6/bin/ruby -I
/Users/ramosmd/.rvm/rubies/ruby-2.6.6/lib/ruby/site_ruby/2.6.0 -r
./siteconf20200828-93605-1mcgc1j.rb extconf.rb
--with-opt-dir\=/Users/ramosmd/.asdf/installs/postgres/11.8
checking for pg_config... yes
Using config values from /Users/ramosmd/.asdf/shims/pg_config
asdf: No version set for command pg_config
you might want to add one of the following in your .tool-versions file:

postgres 11.8
asdf: No version set for command pg_config
you might want to add one of the following in your .tool-versions file:

postgres 11.8
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... yes
checking for PQsetSingleRowMode()... yes
checking for PQconninfo()... yes
checking for PQsslAttribute()... yes
checking for PQresultVerboseErrorMessage()... yes
checking for PQencryptPasswordConn()... yes
checking for PQresultMemorySize()... no
checking for timegm()... yes
checking for rb_gc_adjust_memory_usage()... yes
checking for unistd.h... yes
checking for inttypes.h... yes
checking for C99 variable length arrays... yes
creating extconf.h
creating Makefile

current directory: /Users/ramosmd/.rvm/gems/ruby-2.6.6/gems/pg-1.2.2/ext
make "DESTDIR=" clean

current directory: /Users/ramosmd/.rvm/gems/ruby-2.6.6/gems/pg-1.2.2/ext
make "DESTDIR="
compiling gvl_wrappers.c
compiling pg.c
compiling pg_binary_decoder.c
compiling pg_binary_encoder.c
compiling pg_coder.c
pg_coder.c:204:34: warning: implicit conversion loses integer precision: 'long'
to 'int' [-Wshorten-64-to-32]
res = this->dec_func(this, val, RSTRING_LEN(argv[0]), tuple, field,
ENCODING_GET(argv[0]));
              ~~~~                      ^~~~~~~~~~~~~~~~~~~~
/Users/ramosmd/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/ruby.h:1000:6:
note: expanded from macro 'RSTRING_LEN'
     RSTRING_EMBED_LEN(str) : \
     ^~~~~~~~~~~~~~~~~~~~~~
/Users/ramosmd/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/ruby.h:996:6:
note: expanded from macro 'RSTRING_EMBED_LEN'
     (long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pg_coder.c:204:34: warning: implicit conversion loses integer precision: 'long'
to 'int' [-Wshorten-64-to-32]
res = this->dec_func(this, val, RSTRING_LEN(argv[0]), tuple, field,
ENCODING_GET(argv[0]));
              ~~~~                      ^~~~~~~~~~~~~~~~~~~~
/Users/ramosmd/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/ruby.h:1001:28:
note: expanded from macro 'RSTRING_LEN'
     RSTRING(str)->as.heap.len)
     ~~~~~~~~~~~~~~~~~~~~~~^~~
2 warnings generated.
compiling pg_connection.c
compiling pg_copy_coder.c
pg_copy_coder.c:227:15: warning: implicit conversion loses integer precision:
'long' to 'int' [-Wshorten-64-to-32]
                                        strlen = RSTRING_LEN(subint);
                                               ~ ^~~~~~~~~~~~~~~~~~~
/Users/ramosmd/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/ruby.h:1000:6:
note: expanded from macro 'RSTRING_LEN'
     RSTRING_EMBED_LEN(str) : \
     ^~~~~~~~~~~~~~~~~~~~~~
/Users/ramosmd/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/ruby.h:996:6:
note: expanded from macro 'RSTRING_EMBED_LEN'
     (long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pg_copy_coder.c:227:15: warning: implicit conversion loses integer precision:
'long' to 'int' [-Wshorten-64-to-32]
                                        strlen = RSTRING_LEN(subint);
                                               ~ ^~~~~~~~~~~~~~~~~~~
/Users/ramosmd/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/ruby.h:1001:28:
note: expanded from macro 'RSTRING_LEN'
     RSTRING(str)->as.heap.len)
     ~~~~~~~~~~~~~~~~~~~~~~^~~
pg_copy_coder.c:533:23: warning: implicit conversion loses integer precision:
'long' to 'int' [-Wshorten-64-to-32]
                input_len = end_ptr - start_ptr;
                          ~ ~~~~~~~~^~~~~~~~~~~
3 warnings generated.
compiling pg_errors.c
compiling pg_record_coder.c
pg_record_coder.c:195:15: warning: implicit conversion loses integer precision:
'long' to 'int' [-Wshorten-64-to-32]
                                        strlen = RSTRING_LEN(subint);
                                               ~ ^~~~~~~~~~~~~~~~~~~
/Users/ramosmd/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/ruby.h:1000:6:
note: expanded from macro 'RSTRING_LEN'
     RSTRING_EMBED_LEN(str) : \
     ^~~~~~~~~~~~~~~~~~~~~~
/Users/ramosmd/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/ruby.h:996:6:
note: expanded from macro 'RSTRING_EMBED_LEN'
     (long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pg_record_coder.c:195:15: warning: implicit conversion loses integer precision:
'long' to 'int' [-Wshorten-64-to-32]
                                        strlen = RSTRING_LEN(subint);
                                               ~ ^~~~~~~~~~~~~~~~~~~
/Users/ramosmd/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/ruby.h:1001:28:
note: expanded from macro 'RSTRING_LEN'
     RSTRING(str)->as.heap.len)
     ~~~~~~~~~~~~~~~~~~~~~~^~~
2 warnings generated.
compiling pg_result.c
compiling pg_text_decoder.c
compiling pg_text_encoder.c
pg_text_encoder.c:194:14: warning: implicit conversion loses integer precision:
'long' to 'int' [-Wshorten-64-to-32]
                        len = out - start;
                            ~ ~~~~^~~~~~~
pg_text_encoder.c:406:15: warning: implicit conversion loses integer precision:
'long' to 'int' [-Wshorten-64-to-32]
                return optr - out;
                ~~~~~~ ~~~~~^~~~~
pg_text_encoder.c:410:12: warning: implicit conversion loses integer precision:
'long' to 'int' [-Wshorten-64-to-32]
                return 2 + RSTRING_LEN(*intermediate) * 2;
                ~~~~~~ ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pg_text_encoder.c:617:13: warning: implicit conversion loses integer precision:
'long' to 'int' [-Wshorten-64-to-32]
        nr_elems = RARRAY_LEN(value);
                 ~ ^~~~~~~~~~~~~~~~~
/Users/ramosmd/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/ruby.h:1058:23:
note: expanded from macro 'RARRAY_LEN'
#define RARRAY_LEN(a) rb_array_len(a)
                      ^~~~~~~~~~~~~~~
4 warnings generated.
compiling pg_tuple.c
pg_tuple.c:482:15: warning: implicit conversion loses integer precision: 'long'
to 'int' [-Wshorten-64-to-32]
        num_fields = RARRAY_LEN(values);
                   ~ ^~~~~~~~~~~~~~~~~~
/Users/ramosmd/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/ruby.h:1058:23:
note: expanded from macro 'RARRAY_LEN'
#define RARRAY_LEN(a) rb_array_len(a)
                      ^~~~~~~~~~~~~~~
1 warning generated.
compiling pg_type_map.c
compiling pg_type_map_all_strings.c
compiling pg_type_map_by_class.c
compiling pg_type_map_by_column.c
pg_type_map_by_column.c:161:52: warning: implicit conversion loses integer
precision: 'long' to 'int' [-Wshorten-64-to-32]
return dec_func( p_coder, RSTRING_PTR(field_str),
RSTRING_LEN(field_str), 0, fieldno, enc_idx );
               ~~~~~~~~                                   ^~~~~~~~~~~~~~~~~~~~~~
/Users/ramosmd/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/ruby.h:1000:6:
note: expanded from macro 'RSTRING_LEN'
     RSTRING_EMBED_LEN(str) : \
     ^~~~~~~~~~~~~~~~~~~~~~
/Users/ramosmd/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/ruby.h:996:6:
note: expanded from macro 'RSTRING_EMBED_LEN'
     (long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pg_type_map_by_column.c:161:52: warning: implicit conversion loses integer
precision: 'long' to 'int' [-Wshorten-64-to-32]
return dec_func( p_coder, RSTRING_PTR(field_str),
RSTRING_LEN(field_str), 0, fieldno, enc_idx );
               ~~~~~~~~                                   ^~~~~~~~~~~~~~~~~~~~~~
/Users/ramosmd/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/ruby.h:1001:28:
note: expanded from macro 'RSTRING_LEN'
     RSTRING(str)->as.heap.len)
     ~~~~~~~~~~~~~~~~~~~~~~^~~
pg_type_map_by_column.c:230:17: warning: implicit conversion loses integer
precision: 'long' to 'int' [-Wshorten-64-to-32]
        conv_ary_len = RARRAY_LEN(conv_ary);
                     ~ ^~~~~~~~~~~~~~~~~~~~
/Users/ramosmd/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/ruby.h:1058:23:
note: expanded from macro 'RARRAY_LEN'
#define RARRAY_LEN(a) rb_array_len(a)
                      ^~~~~~~~~~~~~~~
3 warnings generated.
compiling pg_type_map_by_mri_type.c
compiling pg_type_map_by_oid.c
compiling pg_type_map_in_ruby.c
compiling pg_util.c
pg_util.c:119:24: warning: implicit conversion loses integer precision: 'long'
to 'int' [-Wshorten-64-to-32]
        return (char*)out_ptr - out;
        ~~~~~~ ~~~~~~~~~~~~~~~^~~~~
1 warning generated.
linking shared-object pg_ext.bundle
ld: file not found: dynamic_lookup
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [pg_ext.bundle] Error 1

make failed, exit code 2

Gem files will remain installed in
/Users/ramosmd/.rvm/gems/ruby-2.6.6/gems/pg-1.2.2 for inspection.
Results logged to
/Users/ramosmd/.rvm/gems/ruby-2.6.6/extensions/x86_64-darwin-19/2.6.0/pg-1.2.2/gem_make.out

An error occurred while installing pg (1.2.2), and Bundler cannot
continue.
Make sure that `gem install pg -v '1.2.2' --source 'https://rubygems.org/'`
succeeds before bundling.

In Gemfile:
  activerecord-explain-analyze was resolved to 0.1.0, which depends on
    pg

Environment (optional)

  • Operating System: macOS Catalina v 10.15.6
  • The contents of your gdk.yml => empty
  • Ruby version: <!-- output of ruby --version --> ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin19]
  • GDK version: <!-- output of git rev-parse --short HEAD-->4527a90f`
Edited by Marcia Ramos