I have created new Ruby on Rails project and when I tried to connect the server with the "rails s" command, I have an error that says Could not find gem 'pg (>= 0.18, < 2.0)' in any of the gem sources listed in your Gemfile.
So I decided to install pg gem with "gem install pg" but got another huge error message:
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: /Users/kota/.rvm/gems/ruby-2.7.0/gems/pg-1.2.3/ext
/Users/kota/.rvm/rubies/ruby-2.7.0/bin/ruby -I /Users/kota/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0 -r ./siteconf20200914-24744-m9qarh.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... yes
checking for PQsetSingleRowMode()... yes
checking for PQconninfo()... yes
checking for PQsslAttribute()... yes
checking for PQresultVerboseErrorMessage()... yes
checking for PQencryptPasswordConn()... yes
checking for PQresultMemorySize()... yes
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/kota/.rvm/gems/ruby-2.7.0/gems/pg-1.2.3/ext
make "DESTDIR=" clean
current directory: /Users/kota/.rvm/gems/ruby-2.7.0/gems/pg-1.2.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:216: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/kota/.rvm/rubies/ruby-2.7.0/include/ruby-2.7.0/ruby/ruby.h:1007:6: note: expanded from macro 'RSTRING_LEN'
RSTRING_EMBED_LEN(str) : \
^~~~~~~~~~~~~~~~~~~~~~
/Users/kota/.rvm/rubies/ruby-2.7.0/include/ruby-2.7.0/ruby/ruby.h:1003:6: note: expanded from macro 'RSTRING_EMBED_LEN'
(long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pg_coder.c:216: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/kota/.rvm/rubies/ruby-2.7.0/include/ruby-2.7.0/ruby/ruby.h:1008: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:228:15: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
strlen = RSTRING_LEN(subint);
~ ^~~~~~~~~~~~~~~~~~~
/Users/kota/.rvm/rubies/ruby-2.7.0/include/ruby-2.7.0/ruby/ruby.h:1007:6: note: expanded from macro 'RSTRING_LEN'
RSTRING_EMBED_LEN(str) : \
^~~~~~~~~~~~~~~~~~~~~~
/Users/kota/.rvm/rubies/ruby-2.7.0/include/ruby-2.7.0/ruby/ruby.h:1003:6: note: expanded from macro 'RSTRING_EMBED_LEN'
(long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pg_copy_coder.c:228:15: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
strlen = RSTRING_LEN(subint);
~ ^~~~~~~~~~~~~~~~~~~
/Users/kota/.rvm/rubies/ruby-2.7.0/include/ruby-2.7.0/ruby/ruby.h:1008:28: note: expanded from macro 'RSTRING_LEN'
RSTRING(str)->as.heap.len)
~~~~~~~~~~~~~~~~~~~~~~^~~
pg_copy_coder.c:534: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:196:15: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
strlen = RSTRING_LEN(subint);
~ ^~~~~~~~~~~~~~~~~~~
/Users/kota/.rvm/rubies/ruby-2.7.0/include/ruby-2.7.0/ruby/ruby.h:1007:6: note: expanded from macro 'RSTRING_LEN'
RSTRING_EMBED_LEN(str) : \
^~~~~~~~~~~~~~~~~~~~~~
/Users/kota/.rvm/rubies/ruby-2.7.0/include/ruby-2.7.0/ruby/ruby.h:1003:6: note: expanded from macro 'RSTRING_EMBED_LEN'
(long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pg_record_coder.c:196:15: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
strlen = RSTRING_LEN(subint);
~ ^~~~~~~~~~~~~~~~~~~
/Users/kota/.rvm/rubies/ruby-2.7.0/include/ruby-2.7.0/ruby/ruby.h:1008: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/kota/.rvm/rubies/ruby-2.7.0/include/ruby-2.7.0/ruby/ruby.h:1070: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/kota/.rvm/rubies/ruby-2.7.0/include/ruby-2.7.0/ruby/ruby.h:1070: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/kota/.rvm/rubies/ruby-2.7.0/include/ruby-2.7.0/ruby/ruby.h:1007:6: note: expanded from macro 'RSTRING_LEN'
RSTRING_EMBED_LEN(str) : \
^~~~~~~~~~~~~~~~~~~~~~
/Users/kota/.rvm/rubies/ruby-2.7.0/include/ruby-2.7.0/ruby/ruby.h:1003: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/kota/.rvm/rubies/ruby-2.7.0/include/ruby-2.7.0/ruby/ruby.h:1008: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/kota/.rvm/rubies/ruby-2.7.0/include/ruby-2.7.0/ruby/ruby.h:1070: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: warning: directory not found for option '-L/usr/local/opt/libksba/lib'
ld: warning: directory not found for option '-L/usr/local/opt/zlib/lib'
ld: warning: directory not found for option '-L/usr/local/opt/libksba/lib'
ld: warning: directory not found for option '-L/usr/local/opt/zlib/lib'
ld: warning: directory not found for option '-L/usr/local/opt/libksba/lib'
ld: warning: directory not found for option '-L/usr/local/opt/zlib/lib'
current directory: /Users/kota/.rvm/gems/ruby-2.7.0/gems/pg-1.2.3/ext
make "DESTDIR=" install
make: /usr/local/opt/coreutils/bin/gmkdir: No such file or directory
make: *** [.sitearchdir.time] Error 1
make install failed, exit code 2
Gem files will remain installed in /Users/kota/.rvm/gems/ruby-2.7.0/gems/pg-1.2.3 for inspection.
Results logged to /Users/kota/.rvm/gems/ruby-2.7.0/extensions/x86_64-darwin-16/2.7.0/pg-1.2.3/gem_make.out
I have already installed Postgresql with brew.
my Ruby version: ruby 2.7.0p0
my rails version: Rails 6.0.3.3
Getting below error when installing nokogiri i tried
install -y make gcc rpm-build ruby-devel zlib-devel
gem install nokogiri
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
current directory: /usr/local/rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/ext/nokogiri
/usr/local/rvm/rubies/ruby-2.7.1/bin/ruby -I /usr/local/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0 -r ./siteconf20200716-18065-1jmltdp.rb extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
Using mini_portile version 2.4.0
checking for gzdopen() in -lz... yes
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:
Building Nokogiri with a packaged version of libxml2-2.9.10
with the following patches applied:
- 0001-Revert-Do-not-URI-escape-in-server-side-includes.patch
- 0002-Remove-script-macro-support.patch
- 0003-Update-entities-to-remove-handling-of-ssi.patch
- 0004-libxml2.la-is-in-top_builddir.patch
- 0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch
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.10.tar.gz into tmp/x86_64-pc-linux-gnu/ports/libxml2/2.9.10... OK
Running patch with /usr/local/rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch... OK
Running patch with /usr/local/rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/patches/libxml2/0002-Remove-script-macro-support.patch... OK
Running patch with /usr/local/rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/patches/libxml2/0003-Update-entities-to-remove-handling-of-ssi.patch... OK
Running patch with /usr/local/rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/patches/libxml2/0004-libxml2.la-is-in-top_builddir.patch... OK
Running patch with /usr/local/rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/patches/libxml2/0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch... OK
Running 'configure' for libxml2 2.9.10... OK
Running 'compile' for libxml2 2.9.10... OK
Running 'install' for libxml2 2.9.10... OK
Activating libxml2 2.9.10 (from /usr/local/rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/ports/x86_64-pc-linux-gnu/libxml2/2.9.10)...
************************************************************************
IMPORTANT NOTICE:
Building Nokogiri with a packaged version of libxslt-1.1.34.
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
************************************************************************
Extracting libxslt-1.1.34.tar.gz into tmp/x86_64-pc-linux-gnu/ports/libxslt/1.1.34... OK
Running 'configure' for libxslt 1.1.34... OK
Running 'compile' for libxslt 1.1.34... OK
Running 'install' for libxslt 1.1.34... OK
Activating libxslt 1.1.34 (from /usr/local/rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/ports/x86_64-pc-linux-gnu/libxslt/1.1.34)...
checking for -llzma... yes
checking for xmlParseDoc() in libxml/parser.h... yes
checking for xsltParseStylesheetDoc() in libxslt/xslt.h... yes
checking for exsltFuncRegister() in libexslt/exslt.h... yes
checking for xmlHasFeature()... yes
checking for xmlFirstElementChild()... yes
checking for xmlRelaxNGSetParserStructuredErrors()... yes
checking for xmlRelaxNGSetParserStructuredErrors()... yes
checking for xmlRelaxNGSetValidStructuredErrors()... yes
checking for xmlSchemaSetValidStructuredErrors()... yes
checking for xmlSchemaSetParserStructuredErrors()... yes
creating Makefile
current directory: /usr/local/rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/ext/nokogiri
make "DESTDIR=" clean
current directory: /usr/local/rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/ext/nokogiri
make "DESTDIR="
compiling html_document.c
compiling html_element_description.c
compiling html_entity_lookup.c
compiling html_sax_parser_context.c
compiling html_sax_push_parser.c
compiling nokogiri.c
compiling xml_attr.c
compiling xml_attribute_decl.c
compiling xml_cdata.c
compiling xml_comment.c
compiling xml_document.c
xml_document.c: In function ‘dealloc’:
xml_document.c:49:3: warning: passing argument 2 of ‘rb_st_foreach’ from incompatible pointer type [enabled by default]
st_foreach(node_hash, dealloc_node_i, (st_data_t)doc);
^
In file included from /usr/local/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby/intern.h:39:0,
from /usr/local/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby/ruby.h:2148,
from /usr/local/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby.h:33,
from ./nokogiri.h:33,
from ./xml_document.h:4,
from xml_document.c:1:
/usr/local/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby/st.h:141:5: note: expected ‘int (*)(st_data_t, st_data_t, st_data_t)’ but argument is of type ‘int (*)(struct xmlNode *, struct xmlNode *, struct xmlDoc *)’
int rb_st_foreach(st_table *, st_foreach_callback_func *, st_data_t);
^
xml_document.c: At top level:
cc1: warning: unrecognized command line option "-Wno-tautological-compare" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-self-assign" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-parentheses-equality" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-constant-logical-operand" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-cast-function-type" [enabled by default]
compiling xml_document_fragment.c
compiling xml_dtd.c
compiling xml_element_content.c
compiling xml_element_decl.c
compiling xml_encoding_handler.c
compiling xml_entity_decl.c
compiling xml_entity_reference.c
compiling xml_io.c
xml_io.c: In function ‘io_read_callback’:
xml_io.c:20:3: warning: passing argument 1 of ‘rb_rescue’ from incompatible pointer type [enabled by default]
string = rb_rescue(read_check, (VALUE)args, read_failed, 0);
^
In file included from /usr/local/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby.h:33:0,
from ./nokogiri.h:33,
from ./xml_io.h:4,
from xml_io.c:1:
**/usr/local/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby/ruby.h:1987:7: note: expected ‘VALUE (*)(VALUE)’ but argument is of type ‘VALUE (*)(VALUE *)’
VALUE rb_rescue(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE);**
^
*xml_io.c:20:3: warning: passing argument 3 of ‘rb_rescue’ from incompatible pointer type [enabled by default]
string = rb_rescue(read_check, (VALUE)args, read_failed, 0);
^*
In file included from /usr/local/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby.h:33:0,
from ./nokogiri.h:33,
from ./xml_io.h:4,
from xml_io.c:1:
/usr/local/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby/ruby.h:1987:7: note: expected ‘VALUE (*)(VALUE, VALUE)’ but argument is of type ‘VALUE (*)(void)’
VALUE rb_rescue(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE);
^
xml_io.c: In function ‘io_write_callback’:
xml_io.c:47:3: warning: passing argument 1 of ‘rb_rescue’ from incompatible pointer type [enabled by default]
size = rb_rescue(write_check, (VALUE)args, write_failed, 0);
^
In file included from /usr/local/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby.h:33:0,
from ./nokogiri.h:33,
from ./xml_io.h:4,
from xml_io.c:1:
/usr/local/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby/ruby.h:1987:7:
note: expected ‘VALUE ()(VALUE)’ but argument is of type ‘VALUE
()(VALUE )’
VALUE rb_rescue(VALUE()(VALUE),VALUE,VALUE()(VALUE,VALUE),VALUE);
^
xml_io.c:47:3: warning: passing argument 3 of ‘rb_rescue’ from incompatible pointer type [enabled by default]
size = rb_rescue(write_check, (VALUE)args, write_failed, 0);
^
In file included from /usr/local/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby.h:33:0,
from ./nokogiri.h:33,
from ./xml_io.h:4,
from xml_io.c:1:
/usr/local/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby/ruby.h:1987:7:
note: expected ‘VALUE ()(VALUE, VALUE)’ but argument is of type
‘VALUE ()(void)’
VALUE rb_rescue(VALUE()(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE);
^
***xml_io.c: At top level:
cc1: warning: unrecognized command line option "-Wno-tautological-compare" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-self-assign" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-parentheses-equality" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-constant-logical-operand" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-cast-function-type" [enabled by default]
compiling xml_libxml2_hacks.c
compiling xml_namespace.c
compiling xml_node.c
xml_node.c: In function ‘reparent_node_with’:
xml_node.c:304:7: warning: passing argument 1 of ‘xmlFree’ discards ‘const’ qualifier from pointer target type [enabled by default]
xmlFree(reparentee->ns->prefix);
^***
xml_node.c:304:7: note: expected ‘void *’ but argument is of type ‘const xmlChar *’
xml_node.c: At top level:
cc1: warning: unrecognized command line option "-Wno-tautological-compare" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-self-assign" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-parentheses-equality" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-constant-logical-operand" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-cast-function-type" [enabled by default]
compiling xml_node_set.c
compiling xml_processing_instruction.c
compiling xml_reader.c
compiling xml_relax_ng.c
compiling xml_sax_parser.c
compiling xml_sax_parser_context.c
compiling xml_sax_push_parser.c
compiling xml_schema.c
compiling xml_syntax_error.c
compiling xml_text.c
compiling xml_xpath_context.c
compiling xslt_stylesheet.c
xslt_stylesheet.c:112:13: warning: ‘swallow_superfluous_xml_errors’ defined but not used [-Wunused-function]
static void swallow_superfluous_xml_errors(void * userdata, xmlErrorPtr error, ...)
^
cc1: warning: unrecognized command line option "-Wno-tautological-compare" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-self-assign" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-parentheses-equality" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-constant-logical-operand" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-cast-function-type" [enabled by default]
linking shared-object nokogiri/nokogiri.so
/usr/bin/ld: unrecognized option '--compress-debug-sections=zlib'
/usr/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status
make: *** [nokogiri.so] Error 1
make failed, exit code 2
as far as my version of centos is old and /usr/bin/ld is a part of binutils, so my suggestion
$ sudo yum update binutils
helped me (instead of full OS update)
My Centos version was 7.6 and all provided solution for nokogiri was not working. Finally i updated centos to 7.8 and it worked. i tried with centos 7.7 version in other server also, it worked on 7.7 also.
i encountered exactly same problem.
It seems that the real error is
/usr/bin/ld: unrecognized option '--compress-debug-sections=zlib'
The flag "--compress-debug-sections=zlib" is defined in file /usr/local/rvm/gems/ruby-2.7.0/gems/nokogiri-1.10.10/ext/nokogiri/Makefile .
This makefile is created by a mkmf.rb, and default value of flags are in this file /usr/local/rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/x86_64-linux/rbconfig.rb
CONFIG["DLDFLAGS"] = "-Wl,--compress-debug-sections=zlib"
After I changed this line to be
CONFIG["DLDFLAGS"] = ""
gem install nokogiri works well
But I am not sure about the exactly function of flag "--compress-debug-sections=zlib" and what would happen when i removed it
This error comes because the default linker on Centos 7.4 does not support that option --compress-debug-sections=zlib. Centos 7.8 seems to fix this issue.
But in case you could not switch to Centos 7.8, the option is supported by the gold linker (ld.gold).
To enable the use, you could override the linker by doing something like
ln -s /bin/ld.gold ~/bin/ld; PATH=~/bin:$PATH
then run the needed command
I have problems installing a specific ruby version on my machine running ElCapitan.
The version number is 1.9.3-p551.
It says: BUILD FAILED (OS X 10.11.6 using ruby-build 20160426)
This is the log file (parts of it):
/tmp/ruby-build.20160920112831.62235 ~/Desktop/localhost/project
/tmp/ruby-build.20160920112831.62235/ruby-1.9.3-p551 /tmp/ruby-build.20160920112831.62235 ~/Desktop/localhost/project
configure: WARNING: unrecognized options: --with-openssl-dir, --with-libyaml-dir, --with-readline-dir
checking build system type... x86_64-apple-darwin15.6.0
checking host system type... x86_64-apple-darwin15.6.0
checking target system type... x86_64-apple-darwin15.6.0
checking whether the C compiler works... yes
[..]
compiling class.c
bignum.c:1449:23: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
if (a > 0.0) return INT2FIX(-1);
^~~~~~~~~~~
./include/ruby/ruby.h:225:48: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
~~~~~~~~~~~~~~~~~~~^
bignum.c:1460:51: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
if (RBIGNUM_SIGN(x) < RBIGNUM_SIGN(y)) return INT2FIX(-1);
^~~~~~~~~~~
./include/ruby/ruby.h:225:48: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
~~~~~~~~~~~~~~~~~~~^
bignum.c:1462:29: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
return (RBIGNUM_SIGN(x)) ? INT2FIX(-1) : INT2FIX(1);
^~~~~~~~~~~
./include/ruby/ruby.h:225:48: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
~~~~~~~~~~~~~~~~~~~^
bignum.c:1464:42: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
return (RBIGNUM_SIGN(x)) ? INT2FIX(1) : INT2FIX(-1);
^~~~~~~~~~~
./include/ruby/ruby.h:225:48: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
~~~~~~~~~~~~~~~~~~~^
bignum.c:1472:34: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
(RBIGNUM_SIGN(x) ? INT2FIX(1) : INT2FIX(-1)) :
^~~~~~~~~~~
./include/ruby/ruby.h:225:48: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
~~~~~~~~~~~~~~~~~~~^
bignum.c:1473:25: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
(RBIGNUM_SIGN(x) ? INT2FIX(-1) : INT2FIX(1));
^~~~~~~~~~~
./include/ruby/ruby.h:225:48: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
~~~~~~~~~~~~~~~~~~~^
bignum.c:1493:22: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
if (a > 0.0) rel = INT2FIX(-1);
^~~~~~~~~~~
./include/ruby/ruby.h:225:48: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
~~~~~~~~~~~~~~~~~~~^
bignum.c:1680:20: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
if (!i) return INT2FIX(~(SIGNED_VALUE)0);
^~~~~~~~~~~~~~~~~~~~~~~~~
./include/ruby/ruby.h:225:48: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
~~~~~~~~~~~~~~~~~~~^
bignum.c:3414:40: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
return RBIGNUM_SIGN(x) ? INT2FIX(0) : INT2FIX(-1);
^~~~~~~~~~~
./include/ruby/ruby.h:225:48: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
~~~~~~~~~~~~~~~~~~~^
bignum.c:3538:13: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
return INT2FIX(-1);
^~~~~~~~~~~
./include/ruby/ruby.h:225:48: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
~~~~~~~~~~~~~~~~~~~^
bignum.c:3548:14: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
else return INT2FIX(-1);
^~~~~~~~~~~
./include/ruby/ruby.h:225:48: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
~~~~~~~~~~~~~~~~~~~^
array.c:3341:12: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
return INT2FIX(-1);
^~~~~~~~~~~
./include/ruby/ruby.h:225:48: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
~~~~~~~~~~~~~~~~~~~^
[..]
linking shared-object pty.bundle
ld: warning: directory not found for option '-L/Users/indulis/.rbenv/versions/1.9.3-p551/lib'
linking shared-object psych.bundle
ld: warning: directory not found for option '-L/Users/indulis/.rbenv/versions/1.9.3-p551/lib'
installing default pty libraries
compiling cparse.c
installing default psych libraries
compiling ossl_cipher.c
compiling readline.c
compiling ossl_config.c
installing default cparse libraries
linking shared-object racc/cparse.bundle
ld: warning: directory not found for option '-L/Users/indulis/.rbenv/versions/1.9.3-p551/lib'
compiling ossl_digest.c
compiling ripper.c
installing default readline libraries
linking shared-object readline.bundle
ld: warning: directory not found for option '-L/Users/indulis/.rbenv/versions/1.9.3-p551/lib'
compiling ossl_engine.c
compiling _sdbm.c
ripper.y:6191:5: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
nd_set_line(lex_strterm, ruby_sourceline);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../node.h:278:43: note: expanded from macro 'nd_set_line'
RNODE(n)->flags=((RNODE(n)->flags&~(-1<<NODE_LSHIFT))|(((l)&NODE_LMASK)<<NODE_LSHIFT))
~~^
compiling ossl_hmac.c
compiling init.c
compiling ossl_ns_spki.c
compiling ossl_ocsp.c
linking shared-object nkf.bundle
ld: warning: directory not found for option '-L/Users/indulis/.rbenv/versions/1.9.3-p551/lib'
installing default sdbm libraries
linking shared-object sdbm.bundle
ld: warning: directory not found for option '-L/Users/indulis/.rbenv/versions/1.9.3-p551/lib'
generating constant definitions
ossl_ocsp.c:749:5: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
DefOCSPConst(REVOKED_STATUS_NOSTATUS);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ossl_ocsp.c:740:52: note: expanded from macro 'DefOCSPConst'
#define DefOCSPConst(x) rb_define_const(mOCSP, #x, INT2NUM(OCSP_##x))
^~~~~~~~~~~~~~~~~
../.././include/ruby/ruby.h:973:21: note: expanded from macro 'INT2NUM'
# define INT2NUM(v) INT2FIX((int)(v))
^~~~~~~~~~~~~~~~~
../.././include/ruby/ruby.h:225:48: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
~~~~~~~~~~~~~~~~~~~^
compiling stringio.c
generating constant definitions
compiling basicsocket.c
1 warning generated.
compiling ossl_pkcs12.c
compiling socket.c
compiling ossl_pkcs5.c
installing default stringio libraries
linking shared-object stringio.bundle
ld: warning: directory not found for option '-L/Users/indulis/.rbenv/versions/1.9.3-p551/lib'
compiling ossl_pkcs7.c
compiling ipsocket.c
compiling strscan.c
compiling tcpsocket.c
compiling tcpserver.c
compiling sockssocket.c
compiling ossl_pkey.c
installing default strscan libraries
linking shared-object strscan.bundle
ld: warning: directory not found for option '-L/Users/indulis/.rbenv/versions/1.9.3-p551/lib'
compiling udpsocket.c
compiling ossl_pkey_dh.c
compiling unixsocket.c
compiling ossl_pkey_dsa.c
compiling unixserver.c
compiling option.c
compiling bytecode.c
compiling ossl_pkey_ec.c
compiling emitter.c
compiling ancdata.c
compiling ossl_pkey_rsa.c
compiling gram.c
compiling raddrinfo.c
compiling handler.c
compiling ossl_rand.c
compiling implicit.c
compiling ossl_ssl.c
ossl_ssl.c:987:13: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
if (rc = SSL_shutdown(ssl))
~~~^~~~~~~~~~~~~~~~~~~
ossl_ssl.c:987:13: note: place parentheses around the assignment to silence this warning
if (rc = SSL_shutdown(ssl))
^
( )
ossl_ssl.c:987:13: note: use '==' to turn this assignment into an equality comparison
if (rc = SSL_shutdown(ssl))
^
==
ossl_ssl.c:1993:5: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
ossl_ssl_def_const(OP_ALL);
^~~~~~~~~~~~~~~~~~~~~~~~~~
ossl_ssl.c:1973:57: note: expanded from macro 'ossl_ssl_def_const'
#define ossl_ssl_def_const(x) rb_define_const(mSSL, #x, INT2NUM(SSL_##x))
^~~~~~~~~~~~~~~~
../.././include/ruby/ruby.h:973:21: note: expanded from macro 'INT2NUM'
# define INT2NUM(v) INT2FIX((int)(v))
^~~~~~~~~~~~~~~~~
../.././include/ruby/ruby.h:225:48: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
~~~~~~~~~~~~~~~~~~~^
compiling node.c
compiling init.c
compiling rubyext.c
compiling constants.c
2 warnings generated.
compiling ossl_ssl_session.c
compiling ossl_x509.c
compiling syck.c
compiling ossl_x509attr.c
compiling token.c
compiling ossl_x509cert.c
installing default socket libraries
linking shared-object socket.bundle
ld: warning: directory not found for option '-L/Users/indulis/.rbenv/versions/1.9.3-p551/lib'
compiling syslog.c
installing default syslog libraries
linking shared-object syslog.bundle
compiling ossl_x509crl.c
ld: warning: directory not found for option '-L/Users/indulis/.rbenv/versions/1.9.3-p551/lib'
compiling stubs.c
In file included from stubs.c:16:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/tk.h:78:11: fatal error: 'X11/Xlib.h' file not found
# include <X11/Xlib.h>
^
1 error generated.
make[2]: *** [stubs.o] Error 1
make[1]: *** [ext/tk/all] Error 2
make[1]: *** Waiting for unfinished jobs....
compiling yaml2byte.c
compiling ossl_x509ext.c
compiling ossl_x509name.c
linking shared-object syck.bundle
ld: warning: directory not found for option '-L/Users/indulis/.rbenv/versions/1.9.3-p551/lib'
ossl_x509name.c:290:28: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
if (result < 0) return INT2FIX(-1);
^~~~~~~~~~~
../.././include/ruby/ruby.h:225:48: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
~~~~~~~~~~~~~~~~~~~^
checking ../.././parse.y and ../.././ext/ripper/eventids2.c
installing default syck libraries
compiling ossl_x509req.c
compiling ossl_x509revoked.c
1 warning generated.
installing default ripper libraries
compiling ossl_x509store.c
installing default openssl libraries
linking shared-object openssl.bundle
ld: warning: directory not found for option '-L/Users/indulis/.rbenv/versions/1.9.3-p551/lib'
1 warning generated.
linking shared-object ripper.bundle
ld: warning: directory not found for option '-L/Users/indulis/.rbenv/versions/1.9.3-p551/lib'
make: *** [build-ext] Error 2
I'm not sure how to fix it.
While doing Bundle install for my app, I'm getting an error related to therubyracer (0.9.4).
This is the error:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/kpvarma/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
creating Makefile
make
compiling rr.cpp
clang: warning: argument unused during compilation: '-rdynamic'
rr.cpp:48:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
rr.cpp:151:44: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
return String::New(RSTRING_PTR(value), RSTRING_LEN(value));
^~~~~~~~~~~~~~~~~~
/Users/kpvarma/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:674:6: note: expanded from macro 'RSTRING_LEN'
RSTRING_EMBED_LEN(str) : \
^
/Users/kpvarma/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:670:6: note: expanded from macro 'RSTRING_EMBED_LEN'
(long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rr.cpp:151:44: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
return String::New(RSTRING_PTR(value), RSTRING_LEN(value));
^~~~~~~~~~~~~~~~~~
/Users/kpvarma/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:675:28: note: expanded from macro 'RSTRING_LEN'
RSTRING(str)->as.heap.len)
^
3 warnings generated.
compiling v8.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_array.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_callbacks.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_context.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_date.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_debug.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_exception.cpp
clang: warning: argument unused during compilation: '-rdynamic'
v8_exception.cpp:15:8: warning: unused function 'segfault' [-Wunused-function]
void segfault(int sig) {
^
1 warning generated.
compiling v8_external.cpp
clang: warning: argument unused during compilation: '-rdynamic'
v8_external.cpp:10:9: warning: unused variable 'references' [-Wunused-variable]
VALUE references;
^
1 warning generated.
compiling v8_function.cpp
clang: warning: argument unused during compilation: '-rdynamic'
v8_function.cpp:24:23: error: variable length array of non-POD element type 'Handle<v8::Value>'
Handle<Value> argv[argc];
^
v8_function.cpp:36:23: error: variable length array of non-POD element type 'Handle<v8::Value>'
Handle<Value> argv[argc];
^
2 errors generated.
make: *** [v8_function.o] Error 1
Gem files will remain installed in /Users/kpvarma/.rvm/gems/ruby-1.9.3-p194/gems/therubyracer-0.9.4 for inspection.
Results logged to /Users/kpvarma/.rvm/gems/ruby-1.9.3-p194/gems/therubyracer-0.9.4/ext/v8/gem_make.out
An error occured while installing therubyracer (0.9.4), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.9.4'` succeeds before bundling.
I amm using ruby-1.9.3-p194 on Mac.
Can anyone please help me out?
Thank you
Regards
I want to update to rails 3.2, but the build process of therubyracer (0.9.9) fails. I've no clue what I've to do.
My environment:
Debian Squeeze (2.6.32-5-amd64)
make
compiling v8_external.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from v8_external.cpp:4:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::External]’:
v8_external.cpp:51: instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
v8_external.cpp: At global scope:
v8_external.cpp:10: warning: ‘<unnamed>::references’ defined but not used
compiling v8_context.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from v8_context.cpp:2:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Context]’:
v8_context.cpp:15: instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::ObjectTemplate]’:
v8_context.cpp:22: instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Value]’:
v8_context.cpp:23: instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
compiling v8_value.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from v8_value.cpp:1:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Value]’:
v8_value.cpp:10: instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
compiling v8_message.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from v8_message.cpp:2:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Message]’:
v8_message.cpp:10: instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
compiling v8_date.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from v8_date.cpp:4:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Date]’:
v8_date.cpp:21: instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
compiling v8_handle.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
compiling v8_v8.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
compiling v8_callbacks.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
compiling v8_array.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from v8_array.cpp:1:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Array]’:
v8_array.cpp:13: instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
compiling v8_exception.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from v8_exception.cpp:3:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::StackTrace]’:
v8_exception.cpp:48: instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::StackFrame]’:
v8_exception.cpp:68: instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
v8_exception.cpp: At global scope:
v8_exception.cpp:10: warning: ‘<unnamed>::stack’ defined but not used
compiling v8_weakref.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
compiling v8_debug.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
compiling v8_function.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from v8_function.cpp:5:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Function]’:
v8_function.cpp:13: instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Array]’:
v8_function.cpp:23: instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::String]’:
v8_function.cpp:49: instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
compiling v8_object.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from v8_object.cpp:1:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Object]’:
v8_object.cpp:17: instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
compiling v8_locker.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
v8_locker.cpp: In function ‘VALUE<unnamed>::Lock::Delete(VALUE)’:
v8_locker.cpp:45: warning: no return statement in function returning non-void
v8_locker.cpp: In function ‘VALUE<unnamed>::Unlock::Delete(VALUE)’:
v8_locker.cpp:85: warning: no return statement in function returning non-void
compiling v8_script.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from v8_script.cpp:2:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Script]’:
v8_script.cpp:25: instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
compiling v8_string.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from v8_string.cpp:3:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::String]’:
v8_string.cpp:13: instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
compiling v8.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
compiling rr.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
rr.cpp: In function ‘VALUE rr_define_finalizer(VALUE, void*, VALUE)’:
rr.cpp:48: warning: no return statement in function returning non-void
In file included from rr.cpp:3:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Value]’:
rr.cpp:159: instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
compiling v8_template.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from v8_template.cpp:2:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Template]’:
v8_template.cpp:42: instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::ObjectTemplate]’:
v8_template.cpp:45: instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::FunctionTemplate]’:
v8_template.cpp:48: instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Data]’:
v8_template.cpp:54: instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
compiling v8_try_catch.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
linking shared-object v8.so
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.4.5/libstdc++.a(functexcept.o): relocation R_X86_64_32 against `std::bad_typeid::~bad_typeid()' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/libstdc++.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [v8.so] Error 1
UPDATE
I've tried the following:
Downloaded a copy of the source git clone https://github.com/cowboyd/therubyracer.git
Added $CPPFLAGS += " -fPIC" to the ext/v8/extconf.rb
Built gem with gem build therubyracer.gemspec
Installed gem with gem install therubyracer-0.9.9.gem
Same error was shown to me! Issue: https://github.com/cowboyd/therubyracer/issues/135
On a debian (686 with amd64 kernel) I had to uninstall livb8, download the gem and recompile for my architecture
gem uninstall libv8
wget http://rubygems.org/downloads/libv8-3.3.10.4.gem
ARCHFLAG='-arch i386' gem install ./libv8-3.3.10.4.gem
ARCHFLAG='-arch i386' gem install therubyracer
Then therubyracer (0.10.1) installed fine.
recompile with -fPIC
Have you tried adding -fPIC as an additional build flag? You can test it out in a gem install:
$ gem install therubyracer -- -fPIC
Or, with Bundler:
$ bundle config build.therubyracer -fPIC
It looks like someone else pointed it out in an issue. You might want to check it out if the above doesn't work.
One solution is to run the version 0.9.8 as version 0.9.9. (solves not the real problem):
Clone therubyracer's source git clone https://github.com/cowboyd/therubyracer.git
Checkout tag v0.9.8 git checkout v0.9.8
Change version number in ./lib/v8/version.rb to 0.9.9
Build the gem gem build therubyracer.gemspec
Install the gem gem install therubyracer-0.9.9.gem