问题
I am trying to run a bundle install on a rails app. The installation fails on the step: Installing pg 1.1.3 with native extensions
Here is the complete error log:
current directory: /Users/velinapetrova/.rvm/gems/ruby-2.5.1/gems/pg-1.1.3/ext
/Users/velinapetrova/.rvm/rubies/ruby-2.5.1/bin/ruby -r ./siteconf20181118-57661-1vdieox.rb extconf.rb
——with-pg-config=/usr/local/Cellar/postgresql/10.5/bin/pg_config
checking for pg_config... yes
Using config values from /usr/local/bin/pg_config
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 PQencryptPasswordConn()... yes
checking for timegm()... yes
checking for rb_gc_adjust_memory_usage()... yes
checking for PG_DIAG_TABLE_NAME in libpq-fe.h... 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/velinapetrova/.rvm/gems/ruby-2.5.1/gems/pg-1.1.3/ext
make "DESTDIR=" clean
current directory: /Users/velinapetrova/.rvm/gems/ruby-2.5.1/gems/pg-1.1.3/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:206: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/velinapetrova/.rvm/rubies/ruby-2.5.1/include/ruby-2.5.0/ruby/ruby.h:975:6: note: expanded from macro 'RSTRING_LEN'
RSTRING_EMBED_LEN(str) : \
^~~~~~~~~~~~~~~~~~~~~~
/Users/velinapetrova/.rvm/rubies/ruby-2.5.1/include/ruby-2.5.0/ruby/ruby.h:971:6: note: expanded from macro 'RSTRING_EMBED_LEN'
(long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pg_coder.c:206: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/velinapetrova/.rvm/rubies/ruby-2.5.1/include/ruby-2.5.0/ruby/ruby.h:976: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:225:15: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
strlen = RSTRING_LEN(subint);
~ ^~~~~~~~~~~~~~~~~~~
/Users/velinapetrova/.rvm/rubies/ruby-2.5.1/include/ruby-2.5.0/ruby/ruby.h:975:6: note: expanded from macro 'RSTRING_LEN'
RSTRING_EMBED_LEN(str) : \
^~~~~~~~~~~~~~~~~~~~~~
/Users/velinapetrova/.rvm/rubies/ruby-2.5.1/include/ruby-2.5.0/ruby/ruby.h:971:6: note: expanded from macro 'RSTRING_EMBED_LEN'
(long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pg_copy_coder.c:225:15: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
strlen = RSTRING_LEN(subint);
~ ^~~~~~~~~~~~~~~~~~~
/Users/velinapetrova/.rvm/rubies/ruby-2.5.1/include/ruby-2.5.0/ruby/ruby.h:976:28: note: expanded from macro 'RSTRING_LEN'
RSTRING(str)->as.heap.len)
~~~~~~~~~~~~~~~~~~~~~~^~~
pg_copy_coder.c:531: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_result.c
compiling pg_text_decoder.c
pg_text_decoder.c:693:14: error: variable has incomplete type 'struct tm'
struct tm tm;
^
pg_text_decoder.c:693:11: note: forward declaration of 'struct tm'
struct tm tm;
^
pg_text_decoder.c:705:19: warning: implicit declaration of function 'timegm' is invalid in C99 [-Wimplicit-function-declaration]
time_t time = timegm(&tm);
^
pg_text_decoder.c:723:13: warning: implicit declaration of function 'mktime' is invalid in C99 [-Wimplicit-function-declaration]
time = mktime(&tm);
^
pg_text_decoder.c:725:13: warning: implicit declaration of function 'timegm' is invalid in C99 [-Wimplicit-function-declaration]
time = timegm(&tm);
^
3 warnings and 1 error generated.
make: *** [pg_text_decoder.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/velinapetrova/.rvm/gems/ruby-2.5.1/gems/pg-1.1.3 for inspection.
Results logged to /Users/velinapetrova/.rvm/gems/ruby-2.5.1/extensions/x86_64-darwin-17/2.5.0/pg-1.1.3/gem_make.out
An error occurred while installing pg (1.1.3), and Bundler cannot continue.
Make sure that `gem install pg -v '1.1.3' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
pg
Running the gem install pg -v '1.1.3' --source 'https://rubygems.org/'
produces the same error message.
I have reinstalled postgres.
I have set up my bundle.config to point to the correct pg_config file.
回答1:
sudo apt-get install postgresql-client libpq5 libpq-dev
回答2:
The following worked for me (took from this post)
brew reinstall libffi
export LDFLAGS="-L/usr/local/opt/libffi/lib"
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"
gem install jekyll
and everything worked smoothly.
Hope this works also for you (I spent far way too much time with this issue with iff
)
来源:https://stackoverflow.com/questions/53362614/installing-pg-1-1-3-with-native-extensions-fails