bundle install error in eventmachine installing - ruby

I had a problem trying to run the ruby project OPEN-NDC-PROJECT.
bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 13.0.3
Using concurrent-ruby 1.1.8
Using i18n 1.5.1
Using minitest 5.14.3
Using thread_safe 0.3.6
Using tzinfo 1.2.9
Using activesupport 5.0.7.2
Using activemodel 5.0.7.2
Using arel 7.1.4
Using activerecord 5.0.7.2
Using awesome_print 1.8.0
Using descendants_tracker 0.0.4
Using ice_nine 0.11.2
Using axiom-types 0.1.1
Using dependor 1.0.1
Using bogus 0.1.6
Using builder 3.2.4
Using bundler 1.17.3
Using chronic 0.10.2
Using coderay 1.1.3
Using coercible 1.0.0
Using daemons 1.3.1
Using database_cleaner-core 2.0.1
Using database_cleaner-active_record 2.0.0
Using database_cleaner 2.0.1
Using diffy 3.4.0
Using equalizer 0.0.11
Fetching eventmachine 1.2.7
Installing eventmachine 1.2.7 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/userName/.rbenv/versions/2.2.2/bin/ruby -r
./siteconf20210217-76181-1jmnsjp.rb extconf.rb
--with-cppflags=-I/usr/local/opt/openssl/include
checking for main() in -lcrypto... no
checking for openssl/ssl.h... yes
checking for openssl/err.h... yes
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_fd_select()... yes
checking for rb_fdset_t in ruby/intern.h... yes
checking for rb_wait_for_single_fd()... no
checking for rb_enable_interrupt()... no
checking for rb_time_new()... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... yes
checking for pipe2() in unistd.h... no
checking for accept4() in sys/socket.h... no
checking for SOCK_CLOEXEC in sys/socket.h... no
checking for sys/event.h... yes
checking for sys/queue.h... yes
checking for clock_gettime()... no
checking for gethrtime()... no
CXXFLAGS=$(cxxflags) -Wall -Wextra -Wno-deprecated-declarations
-Wno-ignored-qualifiers -Wno-unused-result -Wno-address
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling page.cpp
compiling pipe.cpp
compiling binder.cpp
compiling rubymain.cpp
compiling ssl.cpp
compiling ed.cpp
compiling cmain.cpp
compiling em.cpp
em.cpp:706:13: error: use of undeclared identifier 'rb_thread_select'; did you
mean 'rb_thread_fd_select'?
if ((ret = rb_thread_select(kqfd + 1, &fdreads, NULL, NULL, &tv)) < 1) {
^~~~~~~~~~~~~~~~
rb_thread_fd_select
/Users/userName/.rbenv/versions/2.2.2/include/ruby-2.2.0/ruby/intern.h:454:5:
note: 'rb_thread_fd_select' declared here
int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct
timeval *);
^
em.cpp:706:40: error: cannot initialize a parameter of type 'rb_fdset_t *' with an
rvalue of type 'fd_set *'
if ((ret = rb_thread_select(kqfd + 1, &fdreads, NULL, NULL, &tv)) < 1) {
^~~~~~~~
/Users/userName/.rbenv/versions/2.2.2/include/ruby-2.2.0/ruby/intern.h:454:42:
note: passing argument to parameter here
int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct
timeval *);
^
2 errors generated.
make: *** [em.o] Error 1
make failed, exit code 2
Gem files will remain installed in
/Users/userName/RubymineProjects/ndc-sandbox/vendor/bundle/ruby/2.2.0/gems/eventmachine-1.2.7
for inspection.
Results logged to
/Users/userName/RubymineProjects/ndc-sandbox/vendor/bundle/ruby/2.2.0/extensions/x86_64-darwin-19/2.2.0-static/eventmachine-1.2.7/gem_make.out
An error occurred while installing eventmachine (1.2.7), and Bundler
cannot continue.
Make sure that `gem install eventmachine -v '1.2.7' --source
'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
thin was resolved to 1.8.0, which depends on
eventmachine
gem_make.out
/Users/userName/.rbenv/versions/2.2.2/bin/ruby -r ./siteconf20210217-73483-4tmlc2.rb extconf.rb --with-cppflags=-I/usr/local/opt/openssl/include
checking for main() in -lcrypto... no
checking for openssl/ssl.h... yes
checking for openssl/err.h... yes
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_fd_select()... yes
checking for rb_fdset_t in ruby/intern.h... yes
checking for rb_wait_for_single_fd()... no
checking for rb_enable_interrupt()... no
checking for rb_time_new()... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... yes
checking for pipe2() in unistd.h... no
checking for accept4() in sys/socket.h... no
checking for SOCK_CLOEXEC in sys/socket.h... no
checking for sys/event.h... yes
checking for sys/queue.h... yes
checking for clock_gettime()... no
checking for gethrtime()... no
CXXFLAGS=$(cxxflags) -Wall -Wextra -Wno-deprecated-declarations -Wno-ignored-qualifiers -Wno-unused-result -Wno-address
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling page.cpp
compiling pipe.cpp
compiling binder.cpp
compiling rubymain.cpp
compiling ssl.cpp
compiling ed.cpp
compiling cmain.cpp
compiling em.cpp
em.cpp:706:13: error: use of undeclared identifier 'rb_thread_select'; did you mean 'rb_thread_fd_select'?
if ((ret = rb_thread_select(kqfd + 1, &fdreads, NULL, NULL, &tv)) < 1) {
^~~~~~~~~~~~~~~~
rb_thread_fd_select
/Users/userName/.rbenv/versions/2.2.2/include/ruby-2.2.0/ruby/intern.h:454:5: note: 'rb_thread_fd_select' declared here
int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
^
em.cpp:706:40: error: cannot initialize a parameter of type 'rb_fdset_t *' with an rvalue of type 'fd_set *'
if ((ret = rb_thread_select(kqfd + 1, &fdreads, NULL, NULL, &tv)) < 1) {
^~~~~~~~
/Users/userName/.rbenv/versions/2.2.2/include/ruby-2.2.0/ruby/intern.h:454:42: note: passing argument to parameter here
int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
^
2 errors generated.
make: *** [em.o] Error 1
make failed, exit code 2
Gemfile
source 'https://rubygems.org'
ruby '2.2.2'
gem 'json' # JSON
gem 'foreman' # Process management
gem 'racksh'
gem 'thin'
gem 'rack-cors', :require => 'rack/cors'
gem 'sprockets'
gem 'rake'
# Formatting
gem 'nokogiri'
gem 'chronic'
gem 'htmlentities', '~> 4.3', '>= 4.3.4'
# DB
gem 'pg'
gem 'activerecord', '~> 5.0.0' # Database
gem 'redis', '~>3.2'
# API Framework
gem 'grape'
group :development do
gem 'rb-readline'
gem 'rerun'
gem 'mina' # Deployment
end
group :test do
gem 'test-unit'
gem "rack-test", require: "rack/test"
gem 'test_xml'
gem 'bogus'
gem 'database_cleaner'
gem 'timecop'
end
group :development, :test do
gem 'awesome_print'
gem 'pry'
end
I tried the following ways to solve this problem.
brew link openssql --force
Warning: Refusing to link macOS provided/shadowed software: openssl#1.1
If you need to have openssl#1.1 first in your PATH, run:
echo 'export PATH="/usr/local/opt/openssl#1.1/bin:$PATH"' >> /Users/userName/.bash_profile
For compilers to find openssl#1.1 you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl#1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl#1.1/include"
For pkg-config to find openssl#1.1 you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openssl#1.1/lib/pkgconfig"
.base_profile
#..
export PATH="/usr/local/opt/openssl#1.1/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl#1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl#1.1/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl#1.1/lib/pkgconfig"
but result are the same
gem install eventmachine -- --with-cppflags=-I/usr/local/opt/openssl/include
gem install eventmachine --pre
bundle update eventmachine
add "gem 'eventmachine', '=1.0.3'" at Gemfile
change "gem 'eventmachine', '=1.0.4'" at Gemfile
change "gem 'eventmachine', '~>1.0.4'" at Gemfile
How can I solve this problem?
I work for
Mac Catalina 10.15.6

Related

Jekyll eventmachine 1.2.7 error on bundle

I'm trying to run bundle install using ubuntu 20.04, rvm with ruby 2.7.2, and I can't get the eventmachine gem to install.
After googling for hours I couldn't find a solution that works for me. I've tried deleting the lockfile and running bundle, ruby-dev is already installed with the latest version, I've tried running bundle with ruby 2.6.6, updating bundle, updating Jekyll from 4.0.0 to 4.2.0, and no matter what I try I'm still getting these error messages I don't understand, so any help would be VERY appreciated!
Gemfile
source 'https://rubygems.org'
gem 'jekyll', '4.0.0'
group :jekyll_plugins do
gem 'jekyll-feed', '0.12.1'
gem 'jekyll-paginate', '1.1.0'
gem 'jekyll-seo-tag', '2.6.1'
gem 'jekyll-sitemap', '1.3.1'
end
Relevant bundle log
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/jordan/Programming/galblog/vendor/bundle/ruby/2.7.0/gems/eventmachine-1.2.7/ext
/home/jordan/.rvm/rubies/ruby-2.7.2/bin/ruby -I /home/jordan/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0 -r ./siteconf20210214-26199-1f75y70.rb extconf.rb
checking for -lcrypto... yes
checking for -lssl... yes
checking for openssl/ssl.h... yes
checking for openssl/err.h... yes
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_fd_select()... yes
checking for rb_fdset_t in ruby/intern.h... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_enable_interrupt()... no
checking for rb_time_new()... yes
checking for inotify_init() in sys/inotify.h... yes
checking for writev() in sys/uio.h... yes
checking for pipe2() in unistd.h... yes
checking for accept4() in sys/socket.h... yes
checking for SOCK_CLOEXEC in sys/socket.h... yes
checking for sys/event.h... no
checking for epoll_create() in sys/epoll.h... yes
checking for clock_gettime()... yes
checking for CLOCK_MONOTONIC_RAW in time.h... yes
checking for CLOCK_MONOTONIC in time.h... yes
CXXFLAGS=-g -O2 -Wall -Wextra -Wno-deprecated-declarations -Wno-ignored-qualifiers -Wno-unused-result -Wno-address
creating Makefile
current directory: /home/jordan/Programming/galblog/vendor/bundle/ruby/2.7.0/gems/eventmachine-1.2.7/ext
make "DESTDIR=" clean
current directory: /home/jordan/Programming/galblog/vendor/bundle/ruby/2.7.0/gems/eventmachine-1.2.7/ext
make "DESTDIR="
compiling binder.cpp
compiling cmain.cpp
compiling ed.cpp
compiling em.cpp
em.cpp: In member function ‘void EventMachine_t::SignalLoopBreaker()’:
em.cpp:316:14: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
316 | (void)write (LoopBreakerWriter, "", 1);
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
em.cpp: In member function ‘void EventMachine_t::_ReadLoopBreaker()’:
em.cpp:1109:13: warning: ignoring return value of ‘ssize_t read(int, void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
1109 | (void)read (LoopBreakerReader, buffer, sizeof(buffer));
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compiling kb.cpp
kb.cpp: In member function ‘virtual void KeyboardDescriptor::Read()’:
kb.cpp:77:13: warning: ignoring return value of ‘ssize_t read(int, void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
77 | (void)read (GetSocket(), &c, 1);
| ~~~~~^~~~~~~~~~~~~~~~~~~~
compiling page.cpp
compiling pipe.cpp
compiling rubymain.cpp
rubymain.cpp: In function ‘void event_callback_wrapper(uintptr_t, int, const char*, long unsigned int)’:
rubymain.cpp:220:105: warning: ‘VALUE ruby::backward::cxxanyargs::rb_rescue(VALUE (*)(...), VALUE, VALUE (*)(...), VALUE)’ is deprecated: Use of ANYARGS in this function is deprecated
[-Wdeprecated-declarations]
220 | rb_rescue((VALUE (*)(ANYARGS))event_callback, (VALUE)&e, (VALUE (*)(ANYARGS))event_error_handler, Qnil);
| ^
In file included from /home/jordan/.rvm/rubies/ruby-2.7.2/include/ruby-2.7.0/ruby/ruby.h:2863,
from /home/jordan/.rvm/rubies/ruby-2.7.2/include/ruby-2.7.0/ruby.h:33,
from em.h:24,
from project.h:168,
from rubymain.cpp:20:
/home/jordan/.rvm/rubies/ruby-2.7.2/include/ruby-2.7.0/ruby/backward/cxxanyargs.hpp:198:1: note: declared here
198 | rb_rescue(type *q, VALUE w, type *e, VALUE r)
| ^~~~~~~~~
rubymain.cpp:220:105: warning: ‘VALUE ruby::backward::cxxanyargs::rb_rescue(VALUE (*)(...), VALUE, VALUE (*)(...), VALUE)’ is deprecated: Use of ANYARGS in this function is deprecated
[-Wdeprecated-declarations]
220 | rb_rescue((VALUE (*)(ANYARGS))event_callback, (VALUE)&e, (VALUE (*)(ANYARGS))event_error_handler, Qnil);
| ^
In file included from /home/jordan/.rvm/rubies/ruby-2.7.2/include/ruby-2.7.0/ruby/ruby.h:2863,
from /home/jordan/.rvm/rubies/ruby-2.7.2/include/ruby-2.7.0/ruby.h:33,
from em.h:24,
from project.h:168,
from rubymain.cpp:20:
/home/jordan/.rvm/rubies/ruby-2.7.2/include/ruby-2.7.0/ruby/backward/cxxanyargs.hpp:198:1: note: declared here
198 | rb_rescue(type *q, VALUE w, type *e, VALUE r)
| ^~~~~~~~~
compiling ssl.cpp
linking shared-object rubyeventmachine.so
current directory: /home/jordan/Programming/galblog/vendor/bundle/ruby/2.7.0/gems/eventmachine-1.2.7/ext
make "DESTDIR=" install
make: /usr/bin/mkdir: Command not found
make: *** [Makefile:202: .sitearchdir.time] Error 127
make install failed, exit code 2
Gem files will remain installed in /home/jordan/Programming/galblog/vendor/bundle/ruby/2.7.0/gems/eventmachine-1.2.7 for inspection.
Results logged to /home/jordan/Programming/galblog/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/eventmachine-1.2.7/gem_make.out
An error occurred while installing eventmachine (1.2.7), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '1.2.7' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
jekyll-feed was resolved to 0.12.1, which depends on
jekyll was resolved to 4.0.0, which depends on
em-websocket was resolved to 0.5.2, which depends on
eventmachine
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/jordan/Programming/galblog/vendor/bundle/ruby/2.7.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
/home/jordan/.rvm/rubies/ruby-2.7.2/bin/ruby -I /home/jordan/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0 -r ./siteconf20210214-26199-8qwb9v.rb extconf.rb
creating Makefile
current directory: /home/jordan/Programming/galblog/vendor/bundle/ruby/2.7.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
make "DESTDIR=" clean
current directory: /home/jordan/Programming/galblog/vendor/bundle/ruby/2.7.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
make "DESTDIR="
compiling ruby_http_parser.c
compiling ryah_http_parser.c
linking shared-object ruby_http_parser.so
current directory: /home/jordan/Programming/galblog/vendor/bundle/ruby/2.7.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
make "DESTDIR=" install
make: /usr/bin/mkdir: Command not found
make: *** [Makefile:202: .sitearchdir.time] Error 127
make install failed, exit code 2
Gem files will remain installed in /home/jordan/Programming/galblog/vendor/bundle/ruby/2.7.0/gems/http_parser.rb-0.6.0 for inspection.
Results logged to /home/jordan/Programming/galblog/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/http_parser.rb-0.6.0/gem_make.out
An error occurred while installing http_parser.rb (0.6.0), and Bundler cannot continue.
Make sure that `gem install http_parser.rb -v '0.6.0' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
jekyll-feed was resolved to 0.12.1, which depends on
jekyll was resolved to 4.0.0, which depends on
em-websocket was resolved to 0.5.2, which depends on
http_parser.rb
I tried again, this time using ruby 2.7.1 instead of 2.7.2 and it worked.
I guess some update in ruby broke it, so for anyone stuck on this try using 2.7.1 or not the latest version of ruby.

