Package configuration for sqlite3 is not found - ruby-on-rails

I'm trying to run rails server and there is problem with sqlite3.
When i run bin/rails server
Could not find gem 'sqlite3 (~> 1.4)' in locally installed gems.
Run bundle install to install missing gems.
So i try to run bundle install
Installing sqlite3 1.4.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
And the last thing I tried is checking the log file in /var/lib/gems/2.7.0/extensions/x86_64-linux/2.7.0/sqlite3-1.4.2/mkmf.log
package configuration for sqlite3 is not found find_header: checking
for sqlite3.h... -------------------- no
"x86_64-linux-gnu-gcc -o conftest
-I/usr/include/x86_64-linux-gnu/ruby-2.7.0 -I/usr/include/ruby-2.7.0/ruby/backward -I/usr/include/ruby-2.7.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/build/ruby2.7-aN7IdK/ruby2.7-2.7.3=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c -L. -L/usr/lib/x86_64-linux-gnu -L. -Wl,-z,relro
-Wl,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -lruby-2.7 -lm -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return !!argv[argc];
6: }
/* end */
"x86_64-linux-gnu-gcc -E -I/usr/include/x86_64-linux-gnu/ruby-2.7.0
-I/usr/include/ruby-2.7.0/ruby/backward -I/usr/include/ruby-2.7.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/build/ruby2.7-aN7IdK/ruby2.7-2.7.3=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c -o conftest.i" conftest.c:3:10: fatal error: sqlite3.h: No
such file or directory
3 | #include <sqlite3.h>
| ^~~~~~~~~~~ compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <sqlite3.h>
/* end */
Any suggestion?

Related

pg 1.0.0 `fatal error: 'libpq-fe.h' file not found`

An error occurred while installing pg (1.0.0), and Bundler cannot continue
I have an issue with the bundle install and cannot complete the installation.
What can I do to finish the bundle?
find_executable: checking for pg_config... -------------------- no
--------------------
find_header: checking for libpq-fe.h... -------------------- no
"clang -o conftest -I/Users/leotyndall/.rbenv/versions/2.4.2/include/ruby-2.4.0/x86_64-darwin17 -I/Users/leotyndall/.rbenv/versions/2.4.2/include/ruby-2.4.0/ruby/backward -I/Users/leotyndall/.rbenv/versions/2.4.2/include/ruby-2.4.0 -I. -I/Users/leotyndall/.rbenv/versions/2.4.2/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -pipe conftest.c -L. -L/Users/leotyndall/.rbenv/versions/2.4.2/lib -L. -L/Users/leotyndall/.rbenv/versions/2.4.2/lib -fstack-protector -L/usr/local/lib -lruby-static -framework CoreFoundation -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
"clang -E -I/Users/leotyndall/.rbenv/versions/2.4.2/include/ruby-2.4.0/x86_64-darwin17 -
I/Users/leotyndall/.rbenv/versions/2.4.2/include/ruby-
2.4.0/ruby/backward -
I/Users/leotyndall/.rbenv/versions/2.4.2/include/ruby-2.4.0 -I. -
I/Users/leotyndall/.rbenv/versions/2.4.2/include -D_XOPEN_SOURCE -
D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-
error=shorten-64-to-32 -pipe conftest.c -o conftest.i"
conftest.c:3:10: fatal error: 'libpq-fe.h' file not found
#include <libpq-fe.h>
^~~~~~~~~~~~
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
/* end */
--------------------
extconf failed, exit code 1
An error occurred while installing pg (1.0.0), and Bundler cannot continue.
Make sure that `gem install pg -v '1.0.0'` succeeds before bundling.
Try installing libpq-dev or its equivalent for your OS:
For Ubuntu systems: sudo apt-get install libpq-dev
On Red Hat Linux (RHEL) systems: yum install postgresql-devel
For Mac Homebrew: brew install postgresql
For Mac MacPorts PostgreSQL: gem install pg -- --with-pg-config=/opt/local/lib/postgresql[version number]/bin/pg_config
For OpenSuse: zypper in postgresql-devel
For macos, the above answers did not work or were not practical for me. I didn't want to install all of postgres.
$ brew install libpq
$ bundle config --local build.pg --with-opt-dir="/usr/local/opt/libpq"
$ bundle install
Reference: https://michaelrigart.be/install-pg-ruby-gem-without-postgresql/
I solved this by installing the library
brew install libpqxx
Next, install pg normally... you can use gem
gem install pg
brew install libpq
gem install pg -v '1.2.3' --source 'https://rubygems.org/' -- --with-pg-config=/opt/homebrew/Cellar/libpq/13.2/bin/pg_config