Rails Error Running Gem Install PG

I am trying to push my app to Heroku and I configured my gemfile as such:
group :production do
gem 'pg', '0.18.4'
gem 'rails_12factor', '0.0.2'
gem 'puma'
end
And I am getting this error in my console when running bundle install:
An error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.4'` succeeds before bundling.
Then when I run gem install pg -v '0.18.4', I get the following:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
When I run sudo gem install pg -v '0.18.4'
I get the following:
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.0.0/gems/pg-0.18.4/ext
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20160125-5501-ugsd1s.rb extconf.rb
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... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** 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.
UPDATE
I reinstalled RVM and rails and now when I run gem install pg -v '0.18.4', it runs successfully:
Successfully installed pg-0.18.4
Parsing documentation for pg-0.18.4
Done installing documentation for pg after 3 seconds
1 gem installed
But when run bundle install, I get this:
Installing pg 0.18.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/benwong/Desktop/ruby/rails_projects/blog2/vendor/bundle/ruby/2.2.0/gems/pg-0.18.4/ext
/Users/benwong/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20160126-44660-1ufenyc.rb extconf.rb --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config
Using config values from /Applications/Postgres.app/Contents/MacOS/bin/pg_config
sh: /Applications/Postgres.app/Contents/MacOS/bin/pg_config: No such file or directory
sh: /Applications/Postgres.app/Contents/MacOS/bin/pg_config: No such file or directory
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 PQconnectionUsedPassword()... yes
checking for PQisthreadsafe()... yes
checking for PQprepare()... yes
checking for PQexecParams()... yes
checking for PQescapeString()... yes
checking for PQescapeStringConn()... yes
checking for PQescapeLiteral()... yes
checking for PQescapeIdentifier()... yes
checking for PQgetCancel()... yes
checking for lo_create()... yes
checking for pg_encoding_to_char()... yes
checking for pg_char_to_encoding()... yes
checking for PQsetClientEncoding()... yes
checking for PQlibVersion()... yes
checking for PQping()... yes
checking for PQsetSingleRowMode()... yes
checking for PQconninfo()... yes
checking for rb_encdb_alias()... yes
checking for rb_enc_alias()... yes
checking for rb_thread_call_without_gvl()... yes
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_fd_select()... yes
checking for rb_w32_wrap_io_handle()... no
checking for rb_str_modify_expand()... yes
checking for rb_hash_dup()... yes
checking for PGRES_COPY_BOTH in libpq-fe.h... yes
checking for PGRES_SINGLE_TUPLE in libpq-fe.h... yes
checking for PG_DIAG_TABLE_NAME in libpq-fe.h... yes
checking for struct pgNotify.extra in libpq-fe.h... yes
checking for unistd.h... yes
checking for inttypes.h... yes
checking for ruby/st.h... yes
checking for C99 variable length arrays... yes
creating extconf.h
creating Makefile
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/benwong/Desktop/ruby/rails_projects/blog2/vendor/bundle/ruby/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/pg-0.18.4/mkmf.log
current directory: /Users/benwong/Desktop/ruby/rails_projects/blog2/vendor/bundle/ruby/2.2.0/gems/pg-0.18.4/ext
make "DESTDIR=" clean
current directory: /Users/benwong/Desktop/ruby/rails_projects/blog2/vendor/bundle/ruby/2.2.0/gems/pg-0.18.4/ext
make "DESTDIR="
compiling gvl_wrappers.c
compiling pg.c
compiling pg_binary_decoder.c
compiling pg_binary_encoder.c
compiling pg_coder.c
compiling pg_connection.c
pg_connection.c:2394:3: warning: implicit declaration of function 'gettimeofday' is invalid in C99 [-Wimplicit-function-declaration]
gettimeofday(&currtime, NULL);
^
1 warning generated.
compiling pg_copy_coder.c
compiling pg_errors.c
compiling pg_result.c
compiling pg_text_decoder.c
compiling pg_text_encoder.c
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
compiling pg_type_map_by_mri_type.c
compiling pg_type_map_by_oid.c
compiling pg_type_map_in_ruby.c
compiling util.c
linking shared-object pg_ext.bundle
ld: warning: directory not found for option '-L/Users/haven/.sm/pkg/active/lib'
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/benwong/Desktop/ruby/rails_projects/blog2/vendor/bundle/ruby/2.2.0/gems/p
g-0.18.4 for inspection.
Results logged to /Users/benwong/Desktop/ruby/rails_projects/blog2/vendor/bundle/ruby/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/pg-0.18.4/gem_make.out
Using puma 2.15.3
Using rails_serve_static_assets 0.0.4
Using rails_stdout_logging 0.0.4
Using sass 3.4.21
Using tilt 2.0.2
Using spring 1.6.2
Using rdoc 4.2.1
Using tzinfo 1.2.2
Using nokogiri 1.6.7.2
Using rack-test 0.6.3
Using warden 1.2.4
Using mail 2.6.3
Using binding_of_caller 0.7.2
Using coffee-script 2.4.1
Using uglifier 2.7.2
Using sprockets 3.5.2
An error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.4'` succeeds before bundling.
You need to have PostgreSQL installed to install pg gem. Also PATHs will need to be configured.
You can use http://postgresapp.com/ to easily install PostgreSQL on Mac. And use this to configure PATH: http://postgresapp.com/documentation/cli-tools.html
Try this it worked for me it must Have all psql dependency so it will work
sudo apt-get install -y libpq-dev build-essential postgresql-server-dev-all libpgsql-ruby postgresql ruby-dev && gem install pg

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension Linux Mint