How to install Nokogiri on Mac OS Yosemite

When I try to install Nokogiri using:
gem install nokogiri
I get this error:
ERROR: While executing gem ... (Errno::EACCES)
Permission denied # rb_sysopen - /usr/local/lib/ruby/gems/2.3.0/gems/nokogiri-1.6.8.1/.autotest
I ran both of these commands first:
gem update --system
xcode-select --install
Can anyone see what's wrong here?
If I run this using sudo I get:
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/2.3.0/gems/nokogiri-1.6.8.1/ext/nokogiri
/usr/local/opt/ruby/bin/ruby -r ./siteconf20161127-35515-164lnl6.rb extconf.rb
checking if the C compiler accepts ... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.
and here's the log file:
"clang -o conftest -I/usr/local/Cellar/ruby/2.3.3/include/ruby-2.3.0/x86_64-darwin14 -I/usr/local/Cellar/ruby/2.3.3/include/ruby-2.3.0/ruby/backward -I/usr/local/Cellar/ruby/2.3.3/include/ruby-2.3.0 -I. -I/usr/local/opt/libyaml/include -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -fno-common -pipe conftest.c -L. -L/usr/local/Cellar/ruby/2.3.3/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -lruby.2.3.0 -lpthread -ldl -lobjc "
Undefined symbols for architecture x86_64:
"start", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
You can try to do this:
gem install nokogiri -v '1.6.8.1' -- --use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2
So this turned out to be a mix of permissions and file ownership. Once that was all sorted out I just had to rerun the gem install and close then reopen the terminal before running rails -v.

gem install nokogiri -v '1.6.8.1' fails