While running bundle install i am getting the following error.
Running on Linux Mint 17.0
Rails 4.0.2
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/dubzero/.rvm/rubies/ruby-2.0.0-p643/bin/ruby extconf.rb
checking for ffi_call() in -lffi... yes
checking for ffi_prep_closure()... yes
checking for ffi_raw_call()... yes
checking for ffi_prep_raw_closure()... yes
checking for rb_thread_blocking_region()... yes
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
checking for ffi_prep_cif_var()... yes
creating extconf.h
creating Makefile
make "DESTDIR="
compiling LastError.c
compiling Type.c
compiling ClosurePool.c
compiling MemoryPointer.c
compiling DataConverter.c
compiling DynamicLibrary.c
compiling FunctionInfo.c
compiling StructByReference.c
compiling Buffer.c
compiling Types.c
compiling Platform.c
compiling ffi.c
compiling Function.c
compiling Thread.c
compiling LongDouble.c
compiling Struct.c
compiling Variadic.c
compiling Call.c
Call.c: In function ‘rbffi_SetupCallParams’:
Call.c:206:28: error: ‘UINT32_ADJ’ undeclared (first use in this function)
ADJ(param, UINT32);
^
Call.c:83:58: note: in definition of macro ‘ADJ’
# define ADJ(p, a) ((p) = (FFIStorage*) (((char *) p) + a##_ADJ))
^
Call.c:206:28: note: each undeclared identifier is reported only once for each function it appears in
ADJ(param, UINT32);
^
Call.c:83:58: note: in definition of macro ‘ADJ’
# define ADJ(p, a) ((p) = (FFIStorage*) (((char *) p) + a##_ADJ))
^
Call.c:230:28: error: ‘UINT64_ADJ’ undeclared (first use in this function)
ADJ(param, UINT64);
^
Call.c:83:58: note: in definition of macro ‘ADJ’
# define ADJ(p, a) ((p) = (FFIStorage*) (((char *) p) + a##_ADJ))
^
make: *** [Call.o] Ошибка 1
Gem files will remain installed in /home/dubzero/.rvm/gems/ruby-2.0.0-p643#railstutorial_rails_4_0/gems/ffi-1.9.7 for inspection.
Results logged to /home/dubzero/.rvm/gems/ruby-2.0.0-p643#railstutorial_rails_4_0/gems/ffi-1.9.7/ext/ffi_c/gem_make.out
An error occurred while installing ffi (1.9.7), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.9.7'` succeeds before bundling.
Gemfile
source 'https://rubygems.org'
ruby '2.0.0'
#ruby-gemset=railstutorial_rails_4_0
gem 'rails', '4.0.2'
group :development, :test do
gem 'sqlite3', '1.3.8'
gem 'rspec-rails', '2.13.1'
end
group :test do
gem 'selenium-webdriver', '2.35.1'
gem 'capybara', '2.1.0'
end
gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
group :doc do
gem 'sdoc', '0.3.20', require: false
end
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
end
Any ideas?
Thank you in advance
Try using an older version of ffi. For example, in your Gemfile, put:
gem 'ffi', '1.9.3'