Building a new Rails app and getting a problem with nokogiri. Said to try gem install nokogiri -v '1.6.8.1' which fails with output below. I tried deleting Gemfile.lock and using the Gemfile from another app which has no problem—bundle install still fails. The original failure is bundle install which continues to work in other apps.
From console:
gem install nokogiri -v '1.6.8.1'
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
current directory: ~/.gem/ruby/2.3.1/gems/nokogiri-1.6.8.1/ext/nokogiri
~/.rubies/ruby-2.3.1/bin/ruby -r ./siteconf20161008-60071-tmqi2l.rb extconf.rb
Ignoring byebug-6.0.2 because its extensions are not built. Try: gem pristine byebug --version 6.0.2
Ignoring byebug-3.4.0 because its extensions are not built. Try: gem pristine byebug --version 3.4.0
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
Using mini_portile version 2.1.0
checking for iconv.h... yes
checking for gzdopen() in -lz... yes
checking for iconv using --with-opt-* flags... yes
************************************************************************
IMPORTANT NOTICE:
Building Nokogiri with a packaged version of libxml2-2.9.4.
Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:
gem install nokogiri -- --use-system-libraries
[--with-xml2-config=/path/to/xml2-config]
[--with-xslt-config=/path/to/xslt-config]
If you are using Bundler, tell it to use the option:
bundle config build.nokogiri --use-system-libraries
bundle install
Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Extracting libxml2-2.9.4.tar.gz into tmp/x86_64-apple-darwin16.1.0/ports/libxml2/2.9.4... OK
Running 'configure' for libxml2 2.9.4... OK
Running 'compile' for libxml2 2.9.4... ERROR, review '~/.gem/ruby/2.3.1/gems/nokogiri-1.6.8.1/ext/nokogiri/tmp/x86_64-apple-darwin16.1.0/ports/libxml2/2.9.4/compile.log' to see what happened. Last lines are:
========================================================================
unsigned short* in = (unsigned short*) inb;
^~~~~~~~~~~~~~~~~~~~~
encoding.c:815:27: warning: cast from 'unsigned char *' to 'unsigned short *' increases required alignment from 1 to 2 [-Wcast-align]
unsigned short* out = (unsigned short*) outb;
^~~~~~~~~~~~~~~~~~~~~~
4 warnings generated.
CC error.lo
CC parserInternals.lo
CC parser.lo
CC tree.lo
CC hash.lo
CC list.lo
CC xmlIO.lo
xmlIO.c:1450:52: error: use of undeclared identifier 'LZMA_OK'
ret = (__libxml2_xzclose((xzFile) context) == LZMA_OK ) ? 0 : -1;
^
1 error generated.
make[2]: *** [xmlIO.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
========================================================================
*** 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
--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=~/.rubies/ruby-2.3.1/bin/$(RUBY_BASE_NAME)
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
~/.rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:366:in `block in execute': Failed to complete compile task (RuntimeError)
from ~/.rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:337:in `chdir'
from ~/.rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:337:in `execute'
from ~/.rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:111:in `compile'
from ~/.rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:150:in `cook'
from extconf.rb:365:in `block (2 levels) in process_recipe'
from extconf.rb:258:in `block in chdir_for_build'
from extconf.rb:257:in `chdir'
from extconf.rb:257:in `chdir_for_build'
from extconf.rb:364:in `block in process_recipe'
from extconf.rb:263:in `tap'
from extconf.rb:263:in `process_recipe'
from extconf.rb:556:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
~/.gem/ruby/2.3.1/extensions/x86_64-darwin-16/2.3.0-static/nokogiri-1.6.8.1/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in ~/.gem/ruby/2.3.1/gems/nokogiri-1.6.8.1 for inspection.
Results logged to ~/.gem/ruby/2.3.1/extensions/x86_64-darwin-16/2.3.0-static/nokogiri-1.6.8.1/gem_make.out
mkmf.log:
"clang -o conftest -I~/.rubies/ruby-2.3.1/include/ruby-2.3.0/x86_64-darwin16 -I~/.rubies/ruby-2.3.1/include/ruby-2.3.0/ruby/backward -I~/.rubies/ruby-2.3.1/include/ruby-2.3.0 -I. -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/gdbm/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -pipe conftest.c -L. -L~/.rubies/ruby-2.3.1/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/gdbm/lib -L. -fstack-protector -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/gdbm/lib -lruby-static -framework CoreFoundation -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
"clang -I~/.rubies/ruby-2.3.1/include/ruby-2.3.0/x86_64-darwin16 -I~/.rubies/ruby-2.3.1/include/ruby-2.3.0/ruby/backward -I~/.rubies/ruby-2.3.1/include/ruby-2.3.0 -I. -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/gdbm/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -pipe -Werror -c conftest.c"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */
"clang -I~/.rubies/ruby-2.3.1/include/ruby-2.3.0/x86_64-darwin16 -I~/.rubies/ruby-2.3.1/include/ruby-2.3.0/ruby/backward -I~/.rubies/ruby-2.3.1/include/ruby-2.3.0 -I. -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/gdbm/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -pipe -Wno-error=unused-command-line-argument-hard-error-in-future -Werror -c conftest.c"
error: unknown warning option '-Werror=unused-command-line-argument-hard-error-in-future'; did you mean '-Werror=unused-command-line-argument'? [-Werror,-Wunknown-warning-option]
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */
have_header: checking for iconv.h... -------------------- yes
"clang -E -I~/.rubies/ruby-2.3.1/include/ruby-2.3.0/x86_64-darwin16 -I~/.rubies/ruby-2.3.1/include/ruby-2.3.0/ruby/backward -I~/.rubies/ruby-2.3.1/include/ruby-2.3.0 -I. -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/gdbm/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -pipe conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <iconv.h>
/* end */
--------------------
have_library: checking for gzdopen() in -lz... -------------------- yes
"clang -o conftest -I~/.rubies/ruby-2.3.1/include/ruby-2.3.0/x86_64-darwin16 -I~/.rubies/ruby-2.3.1/include/ruby-2.3.0/ruby/backward -I~/.rubies/ruby-2.3.1/include/ruby-2.3.0 -I. -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/gdbm/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -pipe conftest.c -L. -L~/.rubies/ruby-2.3.1/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/gdbm/lib -L. -fstack-protector -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/gdbm/lib -lruby-static -framework CoreFoundation -lz -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <zlib.h>
4:
5: /*top*/
6: extern int t(void);
7: int main(int argc, char **argv)
8: {
9: if (argc > 1000000) {
10: printf("%p", &t);
11: }
12:
13: return 0;
14: }
15: int t(void) { void ((*volatile p)()); p = (void ((*)()))gzdopen; return !p; }
/* end */
--------------------
have_iconv?: checking for iconv using --with-opt-* flags... -------------------- yes
"clang -o conftest -I~/.rubies/ruby-2.3.1/include/ruby-2.3.0/x86_64-darwin16 -I~/.rubies/ruby-2.3.1/include/ruby-2.3.0/ruby/backward -I~/.rubies/ruby-2.3.1/include/ruby-2.3.0 -I. -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/gdbm/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -pipe conftest.c -L. -L~/.rubies/ruby-2.3.1/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/gdbm/lib -L. -fstack-protector -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/gdbm/lib -lruby-static -framework CoreFoundation -lpthread -ldl -lobjc "
Undefined symbols for architecture x86_64:
"_iconv", referenced from:
_main in conftest-d46614.o
"_iconv_open", referenced from:
_main in conftest-d46614.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <stdlib.h>
4: #include <iconv.h>
5:
6: int main(void)
7: {
8: iconv_t cd = iconv_open("", "");
9: iconv(cd, NULL, NULL, NULL, NULL);
10: return EXIT_SUCCESS;
11: }
/* end */
"clang -o conftest -I~/.rubies/ruby-2.3.1/include/ruby-2.3.0/x86_64-darwin16 -I~/.rubies/ruby-2.3.1/include/ruby-2.3.0/ruby/backward -I~/.rubies/ruby-2.3.1/include/ruby-2.3.0 -I. -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/gdbm/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -pipe conftest.c -L. -L~/.rubies/ruby-2.3.1/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/gdbm/lib -L. -fstack-protector -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/gdbm/lib -lruby-static -framework CoreFoundation -liconv -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <stdlib.h>
4: #include <iconv.h>
5:
6: int main(void)
7: {
8: iconv_t cd = iconv_open("", "");
9: iconv(cd, NULL, NULL, NULL, NULL);
10: return EXIT_SUCCESS;
11: }
/* end */
--------------------
gem_make.out:
current directory: ~/.gem/ruby/2.3.1/gems/nokogiri-1.6.8.1/ext/nokogiri
~/.rubies/ruby-2.3.1/bin/ruby -r ./siteconf20161008-60071-tmqi2l.rb extconf.rb
Ignoring byebug-6.0.2 because its extensions are not built. Try: gem pristine byebug --version 6.0.2
Ignoring byebug-3.4.0 because its extensions are not built. Try: gem pristine byebug --version 3.4.0
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
Using mini_portile version 2.1.0
checking for iconv.h... yes
checking for gzdopen() in -lz... yes
checking for iconv using --with-opt-* flags... yes
************************************************************************
IMPORTANT NOTICE:
Building Nokogiri with a packaged version of libxml2-2.9.4.
Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:
gem install nokogiri -- --use-system-libraries
[--with-xml2-config=/path/to/xml2-config]
[--with-xslt-config=/path/to/xslt-config]
If you are using Bundler, tell it to use the option:
bundle config build.nokogiri --use-system-libraries
bundle install
Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Extracting libxml2-2.9.4.tar.gz into tmp/x86_64-apple-darwin16.1.0/ports/libxml2/2.9.4... OK
Running 'configure' for libxml2 2.9.4... OK
Running 'compile' for libxml2 2.9.4... ERROR, review '~/.gem/ruby/2.3.1/gems/nokogiri-1.6.8.1/ext/nokogiri/tmp/x86_64-apple-darwin16.1.0/ports/libxml2/2.9.4/compile.log' to see what happened. Last lines are:
========================================================================
unsigned short* in = (unsigned short*) inb;
^~~~~~~~~~~~~~~~~~~~~
encoding.c:815:27: warning: cast from 'unsigned char *' to 'unsigned short *' increases required alignment from 1 to 2 [-Wcast-align]
unsigned short* out = (unsigned short*) outb;
^~~~~~~~~~~~~~~~~~~~~~
4 warnings generated.
CC error.lo
CC parserInternals.lo
CC parser.lo
CC tree.lo
CC hash.lo
CC list.lo
CC xmlIO.lo
xmlIO.c:1450:52: error: use of undeclared identifier 'LZMA_OK'
ret = (__libxml2_xzclose((xzFile) context) == LZMA_OK ) ? 0 : -1;
^
1 error generated.
make[2]: *** [xmlIO.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
========================================================================
*** 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
--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=~/.rubies/ruby-2.3.1/bin/$(RUBY_BASE_NAME)
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
~/.rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:366:in `block in execute': Failed to complete compile task (RuntimeError)
from ~/.rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:337:in `chdir'
from ~/.rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:337:in `execute'
from ~/.rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:111:in `compile'
from ~/.rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:150:in `cook'
from extconf.rb:365:in `block (2 levels) in process_recipe'
from extconf.rb:258:in `block in chdir_for_build'
from extconf.rb:257:in `chdir'
from extconf.rb:257:in `chdir_for_build'
from extconf.rb:364:in `block in process_recipe'
from extconf.rb:263:in `tap'
from extconf.rb:263:in `process_recipe'
from extconf.rb:556:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
~/.gem/ruby/2.3.1/extensions/x86_64-darwin-16/2.3.0-static/nokogiri-1.6.8.1/mkmf.log
extconf failed, exit code 1
Run this first:
xcode-select --install
Then rerun your bundle install
Reference: https://github.com/sparklemotion/nokogiri/issues/1483
I tried #the_basterd's recommendation. That didn't work, but the reference was good—thank you the_basterd. What worked from that reference was:
brew install libxml2
bundle config build.nokogiri --use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2
Reference: https://github.com/sparklemotion/nokogiri/issues/1483
Later postings at that ref said that what I posted above "is strongly recommended against by the Nokogiri."
brew unlink xz; bundle install; brew link xz is preferred.
You can also encounter the same error message if you've downloaded XCode Tools but haven't yet agreed to the license.
From Terminal, run:
sudo xcodebuild -license
Enter your admin password, space through the agreement and type agree to accept. Run brew doctor and if necessary, brew update and you should be in good shape.
I ran into this issue with nokogiri-1.6.8.1 while using bundle install --path vendor/bundle to install directly into a project located within a Google Drive sync folder. The hangup seemed related to libxml2.
While reading through the GitHub issue referenced by #Greg and #the_basterd, I noticed that someone was having trouble installing into a Box sync folder. Moving my project folder to another location worked.
Not sure what the underlying problem is when installing to a sync folder, but I'd be interested to learn if anyone had any thoughts.
Haven't tested this with Dropbox, but perhaps that would cause problems, too.

Installing TheRubyRacer gem on fedora 20 Error

I am working on a project, that needs therubyracer. When I do a bundle install I get the following error message when the bundler tries to install therubyracer.
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
checking for main() in -lpthread... yes
checking for v8.h... yes
creating Makefile
make "DESTDIR="
g++ -I. -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I. -D_FILE_OFFSET_BITS=64 -Wall -g -rdynamic -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -march=i686 -mtune=atom -fasynchronous-unwind-tables -m32 -o init.o -c init.cc
g++ -I. -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I. -D_FILE_OFFSET_BITS=64 -Wall -g -rdynamic -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -march=i686 -mtune=atom -fasynchronous-unwind-tables -m32 -o signature.o -c signature.cc
g++ -I. -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I. -D_FILE_OFFSET_BITS=64 -Wall -g -rdynamic -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -march=i686 -mtune=atom -fasynchronous-unwind-tables -m32 -o exception.o -c exception.cc
g++ -I. -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I. -D_FILE_OFFSET_BITS=64 -Wall -g -rdynamic -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -march=i686 -mtune=atom -fasynchronous-unwind-tables -m32 -o primitive.o -c primitive.cc
g++ -I. -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I. -D_FILE_OFFSET_BITS=64 -Wall -g -rdynamic -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -march=i686 -mtune=atom -fasynchronous-unwind-tables -m32 -o context.o -c context.cc
In file included from context.cc:1:0:
context.cc: In static member function ‘static VALUE rr::Context::SetEmbedderData(VALUE, VALUE, VALUE)’:
context.cc:81:23: error: ‘class v8::Context’ has no member named ‘SetEmbedderData’
Void(Context(self)->SetEmbedderData(NUM2INT(index), Value(data)));
^
rr.h:33:20: note: in definition of macro ‘Void’
#define Void(expr) expr; return Qnil;
^
context.cc: In static member function ‘static VALUE rr::Context::GetEmbedderData(VALUE, VALUE)’:
context.cc:85:23: error: ‘class v8::Context’ has no member named ‘GetEmbedderData’
Void(Context(self)->GetEmbedderData(NUM2INT(index)));
^
rr.h:33:20: note: in definition of macro ‘Void’
#define Void(expr) expr; return Qnil;
^
make: *** [context.o] Error 1
Gem files will remain installed in /home/anupam/.gem/ruby/gems/therubyracer-0.12.1 for inspection.
Results logged to /home/anupam/.gem/ruby/gems/therubyracer-0.12.1/ext/v8/gem_make.out
An error occurred while installing therubyracer (0.12.1), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.12.1'` succeeds before bundling.
When I run gem install therubyracer -v '0.12.1' or without the version, it still fails.
I am new to ruby so I don't really understand what is going on or why it is failing.
Any help on this is much appreciated.
I had the same problem with Fedora 24 x64 and the sudo dnf -y install gcc-c++ resolved my issue
I removed all gems.
Uninstalled ruby
Reinstalled ruby ruby-devel
Installed ruby and ruby-devel and install therubyracer and libv8 using yum NOT gem.
Then I ran bundle install and gem used the already installed gems that yum installed.
Thank god for fedora maintainers! You guys are awesome
I know it sounds dumb but I had the exact problem and it seems I lacked the package gcc-c++. Thought already had them. yum install gcc-c++ did the trick

Mac 10.8 + RVM: Installing Rails 4 Needs development tools?

I'm having issues installing Rails 4 with rvm. I saw another solution with removing rvm from my system, but that is not an option because I need isolated gemsets. This is my terminal:
Edmunds-MacBook-Pro:pipetask edmundmai$ rvm current
ruby-2.0.0-p247#pipetask
Edmunds-MacBook-Pro:pipetask edmundmai$ ls
Gemfile README.rdoc app config db lib public
Gemfile.lock Rakefile bin config.ru gcc-4.2 log vendor
Edmunds-MacBook-Pro:pipetask edmundmai$ gem install rails -v=4.0.0
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/edmundmai/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
*** 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/edmundmai/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
--with-atomic_reference-dir
--without-atomic_reference-dir
--with-atomic_reference-include
--without-atomic_reference-include=${atomic_reference-dir}/include
--with-atomic_reference-lib
--without-atomic_reference-lib=${atomic_reference-dir}/
/Users/edmundmai/.rvm/rubies/ruby-2.0.0-p247/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 /Users/edmundmai/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:519:in `try_link0'
from /Users/edmundmai/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:817:in `try_run'
from extconf.rb:26:in `<main>'
Gem files will remain installed in /Users/edmundmai/.rvm/gems/ruby-2.0.0-p247#pipetask/gems/atomic-1.1.14 for inspection.
Results logged to /Users/edmundmai/.rvm/gems/ruby-2.0.0-p247#pipetask/gems/atomic-1.1.14/ext/gem_make.out
Edmunds-MacBook-Pro:pipetask edmundmai$
How would I debug this? I don't even know which mkmf.log it is talking about, I have like 50 of them when I do locate mkmf.log. What is development tools? I have xcode 5 and command line tools.
==Update
This might be the mkmf.log file it was referring to?
Edmunds-MacBook-Pro:bin edmundmai$ more /Users/emai/mkmf.log
have_func: checking for rb_hash_foreach()... -------------------- yes
"clang -o conftest -I/Users/emai/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/x86_64-darwin11.4.2 -I/Users/emai/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/backward -I/Users/emai/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I/Users/emai/.rvm/usr/include -I/Users/emai/.rvm/usr/include -O3 -g3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -pipe conftest.c -L. -L/Users/emai/.rvm/rubies/ruby-2.0.0-p0/lib -L/Users/emai/.rvm/usr/lib -L. -fstack-protector -L/Users/emai/.rvm/usr/lib -L/Users/emai/.rvm/usr/lib -lruby-static -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(void) {return 0;}
/* end */
"clang -o conftest -I/Users/emai/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/x86_64-darwin11.4.2 -I/Users/emai/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/backward -I/Users/emai/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I/Users/emai/.rvm/usr/include -I/Users/emai/.rvm/usr/include -O3 -g3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -pipe conftest.c -L. -L/Users/emai/.rvm/rubies/ruby-2.0.0-p0/lib -L/Users/emai/.rvm/usr/lib -L. -fstack-protector -L/Users/emai/.rvm/usr/lib -L/Users/emai/.rvm/usr/lib -lruby-static -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: /*top*/
4: int main(void) {return 0;}
5: extern int t(void);
6: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_hash_foreach; return 0; }
/* end */
--------------------

Resources