Cannot install Ruby AMQP Gem

Currently, I have installed Ruby (ruby 1.9.3p194 (2012-04-20 revision 35410) ) on my Ubuntu 11.10. Wanted to install the AMQP gem using "sudo gem install amqp". But it fails with the following error message :
Building native extensions. This could take a while...
ERROR: Error installing amqp:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for main() in -lssl... no
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... yes
checking for inotify_init() in sys/inotify.h... yes
checking for writev() in sys/uio.h... yes
checking for rb_thread_check_ints()... yes
checking for rb_time_new()... yes
checking for sys/event.h... no
checking for epoll_create() in sys/epoll.h... yes
creating Makefile
make
compiling ed.cpp
make: g++: Command not found
make: *** [ed.o] Error 127
Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0/ext/gem_make.out
Would appreciate if someone could help me out. Thanks.
In order to compile native extensions, you need a compiler. Just install g++ and friends using:
sudo apt-get install build-essential
and try again.

ROR ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

I am trying to run rails application. I have installed rails 3 on my computer.. When trying to run it using rails server command, it is asking me to type "bundle install" in the command prompt:
C:\Users\Webyana Tech\Desktop\Rails3\wy_editor>bundle install
Fetching source index for http://rubygems.org/
Fetching source index for http://gems.github.com/
Using rake (0.8.7)
Using ZenTest (4.5.0)
Using RubyInline (3.8.6)
Using abstract (1.0.0)
Using activesupport (3.0.0)
Using builder (2.1.2)
Using i18n (0.4.2)
Using activemodel (3.0.0)
Using erubis (2.6.6)
Using rack (1.2.2)
Using rack-mount (0.6.13)
Using rack-test (0.5.7)
Using tzinfo (0.3.25)
Using actionpack (3.0.0)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.15)
Using actionmailer (3.0.0)
Using arel (1.0.1)
Using activerecord (3.0.0)
Using activeresource (3.0.0)
Using addressable (2.2.4)
Using crack (0.1.8)
Installing eventmachine (0.12.10) with native extensions C:/Ruby/lib/ruby/site_r
uby/1.9.1/rubygems/installer.rb:529:in `rescue in block in build_extensions':
ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
C:/Ruby/bin/ruby.exe extconf.rb
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... no
checking for rb_thread_check_ints()... yes
checking for rb_time_new()... yes
checking for windows.h... yes
checking for winsock.h... yes
checking for main() in -lkernel32... yes
checking for main() in -lrpcrt4... yes
checking for main() in -lgdi32... yes
checking for main() in -lssl... no
creating Makefile
make
g++ -I. -IC:/Ruby/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby/include/ruby-1.9.1/r
uby/backward -I/C/Ruby/include/ruby-1.9.1 -I. -DBUILD_FOR_RUBY -DHAVE_RB_THREAD_
BLOCKING_REGION -DHAVE_TBR -DHAVE_RB_THREAD_CHECK_INTS -DHAVE_RB_TIME_NEW -DOS_W
IN32 -DHAVE_WINDOWS_H -DHAVE_WINSOCK_H -DWITHOUT_SSL -DHAVE_MAKE_PAIR -O3 -g
-Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -
Wno-missing-field-initializers -Wno-long-long -o binder.o -c binder.cpp
In file included from project.h:137:0,
from binder.cpp:20:
binder.h:35:34: warning: type qualifiers ignored on function return type
In file included from project.h:138:0,
from binder.cpp:20:
Please help me.. I tried googling for this.. But couldnt find anything which is same as above... I guess the eventmachine is failing to install...
I'm having the exact error messages as yours when doing a "bundle install". For now you'll have to install an older version of "eventmachine", separately. Type "gem install eventmachine -v 0.12.8". It installed successfully for me.
#user662539: Well, I did have "eventmachine (0.12.8)" installed successfully, but I'm still couldn't start thin server. I got a error message prompting "This application has failed to start because msvcrt-ruby18.dll was not found. Re-installing the application may fix this problem.". Even if I copied over "msvcrt-ruby18.dll" from "\Ruby187\bin" to "\Ruby192\bin", I got another error message regarding "Segmentation fault".
So I revert my ruby version back to ruby 1.8.7 (2011-02-18 patchlevel 334) [i386-mingw32] and able to start thin server.
Sorry I'm not able to help you on this one, but these my new findings.

Resources